mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 16:02:03 +00:00
fix(omp): redact credential paths adjacent to shell operators
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user