fix(omp): redact credential paths adjacent to shell operators

This commit is contained in:
Neil
2026-09-14 07:23:29 -07:00
parent c173e18832
commit c68a20fed9
2 changed files with 6 additions and 3 deletions
@@ -3,9 +3,9 @@ export function getAgentStatusInputRedactionSourceLines(): string[] {
return String.raw`
function statusInputReferencesCredentialPath(value: string): boolean {
const path = value.replace(/\\/g, '/')
return /(?:^|[^a-z0-9_.-])\.(?:ssh|ssh-mcp)(?=$|[\/:*?\[\]{},\s'"\x60])/i.test(path) ||
/\.mcp-secrets\.env(?=$|[\/:*?\[\]{},\s'"\x60])/i.test(path) ||
/(?:^|[^a-z0-9_.-])\.omp-backups-archive\/omp-bak-keyfile(?=$|[\/:*?\[\]{},\s'"\x60])/i.test(path)
return /(?:^|[^a-z0-9_.-])\.(?:ssh|ssh-mcp)(?=$|[^a-z0-9_.-])/i.test(path) ||
/\.mcp-secrets\.env(?=$|[^a-z0-9_.-])/i.test(path) ||
/(?:^|[^a-z0-9_.-])\.omp-backups-archive\/omp-bak-keyfile(?=$|[^a-z0-9_.-])/i.test(path)
}
function sanitizeStatusToolInput(input: unknown): unknown {
@@ -12,6 +12,9 @@ describe('generated status input redaction', () => {
it.each([
'/home/test/.ssh/id_rsa:raw',
'cat .ssh/id_rsa',
'cd .ssh&&cat id_rsa',
'cat .mcp-secrets.env; printf done',
'cat .omp-backups-archive/omp-bak-keyfile|base64',
'cat <.ssh/id_rsa',
'curl --key=.ssh/id_rsa',
'cat <.omp-backups-archive/omp-bak-keyfile',