Skip to content

Commit f909c39

Browse files
committed
chore: resolve merge conflicts
2 parents b59dc94 + e7ee0d6 commit f909c39

File tree

28 files changed

+1730
-307
lines changed

28 files changed

+1730
-307
lines changed

cypress/e2e/login.cy.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ describe('Login page', () => {
3131
cy.url().should('include', '/dashboard/repo');
3232
})
3333

34+
it('should show an error snackbar on invalid login', () => {
35+
cy.get('[data-test="username"]').type('wronguser');
36+
cy.get('[data-test="password"]').type('wrongpass');
37+
cy.get('[data-test="login"]').click();
38+
39+
cy.get('.MuiSnackbarContent-message')
40+
.should('be.visible')
41+
.and('contain', 'You entered an invalid username or password...');
42+
});
43+
3444
describe('OIDC login button', () => {
3545
it('should exist', () => {
3646
cy.get('[data-test="oidc-login"]').should('exist');

experimental/license-inventory/package-lock.json

Lines changed: 775 additions & 125 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

experimental/license-inventory/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"devDependencies": {
3434
"@eslint/compat": "^1.2.7",
3535
"@eslint/js": "^9.21.0",
36-
"@jest/globals": "^29.7.0",
36+
"@jest/globals": "^30.0.3",
3737
"@types/cors": "^2.8.17",
3838
"@types/express": "^5.0.0",
3939
"@types/mongoose": "^5.11.97",

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@finos/git-proxy",
3-
"version": "1.17.2",
3+
"version": "1.18.0",
44
"description": "Deploy custom push protections and policies on top of Git.",
55
"scripts": {
66
"cli": "node ./packages/git-proxy-cli/index.js",
@@ -9,6 +9,7 @@
99
"server": "tsx index.ts",
1010
"start": "concurrently \"npm run server\" \"npm run client\"",
1111
"build": "npm run build-ui && npm run build-lib",
12+
"build-ts": "tsc",
1213
"build-ui": "vite build",
1314
"build-lib": "./scripts/build-for-publish.sh",
1415
"restore-lib": "./scripts/undo-build.sh",
@@ -66,7 +67,7 @@
6667
"moment": "^2.29.4",
6768
"mongodb": "^5.0.0",
6869
"nodemailer": "^6.6.1",
69-
"openid-client": "^6.3.1",
70+
"openid-client": "^6.4.2",
7071
"parse-diff": "^0.11.1",
7172
"passport": "^0.7.0",
7273
"passport-activedirectory": "^1.0.4",

proxy.config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,14 @@
153153
"type": "jwt",
154154
"enabled": false,
155155
"jwtConfig": {
156+
"authorityURL": "",
156157
"clientID": "",
157-
"authorityURL": ""
158+
"expectedAudience": "",
159+
"roleMapping": {
160+
"admin": {
161+
"": ""
162+
}
163+
}
158164
}
159165
}
160166
],

src/config/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ export const getDatabase = () => {
9494
* Get the list of enabled authentication methods
9595
*
9696
* At least one authentication method must be enabled.
97-
* @return {Array} List of enabled authentication methods
97+
* @return {Authentication[]} List of enabled authentication methods
9898
*/
99-
export const getAuthMethods = () => {
99+
export const getAuthMethods = (): Authentication[] => {
100100
if (_userSettings !== null && _userSettings.authentication) {
101101
_authentication = _userSettings.authentication;
102102
}
@@ -114,15 +114,19 @@ export const getAuthMethods = () => {
114114
* Get the list of enabled authentication methods for API endpoints
115115
*
116116
* If no API authentication methods are enabled, all endpoints are public.
117-
* @return {Array} List of enabled authentication methods
117+
* @return {Authentication[]} List of enabled authentication methods
118118
*/
119-
export const getAPIAuthMethods = () => {
119+
export const getAPIAuthMethods = (): Authentication[] => {
120120
if (_userSettings !== null && _userSettings.apiAuthentication) {
121121
_apiAuthentication = _userSettings.apiAuthentication;
122122
}
123123

124124
const enabledAuthMethods = _apiAuthentication.filter(auth => auth.enabled);
125125

126+
if (enabledAuthMethods.length === 0) {
127+
console.log("Warning: No authentication method enabled for API endpoints.");
128+
}
129+
126130
return enabledAuthMethods;
127131
};
128132

src/proxy/routes/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ const stripGitHubFromGitPath = (url: string): string | undefined => {
3434
*/
3535
const validGitRequest = (url: string, headers: any): boolean => {
3636
const { 'user-agent': agent, accept } = headers;
37+
if (!agent) {
38+
return false;
39+
}
3740
if (['/info/refs?service=git-upload-pack', '/info/refs?service=git-receive-pack'].includes(url)) {
3841
// https://www.git-scm.com/docs/http-protocol#_discovering_references
3942
// We can only filter based on User-Agent since the Accept header is not
4043
// sent in this request
4144
return agent.startsWith('git/');
4245
}
4346
if (['/git-upload-pack', '/git-receive-pack'].includes(url)) {
47+
if (!accept) {
48+
return false;
49+
}
4450
// https://www.git-scm.com/docs/http-protocol#_uploading_data
45-
return agent.startsWith('git/') && accept.startsWith('application/x-git-');
51+
return agent.startsWith('git/') && accept.startsWith('application/x-git-') ;
4652
}
4753
return false;
4854
};
@@ -67,7 +73,6 @@ router.use(
6773

6874
if (action.error || action.blocked) {
6975
res.set('content-type', 'application/x-git-receive-pack-result');
70-
res.set('transfer-encoding', 'chunked');
7176
res.set('expires', 'Fri, 01 Jan 1980 00:00:00 GMT');
7277
res.set('pragma', 'no-cache');
7378
res.set('cache-control', 'no-cache, max-age=0, must-revalidate');

src/service/passport/activeDirectory.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ const configure = (passport) => {
4343
const message = `User it not a member of ${userGroup}`;
4444
return done(message, null);
4545
}
46-
} catch (e) {
47-
const message = `An error occurred while checking if the user is a member of the user group: ${JSON.stringify(e)}`;
46+
} catch (err) {
47+
console.log('ad test (isUser): e', err);
48+
const message = `An error occurred while checking if the user is a member of the user group: ${err.message}`;
4849
return done(message, null);
4950
}
5051

@@ -53,9 +54,9 @@ const configure = (passport) => {
5354
try {
5455
isAdmin = await ldaphelper.isUserInAdGroup(req, profile, ad, domain, adminGroup);
5556

56-
} catch (e) {
57-
const message = `An error occurred while checking if the user is a member of the admin group: ${JSON.stringify(e)}`;
58-
console.error(message, e); // don't return an error for this case as you may still be a user
57+
} catch (err) {
58+
const message = `An error occurred while checking if the user is a member of the admin group: ${err.message}`;
59+
console.error(message, err); // don't return an error for this case as you may still be a user
5960
}
6061

6162
profile.admin = isAdmin;

src/service/passport/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const configure = async () => {
1616
passport.initialize();
1717

1818
const authMethods = config.getAuthMethods();
19-
console.log(`authMethods: ${JSON.stringify(authMethods)}`);
2019

2120
for (const auth of authMethods) {
2221
const strategy = authStrategies[auth.type.toLowerCase()];

0 commit comments

Comments
 (0)