File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' dotenv-diff ' : patch
3+ ---
4+
5+ removed warning on detecting http URLs
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export const PROVIDER_PATTERNS: RegExp[] = [
4141const LONG_LITERAL = / [ " ' ` ] { 1 } ( [ A - Z a - z 0 - 9 + / _ \- ] { 24 , } ) [ " ' ` ] { 1 } / g;
4242
4343// Regex for detecting HTTPS URLs
44- const HTTPS_PATTERN = / [ " ' ` ] ( h t t p s ? : \/ \/ (? ! l o c a l h o s t ) [ ^ " ' ` ] * ) [ " ' ` ] / g;
44+ const HTTPS_PATTERN = / [ " ' ` ] ( h t t p s : \/ \/ (? ! l o c a l h o s t ) [ ^ " ' ` ] * ) [ " ' ` ] / g;
4545
4646// List of harmless URL patterns to ignore
4747const HARMLESS_URLS = [
@@ -296,15 +296,15 @@ export function detectSecretsInSource(
296296 const url = httpsMatch [ 1 ] ;
297297 if ( url && ! looksHarmlessLiteral ( url ) ) {
298298 if ( ignoreUrlsMatch ( url , opts ?. ignoreUrls ) ) continue ;
299- const protocol = url . startsWith ( 'https' ) ? 'HTTPS' : 'HTTP' ;
300299
301300 findings . push ( {
302301 file,
303302 line : lineNo ,
304303 kind : 'pattern' ,
305- message : `${ protocol } URL detected – consider moving to an environment variable` ,
304+ message :
305+ 'HTTPS URL detected – consider moving to an environment variable' ,
306306 snippet : line . trim ( ) . slice ( 0 , 180 ) ,
307- severity : protocol === 'HTTP' ? 'medium' : 'low' ,
307+ severity : 'low' ,
308308 } ) ;
309309 }
310310 }
Original file line number Diff line number Diff line change @@ -351,13 +351,11 @@ const token = "AKIAIOSFODNN7EXAMPLE";
351351 expect ( findings [ 0 ] . message ) . toContain ( 'HTTPS URL detected' ) ;
352352 } ) ;
353353
354- it ( 'should detect HTTP URLs as medium severity' , ( ) => {
354+ it ( 'should not detect HTTP URLs as medium severity' , ( ) => {
355355 const source = 'const apiUrl = "http://api.realservice.com/endpoint";' ;
356356 const findings = detectSecretsInSource ( 'test.ts' , source ) ;
357357
358- expect ( findings ) . toHaveLength ( 1 ) ;
359- expect ( findings [ 0 ] . severity ) . toBe ( 'medium' ) ;
360- expect ( findings [ 0 ] . message ) . toContain ( 'HTTP URL detected' ) ;
358+ expect ( findings ) . toHaveLength ( 0 ) ;
361359 } ) ;
362360
363361 it ( 'should ignore URLs from ignoreUrls config' , ( ) => {
You can’t perform that action at this time.
0 commit comments