Skip to content

[Bug]: the builtin public-safe-outbound scan certifies GitHub, AWS, Slack, Google, npm, PyPI and Stripe credentials as public-safe #7635

Closed

Description

@JasonBuildAI

Impact / 影响

The builtin public-safe-outbound capability is the shipped, default-enabled gate for checking candidate content before it leaves the repository (loopx capability show public-safe-outbound; its documented entry point is python -m loopx.capabilities.public_safe_outbound.scan_cli --scan-root <repo> | --diff). Its credential rule table only recognized an Ark key, an sk-/Bearer value, an AKLT value, a private-key block and a quoted api_key= assignment.

Every other real provider credential therefore returned {"ok": true, "hit_count": 0, "unscanned_count": 0} and exit 0 — a positive certification that content is public-safe. A caller who trusts that receipt can publish a live credential. This is deterministic for each listed shape, not a sampling edge, and the receipt carries no warning.

The gate is invoked by the operator rather than wired into CI, so the harm lands on whoever runs it and trusts the receipt, not on every PR automatically. The failure is still deterministic, and the receipt still certifies clean with exit 0.

Reproduction

On upstream/main 652f503842609e948e8ff832ae3977f23f79f28d, write one file per shape and run the documented command:

python -m loopx.capabilities.public_safe_outbound.scan_cli --scan-root <dir> --format text
shape value written into the candidate before after
GitHub classic PAT ghp_… (36 chars) PASS: public-safe, exit 0 [provider_token] …, exit 1
GitHub fine-grained PAT github_pat_11ABCDEFG0… PASS, exit 0 hit, exit 1
AWS access key id AKIA7Q2Z3XJ5V6N8W1PL PASS, exit 0 hit, exit 1
AWS session key id ASIA7Q2Z3XJ5V6N8W1PL PASS, exit 0 hit, exit 1
Slack bot token xoxb-… PASS, exit 0 hit, exit 1
Google API key AIzaSyA… PASS, exit 0 hit, exit 1
Stripe live key sk_live_51H8… PASS, exit 0 hit, exit 1
npm token npm_… PASS, exit 0 hit, exit 1
PyPI token pypi-… PASS, exit 0 hit, exit 1

Three of these are the credentials .env, ~/.npmrc and ~/.aws/credentials actually hold, and .env is exactly the extension-less, credential-named file the scan's own deny-list selection promises to review.

Why this is high importance

  • Affected surface: a builtin, default-enabled capability whose entire purpose is fail-closed certification before publication, and which CONTRIBUTING.md names as a pre-submission step.
  • Who pays: any contributor or agent who runs the documented scan before sending docs or examples. The receipt says clean; the leaked credential is discovered by the provider's secret scanner or a third party.
  • Severity: credential disclosure is irreversible once pushed — the token is live until rotated. This is the failure class the capability was built to prevent, and it fails open silently with exit 0.
  • Not an edge case: the missing shapes are the eight most common provider prefixes, not a rare spelling.

Root cause

loopx/capabilities/public_safe_outbound/scanner.py kept its own small rule table. The canonical private-text owner loopx/public_safe_text.py already carries SECRET_LIKE_SURFACE_PATTERN with all nine shapes, so the two owners disagreed: the shared owner recognizes them, the outbound gate — the one that actually certifies published content — did not. This is the same drift class recorded in #5136.

Fix

Add a provider_token rule to the scanner that consumes the canonical owner's shape list instead of restating a subset. Extract that alternation into PROVIDER_TOKEN_SHAPE_PATTERN_SOURCE so one definition serves both owners. The extracted text is byte-identical to the inline block it replaces: a differential run over the 2,048,885 lines of the 6,558 strict-UTF-8-decodable tracked files, plus adversarial samples, found zero verdict differences, so existing SECRET_LIKE_SURFACE_PATTERN consumers keep their behavior.

Boundary

This issue's completed scope is the outbound scanner's credential rule table and its focused tests. It does not change the scan's selection, decoding, receipt shape or exit-code contract; label-free short values and BOM-less legacy encodings keep their existing behavior.

Two adjacent gaps are observed here but deliberately not part of this issue's fix, and remain open work:

  1. loopx check --scan-path (LEAK_RULES in loopx/contract.py) still misses seven of these nine shapes. Reusing the shared pattern there is a policy decision, not a mechanical one: SECRET_LIKE_SURFACE_PATTERN matches 566 lines across those 6,558 files and those are overwhelmingly legitimate source, so it needs its own false-positive review before it can gate the contract scan.
  2. The canonical owner's AWS and Slack prefix sets are narrower than the issuer families (ABIA, ACCA, AGOA, AROA, … and xapp- are not covered). Those prefixes feed six surfaces that consume SECRET_LIKE_SURFACE_PATTERN, so widening them needs its own parity review.

Activity

  1. added 2 commits that reference this issue on Oct 29, 2026
    4afca07
    36b9b97
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions