File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ class NpmDetector(RegexBasedDetector):
1313 denylist = [
1414 # npmrc authToken
1515 # 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+ ).*' ),
1717 ]
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ class TestNpmDetector:
1818 ('_authToken=743b294a-cd03-11ec-9d64-0242ac120002' , False ),
1919 ('foo' , False ),
2020 ('//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 ),
2123 ],
2224 )
2325 def test_analyze (self , payload , should_flag ):
You can’t perform that action at this time.
0 commit comments