Skip to content

security: structural pattern bypasses in secret redaction (4 vectors) #446

@waynesun09

Description

@waynesun09

Summary

Both the Python sandbox hook (secret_redact_posttool.py) and Go-side SecretRedactor (redactor.go) share four pattern bypasses that allow secrets to pass through unredacted. The patterns appear identical between both implementations.

Affected files

  • internal/security/hooks/secret_redact_posttool.py:54-88
  • internal/security/redactor.go:160-177

Bypass vectors

1. Lowercase environment variable names

Pattern: [A-Z_]*(?:SECRET|TOKEN|...) (line 59 / line 165) — uppercase only

Bypass: export my_token=s3cr3t_value_here — lowercase my_token doesn't match [A-Z_]*

Fix: Add (?i) flag or use [A-Za-z_]* for env var name prefix

2. Single-quoted JSON values

Pattern: "...(secret)..." (line 68 / line 166) — double quotes only

Bypass: {'api_key': 'sk-proj-actual-secret-value'} — single quotes not matched

Fix: Add single-quote variant '...' alongside double-quote pattern

3. Multiple @ in database connection strings

Pattern: ([^@\s]{8,})@ (line 84) / ([^@]{4,})@ (line 169) — stops at first @

Bypass: postgres://user:P@ssw0rd@host:5432/db — regex captures P not P@ssw0rd because it stops at the first @

Fix: Use ([^@\s]{4,}?)@[^@]*$ or similar to match against the last @ as the delimiter

4. Mixed-case environment variable names

Same root cause as #1My_Secret_Key=value bypasses the [A-Z_]* prefix requirement.

Severity

Medium — each bypass is individually exploitable. Combined they represent a significant gap in structural secret detection. Exploitable when agent tool output contains secrets in any of these formats.

Source

Fuzzer testing against sandbox hooks and Go security pipeline.


Reported by: @JimFuller-RedHat (via fuzzer testing)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions