Skip to content

dlp: OpenAI project/service-account keys (sk-proj-, sk-svcacct-, sk-admin-) have no DLP rule #478

Done

Description

@bewfordq

Follows the bounty program in #454 (community detection/DLP rules with corpus fixtures).

The gap

apps/orchestrator/agentmetry/policies/dlp/manifest.yaml has no rule that
matches OpenAI's newer key formats: project keys (sk-proj-...),
service-account keys (sk-svcacct-...) and admin keys (sk-admin-...).

generic_provider_api_key is the rule whose description claims this territory
("OpenAI-shaped provider API keys"), but its pattern is
(?i)\\bsk-[a-zA-Z0-9]{20,}\\b: no hyphens allowed in the 20+ char run right
after sk-. proj, svcacct and admin are each only a few letters before
the next hyphen, so the rule never reaches the required run length and never
fires on any of these three formats. A legacy sk-<random> key (what the rule
was written for) still matches fine.

This is the same bug class the repo already fixed once for Anthropic: see the
anthropic_api_key rule's comment in manifest.yaml, and
core/audit/redaction.py's comment on _SECRET_PATTERNS: "Until 0.12.2
sk-[A-Za-z0-9]{20,} stopped at the second hyphen, which left OpenAI project
keys (sk-proj-) and Anthropic keys (sk-ant-) stored as typed." The
redaction scrubber was fixed for all four OpenAI/Anthropic prefixes
(sk-(?:ant|proj|svcacct|admin)-...) in 0.12.2, and anthropic_api_key got
its own DLP rule for the ant prefix — but no equivalent DLP rule exists for
proj/svcacct/admin, so a leaked OpenAI project or service-account key in
a tool argument currently produces no DLP finding at all.

Proposed fix

Add a dedicated DLP rule (openai_project_api_key or similar), category
credentials, severity critical, matching
sk-(?:proj|svcacct|admin)-[A-Za-z0-9_-]{20,} (mirrors the redaction.py
pattern, minus ant since that already has its own rule). Update
generic_provider_api_key's description to note the carve-out, same as it
already does for Anthropic and DashScope. Per CONTRIBUTING.md this is a
regex-only DLP pattern (policies/dlp/manifest.yaml), not a change to any
frozen detection file, with a fires-test and a does-not-fire test in
tests/test_dlp_scanner.py.

I'll open a PR for this.

Activity

  1. blitzcrieg1 commented on Nov 25, 2026

    @blitzcrieg1
    Owner

    Fixed by #483 (from #482, @bewfordq): new openai_project_api_key rule matches sk-proj-, sk-svcacct- and sk-admin- keys, with a near-miss test that must stay silent.

  2. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions