Skip to content

Commit 551e237

Browse files
authored
Merge branch 'main' into JWT-UI-integration
2 parents 9d29901 + d9d8b18 commit 551e237

File tree

6 files changed

+33
-18
lines changed

6 files changed

+33
-18
lines changed

package-lock.json

Lines changed: 20 additions & 2 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@finos/git-proxy",
3-
"version": "2.0.0-rc.1",
3+
"version": "2.0.0-rc.2",
44
"description": "Deploy custom push protections and policies on top of Git.",
55
"scripts": {
66
"cli": "node ./packages/git-proxy-cli/index.js",
@@ -80,6 +80,7 @@
8080
"react-router-dom": "6.30.1",
8181
"simple-git": "^3.28.0",
8282
"uuid": "^11.1.0",
83+
"validator": "^13.15.15",
8384
"yargs": "^17.7.2"
8485
},
8586
"devDependencies": {
@@ -96,6 +97,7 @@
9697
"@types/node": "^22.17.0",
9798
"@types/react-dom": "^17.0.26",
9899
"@types/react-html-parser": "^2.0.7",
100+
"@types/validator": "^13.15.2",
99101
"@types/yargs": "^17.0.33",
100102
"@typescript-eslint/eslint-plugin": "^8.38.0",
101103
"@typescript-eslint/parser": "^8.38.0",

src/proxy/processors/push-action/checkAuthorEmails.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
import { Action, Step } from '../../actions';
22
import { getCommitConfig } from '../../../config';
33
import { Commit } from '../../actions/Action';
4+
import { isEmail } from 'validator';
45

56
const commitConfig = getCommitConfig();
67

78
const isEmailAllowed = (email: string): boolean => {
8-
if (!email) {
9+
if (!email || !isEmail(email)) {
910
return false;
1011
}
1112

1213
const [emailLocal, emailDomain] = email.split('@');
1314

14-
if (!emailLocal || !emailDomain) {
15-
return false;
16-
}
17-
1815
if (
1916
commitConfig.author.email.domain.allow &&
20-
!emailDomain.match(new RegExp(commitConfig.author.email.domain.allow, 'g'))
17+
!new RegExp(commitConfig.author.email.domain.allow, 'g').test(emailDomain)
2118
) {
2219
return false;
2320
}
2421

2522
if (
2623
commitConfig.author.email.local.block &&
27-
emailLocal.match(new RegExp(commitConfig.author.email.local.block, 'g'))
24+
new RegExp(commitConfig.author.email.local.block, 'g').test(emailLocal)
2825
) {
2926
return false;
3027
}

test/ConfigLoader.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ describe('ConfigLoader', () => {
331331

332332
// Verify the loaded config has expected structure
333333
expect(config).to.be.an('object');
334-
expect(config).to.have.property('proxyUrl');
335334
expect(config).to.have.property('cookieSecret');
336335
});
337336

@@ -381,7 +380,6 @@ describe('ConfigLoader', () => {
381380

382381
// Verify the loaded config has expected structure
383382
expect(config).to.be.an('object');
384-
expect(config).to.have.property('proxyUrl');
385383
expect(config).to.have.property('cookieSecret');
386384
});
387385

test/processors/checkAuthorEmails.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe('checkAuthorEmails', () => {
181181
exec({}, action);
182182
}),
183183
{
184-
numRuns: 100
184+
numRuns: 1000
185185
}
186186
);
187187

@@ -200,7 +200,7 @@ describe('checkAuthorEmails', () => {
200200
exec({}, action);
201201
}),
202202
{
203-
numRuns: 100
203+
numRuns: 1000
204204
}
205205
);
206206
expect(action.step.error).to.be.undefined;
@@ -215,7 +215,7 @@ describe('checkAuthorEmails', () => {
215215
exec({}, action);
216216
}),
217217
{
218-
numRuns: 100
218+
numRuns: 1000
219219
}
220220
);
221221

@@ -232,7 +232,7 @@ describe('checkAuthorEmails', () => {
232232
exec({}, action);
233233
}),
234234
{
235-
numRuns: 100
235+
numRuns: 1000
236236
}
237237
);
238238
expect(action.step.error).to.be.undefined;

test/processors/checkCommitMessages.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ describe('checkCommitMessages', () => {
164164
fc.integer(),
165165
fc.double(),
166166
fc.boolean(),
167-
fc.object(),
168167
),
169168
author: fc.string()
170169
}),
@@ -193,7 +192,8 @@ describe('checkCommitMessages', () => {
193192
[{ message: null, author: 'me' }],
194193
[{ message: {}, author: 'me' }],
195194
[{ message: 'SeCrEt', author: 'me' }]
196-
]
195+
],
196+
numRuns: 1000
197197
}
198198
);
199199
});

0 commit comments

Comments
 (0)