T-11: audit-secrets skips any match containing ${, so a hardcoded user:pass with an interpolated host is missed
This commit is contained in:
parent
45d1099fd8
commit
7814f834fb
2 changed files with 47 additions and 2 deletions
|
|
@ -43,11 +43,13 @@ export function findEmbeddedHttpCredentials(content: string): number[] {
|
|||
for (let index = 0; index < lines.length; index++) {
|
||||
const line = lines[index] ?? '';
|
||||
for (const match of line.matchAll(httpCredentialPattern)) {
|
||||
const fullMatch = match[0] ?? '';
|
||||
const user = match[1] ?? '';
|
||||
const password = match[2] ?? '';
|
||||
const host = match[3] ?? '';
|
||||
const normalizedHost = host.replace(/\.$/, '');
|
||||
if (
|
||||
fullMatch.includes('${') ||
|
||||
user.includes('${') ||
|
||||
password.includes('${') ||
|
||||
!normalizedHost ||
|
||||
normalizedHost.startsWith('.') ||
|
||||
isPlaceholderHost(normalizedHost)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue