feat(worker): record severity in analysis mode and fix prompt substitutions (#413)

* feat(worker): record severity in analysis mode alongside confidence

* fix(worker): align add_finding severity with the exploit collector's four levels

* refactor(worker): drop the dead REPORT_VULN_HEADING substitution

No prompt in the tree uses the placeholder, so the replacement was a no-op
on every render.

* fix(worker): strip all whitespace from TOTP secrets, not just the ends

* fix(worker): render rule type and value in the agent prompt

* refactor(worker): drop the dead vuln-summary subsection substitution
This commit is contained in:
ezl-keygraph
2026-08-04 21:02:00 +05:30
committed by GitHub
parent d26f3b668e
commit 86effd5240
8 changed files with 76 additions and 86 deletions
+11 -5
View File
@@ -514,7 +514,7 @@ const validateRulesSecurity = (rules: Rule[] | undefined, ruleType: string): voi
ErrorCode.CONFIG_VALIDATION_FAILED,
);
}
if (pattern.test(rule.description)) {
if (rule.description !== undefined && pattern.test(rule.description)) {
throw new PentestError(
`rules.${ruleType}[${index}].description contains potentially dangerous pattern: ${pattern.source}`,
'config',
@@ -656,11 +656,15 @@ const checkForConflicts = (avoidRules: Rule[] = [], focusRules: Rule[] = []): vo
};
const sanitizeRule = (rule: Rule): Rule => {
return {
description: rule.description.trim(),
const sanitized: Rule = {
type: rule.type.toLowerCase().trim() as Rule['type'],
value: rule.value.trim(),
};
const description = rule.description?.trim();
if (description) {
sanitized.description = description;
}
return sanitized;
};
export const distributeConfig = (config: Config | null): DistributedConfig => {
@@ -702,13 +706,15 @@ const sanitizeAuthentication = (auth: Authentication): Authentication => {
credentials: {
username: auth.credentials.username.trim(),
...(auth.credentials.password && { password: auth.credentials.password }),
...(auth.credentials.totp_secret && { totp_secret: auth.credentials.totp_secret.trim() }),
...(auth.credentials.totp_secret && {
totp_secret: auth.credentials.totp_secret.replace(/\s/g, ''),
}),
...(auth.credentials.email_login && {
email_login: {
address: auth.credentials.email_login.address.trim(),
password: auth.credentials.email_login.password,
...(auth.credentials.email_login.totp_secret && {
totp_secret: auth.credentials.email_login.totp_secret.trim(),
totp_secret: auth.credentials.email_login.totp_secret.replace(/\s/g, ''),
}),
},
}),