Skip to content

dlp: EgressSecretCheck and RedactReadPlan both leave DLP coverage gaps that let secrets through #103

Open

Description

@codeyevsky

Problem

Two related gaps in packages/guard/dlp/redact.go let secrets reach egress unredacted.

  1. EgressSecretCheck (redact.go:67) parses the destination with url.Parse and only applies its host/scheme allowlist logic when a scheme is present. A scheme-less destination such as example.com/webhook or a bare IP is not recognized as a URL, so the function silently skips the egress check instead of treating it as untrusted.
  2. RedactReadPlan (redact.go:224) only redacts the first matching key when a plan contains multiple locations for the same secret pattern. Any subsequent occurrence of the same secret elsewhere in the payload is left intact.

Impact

A scheme-less destination bypasses secret-egress blocking entirely, and even when a destination is checked, a payload with the same secret duplicated in two fields will leak the second copy. Both are silent, security-relevant bypasses of the DLP path.

Repro

  1. Call EgressSecretCheck with a destination string like internal-collector.example.com/ingest (no http:// prefix). Observe it returns no match even though the same host with a scheme would be flagged.
  2. Build a read plan whose body contains the same API key in two different JSON fields and pass it to RedactReadPlan. Observe only the first field is redacted in the output.

Suggested fix

In EgressSecretCheck, normalize the destination before parsing: if url.Parse yields an empty Host, retry with a // prefix prepended (or use net/url's opaque-handling pattern) so bare host:port and host/path forms resolve to a host the same way a scheme-qualified URL would. In RedactReadPlan, change the redaction loop from stopping at the first match to iterating all matches for each pattern/key pair, redacting every occurrence found in the plan.

Activity

  1. sharmis-tp commented on Nov 18, 2026

    @sharmis-tp

    I'll audit both EgressSecretCheck and RedactReadPlan to identify and close the coverage gaps. I'll add a comprehensive test suite with known secret patterns in various encodings (plain, base64, hex) and verify that both paths catch all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions