Skip to content
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
d3d73d9
refactor(ts): passport/activeDirectory
jescalada Aug 24, 2025
ba086f1
chore: add missing types
jescalada Aug 24, 2025
0c7d1fb
refactor(ts): JWT handler and utils
jescalada Aug 24, 2025
b419f4e
refactor(ts): passport/index
jescalada Aug 24, 2025
06a64ea
refactor(ts): passport/local
jescalada Aug 24, 2025
4dfbc2d
refactor(ts): passport/ldaphelper
jescalada Aug 24, 2025
09a1876
refactor(ts): passport/oidc
jescalada Aug 24, 2025
abc09bd
refactor(ts): auth routes
jescalada Aug 24, 2025
03c4952
refactor(ts): config routes
jescalada Aug 24, 2025
7ed9eb0
refactor(ts): misc routes and index
jescalada Aug 24, 2025
3d99de2
refactor(ts): push routes and update related types/db handlers
jescalada Aug 24, 2025
944e0b5
refactor(ts): repo routes
jescalada Aug 24, 2025
6a7089f
refactor(ts): user routes
jescalada Aug 24, 2025
6c9d3bf
refactor(ts): emailSender and missing implementation
jescalada Aug 24, 2025
6899e4e
refactor(ts): service/index and missing types
jescalada Aug 24, 2025
63c30a0
refactor(ts): urls
jescalada Aug 24, 2025
812a910
fix: failing tests due to incorrect imports
jescalada Aug 27, 2025
9d5bdd8
chore: update .eslintrc
jescalada Aug 27, 2025
c951015
chore: fix type checks
jescalada Aug 27, 2025
b046903
chore: fix CLI service imports
jescalada Aug 27, 2025
97ad7c7
Merge branch 'main' of https://github.com/finos/git-proxy into servic…
jescalada Aug 28, 2025
9008ac5
chore: run npm format
jescalada Aug 28, 2025
f36b3d1
test: add basic oidc tests and ignore openid-client type error on import
jescalada Aug 28, 2025
51df315
test: increase testOidc and testPush coverage
jescalada Aug 28, 2025
f7ed291
test: improve push test coverage
jescalada Aug 28, 2025
b2b1b14
test: add missing smtp tests
jescalada Aug 28, 2025
ae43800
Update .eslintrc.json
jescalada Aug 29, 2025
17a8adf
Update src/db/file/users.ts
jescalada Aug 29, 2025
c7cf87e
Update src/service/passport/jwtAuthHandler.ts
jescalada Aug 29, 2025
8aa1a97
Update src/service/passport/index.ts
jescalada Aug 29, 2025
962a0ba
chore: fix service/index proxy type and npm run format
jescalada Aug 29, 2025
7eda433
Update src/service/passport/jwtAuthHandler.ts
jescalada Aug 29, 2025
df80fef
Update src/service/passport/jwtUtils.ts
jescalada Aug 29, 2025
095ae62
chore: add getSessionStore helper for fs sink and fix types
jescalada Aug 29, 2025
b094ff1
Merge branch 'service-ts-refactor-redone' of https://github.com/jesca…
jescalada Aug 29, 2025
f9cea8c
chore: remove unnecessary casting for JWT verifiedPayload
jescalada Aug 29, 2025
ee63f9c
chore: update getSessionStore call
jescalada Aug 29, 2025
0dc78ce
chore: replace unused UserInfoResponse with imported version
jescalada Aug 29, 2025
2429fbe
chore: improve userEmail checks on push routes
jescalada Aug 29, 2025
a368642
chore: update packages
jescalada Aug 29, 2025
8971566
Merge branch 'main' into service-ts-refactor-redone
jescalada Aug 29, 2025
6c427b9
chore: add typing for thirdPartyApiConfig
jescalada Sep 3, 2025
5805dd9
chore: fix AD passport types
jescalada Sep 3, 2025
bec32f7
chore: replace AD type with activedirectory2
jescalada Sep 4, 2025
573cc92
chore: improve loginSuccessHandler
jescalada Sep 4, 2025
a211560
chore: fix PushQuery typing
jescalada Sep 4, 2025
e299e85
chore: fix "any" in repo and users routes and fix failing tests
jescalada Sep 4, 2025
3dd1bd0
refactor: flatten push routes and fix typings
jescalada Sep 4, 2025
8e6d1d3
chore: add isAdminUser check to repo routes
jescalada Sep 4, 2025
db60fbf
test: improve push test checks for cancel endpoint
jescalada Sep 4, 2025
dfb1e04
Merge branch 'main' into service-ts-refactor-redone
jescalada Sep 4, 2025
95495f2
chore: fix createDefaultAdmin and isAdminUser functions
jescalada Sep 4, 2025
3469b54
chore: fix thirdPartyApiConfig and AD type errors
jescalada Sep 4, 2025
cd68915
chore: remove nodemailer and unused functionality
jescalada Sep 4, 2025
728b5aa
chore: fix failing CLI test (email not unique)
jescalada Sep 4, 2025
4d3d083
chore: remove unused smtp config variables
jescalada Sep 4, 2025
0343438
Update src/service/routes/publicApi.ts
jescalada Sep 5, 2025
0109b0b
chore: fix toPublicUser calls and typing
jescalada Sep 5, 2025
052a00e
Merge branch 'main' into service-ts-refactor-redone
jescalada Sep 10, 2025
3a66ca4
chore: update sample test src/service import
jescalada Sep 10, 2025
dd42438
Merge remote-tracking branch 'origin/main' into service-ts-refactor-r…
jescalada Sep 22, 2025
a3e5f22
Merge remote-tracking branch 'origin/main' into service-ts-refactor-r…
jescalada Sep 24, 2025
8fb0236
Merge branch 'main' into service-ts-refactor-redone
kriswest Sep 24, 2025
a124277
Merge branch 'main' into service-ts-refactor-redone
jescalada Sep 24, 2025
eef5f40
Merge branch 'main' into service-ts-refactor-redone
jescalada Sep 26, 2025
bd96208
Merge branch 'main' into service-ts-refactor-redone
jescalada Oct 1, 2025
36a68f3
chore: fix type error on AuthenticationElement rename
jescalada Oct 1, 2025
e257953
Merge branch 'main' into service-ts-refactor-redone
jescalada Oct 2, 2025
8bc162e
Merge branch 'main' into service-ts-refactor-redone
jescalada Oct 6, 2025
9b1e905
Merge branch 'main' into service-ts-refactor-redone
kriswest Oct 9, 2025
07d059e
chore: remove unused types file and references
jescalada Oct 10, 2025
2fd8e11
Update src/service/passport/ldaphelper.ts
jescalada Oct 10, 2025
d1b4388
chore: improve jwtAuthHandler checks
jescalada Oct 10, 2025
bd7cb33
Merge branch 'service-ts-refactor-redone' of https://github.com/jesca…
jescalada Oct 10, 2025
233deac
fix: remove gitAccount and fix authorise push route conflicts
jescalada Oct 10, 2025
c4190dc
chore: remove unused reviewerGitAccount processing and fix getProxyUr…
jescalada Oct 10, 2025
fa102f0
Merge branch 'main' into service-ts-refactor-redone
jescalada Oct 17, 2025
820400d
chore: fix type errors
jescalada Oct 17, 2025
efe59f5
fix: convert imports to ESM to fix CLI test failures
jescalada Oct 17, 2025
a58f95c
feat: add reviewer email to push authorise endpoint
jescalada Oct 17, 2025
bf37942
chore: remove service parameter from testCliUtils start/stop calls
jescalada Oct 17, 2025
29b3bda
chore: add test-package/package-lock.json to .gitignore
jescalada Oct 17, 2025
9bc41e2
Delete test/fixtures/test-package/package-lock.json
jescalada Oct 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 116 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"lusca": "^1.7.0",
"moment": "^2.30.1",
"mongodb": "^5.9.2",
"nodemailer": "^6.10.1",
"openid-client": "^6.8.0",
"parse-diff": "^0.11.1",
"passport": "^0.7.0",
Expand All @@ -92,12 +91,20 @@
"@eslint/compat": "^1.4.0",
"@eslint/js": "^9.36.0",
"@eslint/json": "^0.13.2",
"@types/activedirectory2": "^1.2.6",
"@types/cors": "^2.8.19",
"@types/domutils": "^1.7.8",
"@types/express": "^5.0.3",
"@types/express-http-proxy": "^1.6.7",
"@types/express-session": "^1.18.2",
"@types/jsonwebtoken": "^9.0.10",
"@types/jwk-to-pem": "^2.0.3",
"@types/lodash": "^4.17.20",
"@types/lusca": "^1.7.5",
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.6",
"@types/passport": "^1.0.17",
"@types/passport-local": "^1.0.38",
"@types/react-dom": "^17.0.26",
"@types/react-html-parser": "^2.0.7",
"@types/validator": "^13.15.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/git-proxy-cli/test/testCli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require('../../../src/config/file').configFile = path.join(
'test',
'testCli.proxy.config.json',
);
const service = require('../../../src/service');
const service = require('../../../src/service').default;

