File tree 2 files changed +3
-1
lines changed
2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ class NpmDetector(RegexBasedDetector):
13
13
denylist = [
14
14
# npmrc authToken
15
15
# ref. https://stackoverflow.com/questions/53099434/using-auth-tokens-in-npmrc
16
- re .compile (r'\/\/.+\/:_authToken=\s*((npm_.+)|( [A-Fa-f0-9-]{36}) ).*' ),
16
+ re .compile (r'\/\/.+\/:_authToken=\s*(?!\$\{ [A-Z_]+\})((npm_.+)|\S+ ).*' ),
17
17
]
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ class TestNpmDetector:
18
18
('_authToken=743b294a-cd03-11ec-9d64-0242ac120002' , False ),
19
19
('foo' , False ),
20
20
('//registry.npmjs.org/:_authToken=${NPM_TOKEN}' , False ),
21
+ ('//gitlab.com/api/v4/projects/1347/packages/npm/:_authToken=glpat-a8r3xUFrtP-isd1DLK_r' , True ),
22
+ ('//gitlab.com/api/v4/projects/1347/packages/npm/:_authToken=${CI_JOB_TOKEN}' , False ),
21
23
],
22
24
)
23
25
def test_analyze (self , payload , should_flag ):
You can’t perform that action at this time.
0 commit comments