File tree 2 files changed +2
-1
lines changed
@commitlint/is-ignored/src
2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ test('should not throw error for custom ignore functions without security risks'
256
256
'function(commit) { return commit.length < 10 && commit.includes("some"); }' ,
257
257
'function(commit) { return commit.length < 10 || commit.includes("fetch"); }' ,
258
258
'function(commit) { return commit.includes("exec"); }' ,
259
+ 'function(commit) { return !process.env.CI && /^wip\b/.test(commit); }' ,
259
260
] ;
260
261
261
262
safePatterns . forEach ( ( fnString ) => {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export function validateIgnoreFunction(fn: Matcher) {
5
5
6
6
// Check for dangerous patterns
7
7
const dangerousPattern =
8
- / (?: p r o c e s s | r e q u i r e | i m p o r t | e v a l | f e t c h | X M L H t t p R e q u e s t | f s | c h i l d _ p r o c e s s ) (?: \s * \. | \s * \( ) | (?: e x e c | e x e c F i l e | s p a w n ) \s * \( / ;
8
+ / (?: p r o c e s s (? ! \. e n v ) | r e q u i r e | i m p o r t | e v a l | f e t c h | X M L H t t p R e q u e s t | f s | c h i l d _ p r o c e s s ) (?: \s * \. | \s * \( ) | (?: e x e c | e x e c F i l e | s p a w n ) \s * \( / ;
9
9
if ( dangerousPattern . test ( fnString ) ) {
10
10
// Find which pattern matched for a more specific error message
11
11
const match = fnString . match ( dangerousPattern ) ;
You can’t perform that action at this time.
0 commit comments