/* test constants */
// push ID which does not exist
Expand Down Expand Up @@ -566,7 +566,7 @@ describe('test git-proxy-cli', function () {
await helper.startServer(service);
await helper.runCli(`npx -- @finos/git-proxy-cli login --username admin --password admin`);

const cli = `npx -- @finos/git-proxy-cli create-user --username ${uniqueUsername} --password newpass --email new@email.com --gitAccount newgit`;
const cli = `npx -- @finos/git-proxy-cli create-user --username ${uniqueUsername} --password newpass --email ${uniqueUsername}@email.com --gitAccount newgit`;
const expectedExitCode = 0;
const expectedMessages = [`User '${uniqueUsername}' created successfully`];
const expectedErrorMessages = null;
Expand All @@ -576,7 +576,7 @@ describe('test git-proxy-cli', function () {
await helper.runCli(
`npx -- @finos/git-proxy-cli login --username ${uniqueUsername} --password newpass`,
0,
[`Login "${uniqueUsername}" <new@email.com>: OK`],
[`Login "${uniqueUsername}" <${uniqueUsername}@email.com>: OK`],
null,
);
} finally {
Expand Down
56 changes: 55 additions & 1 deletion src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface UserSettings {
apiAuthentication: Authentication[];
tempPassword?: TempPasswordConfig;
proxyUrl: string;
api: Record<string, any>;
api: ThirdPartyApiConfig;
cookieSecret: string;
sessionMaxAgeHours: number;
tls?: TLSConfig;
Expand Down Expand Up @@ -49,6 +49,39 @@ export interface Authentication {
type: string;
enabled: boolean;
options?: Record<string, unknown>;
oidcConfig?: OidcConfig;
adConfig?: AdConfig;
jwtConfig?: JwtConfig;

// Deprecated fields for backwards compatibility
// TODO: remove in future release and keep the ones in adConfig
userGroup?: string;
adminGroup?: string;
domain?: string;
}

export interface OidcConfig {
issuer: string;
clientID: string;
clientSecret: string;
callbackURL: string;
scope: string;
}

export interface AdConfig {
url: string;
baseDN: string;
searchBase: string;
userGroup?: string;
adminGroup?: string;
domain?: string;
}

export interface JwtConfig {
clientID: string;
authorityURL: string;
roleMapping: Record<string, unknown>;
expectedAudience?: string;
}

export interface TempPasswordConfig {
Expand All @@ -59,3 +92,24 @@ export interface TempPasswordConfig {
export type RateLimitConfig = Partial<
Pick<RateLimitOptions, 'windowMs' | 'limit' | 'message' | 'statusCode'>
>;

export interface ThirdPartyApiConfig {
ls?: ThirdPartyApiConfigLs;
github?: ThirdPartyApiConfigGithub;
gitleaks?: ThirdPartyApiConfigGitleaks;
}

export interface ThirdPartyApiConfigLs {
userInADGroup: string;
}

export interface ThirdPartyApiConfigGithub {
baseUrl: string;
}

export interface ThirdPartyApiConfigGitleaks {
configPath: string;
enabled: boolean;
ignoreGitleaksAllow: boolean;
noColor: boolean;
}
1 change: 1 addition & 0 deletions src/db/file/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getSessionStore = (): undefined => undefined;
3 changes: 3 additions & 0 deletions src/db/file/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as users from './users';
import * as repo from './repo';
import * as pushes from './pushes';
import * as helper from './helper';

export const { getSessionStore } = helper;

export const { getPushes, writeAudit, getPush, deletePush, authorise, cancel, reject } = pushes;

Expand Down
3 changes: 2 additions & 1 deletion src/db/file/pushes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ const defaultPushQuery: PushQuery = {
blocked: true,
allowPush: false,
authorised: false,
type: 'push',
};

export const getPushes = (query: PushQuery): Promise<Action[]> => {
export const getPushes = (query: Partial<PushQuery>): Promise<Action[]> => {
if (!query) query = defaultPushQuery;
return new Promise((resolve, reject) => {
db.find(query, (err: Error, docs: Action[]) => {
Expand Down
7 changes: 4 additions & 3 deletions src/db/file/repo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import fs from 'fs';
import Datastore from '@seald-io/nedb';
import { Repo } from '../types';
import { toClass } from '../helper';
import _ from 'lodash';

import { Repo, RepoQuery } from '../types';
import { toClass } from '../helper';

const COMPACTION_INTERVAL = 1000 * 60 * 60 * 24; // once per day

// these don't get coverage in tests as they have already been run once before the test
Expand All @@ -27,7 +28,7 @@ try {
db.ensureIndex({ fieldName: 'name', unique: false });
db.setAutocompactionInterval(COMPACTION_INTERVAL);

export const getRepos = async (query: any = {}): Promise<Repo[]> => {
export const getRepos = async (query: Partial<RepoQuery> = {}): Promise<Repo[]> => {
if (query?.name) {
query.name = query.name.toLowerCase();
}
Expand Down
Loading
Loading