Skip to content

Commit 617ef71

Browse files
feat: fix auth-issue-database detection functions to accept request objects
Modified detection functions in auth-issue-database.js to properly handle request objects instead of raw code/headers/query strings. All detection functions now: - Accept full request object as parameter - Build searchable string from url, requestBody, and headers - Handle missing/null request properties safely - Perform case-insensitive header matching Also added 'isDebugModeEnabled' to delegated actions in message-router.js for
1 parent 6aacac2 commit 617ef71

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

modules/auth/auth-issue-database.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,27 +420,42 @@ class AuthIssueDatabase {
420420
pattern: /md5|sha1|base64.*password/i,
421421
issue: "Using weak/custom cryptography",
422422
severity: "CRITICAL",
423-
detection: (code) => {
424-
return code.includes('md5(password)') ||
425-
code.includes('base64(password)') ||
426-
code.includes('custom_encrypt');
423+
detection: (request) => {
424+
// Build searchable string from request data
425+
const searchStr = [
426+
request?.url || '',
427+
request?.requestBody || '',
428+
typeof request?.headers === 'object' ? JSON.stringify(request.headers) : ''
429+
].join(' ');
430+
return searchStr.includes('md5(password)') ||
431+
searchStr.includes('base64(password)') ||
432+
searchStr.includes('custom_encrypt');
427433
}
428434
},
429435
obscurity: {
430436
pattern: /X-Secret-Header|magic_token/,
431437
issue: "Relying on obscure headers/parameters",
432438
severity: "HIGH",
433-
detection: (headers) => {
439+
detection: (request) => {
440+
const headers = request?.headers || {};
441+
if (typeof headers !== 'object') return false;
434442
const suspicious = ['X-Secret', 'X-Magic', 'X-Special-Auth'];
435-
return suspicious.some(h => headers[h]);
443+
const headerKeys = Object.keys(headers).map(k => k.toLowerCase());
444+
return suspicious.some(h => headerKeys.some(key => key.includes(h.toLowerCase())));
436445
}
437446
},
438447
sqlInAuth: {
439448
pattern: /SELECT.*FROM.*users.*WHERE.*password/i,
440449
issue: "Plaintext password comparison in SQL",
441450
severity: "CRITICAL",
442-
detection: (query) => {
443-
return query.includes('password = ') && !query.includes('hash');
451+
detection: (request) => {
452+
// Build searchable string from request data
453+
const searchStr = [
454+
request?.url || '',
455+
request?.requestBody || '',
456+
typeof request?.headers === 'object' ? JSON.stringify(request.headers) : ''
457+
].join(' ');
458+
return searchStr.includes('password = ') && !searchStr.includes('hash');
444459
}
445460
}
446461
}

modules/message-router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export class MessageRouter {
152152
const delegatedActions = [
153153
'enableDebugMode',
154154
'disableDebugMode',
155+
'isDebugModeEnabled',
155156
'getDebugSession',
156157
'exportDebugSession',
157158
'clearDebugSession',

0 commit comments

Comments
 (0)