fix(contract): catch unlabeled provider tokens in the public boundary scan #7713
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.75) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #7713"
general
weight: 0.35
JasonBuildAI
Goal And Delivered Outcome
A repository-publication gate that reports a live-looking provider credential as public-safe can leak that credential to GitHub or CI artifacts; after this change
loopx check --scan-path— the scancanary premergeruns as a blocking check and the oneCONTRIBUTING.mdtells contributors to run before publishing — rejects unlabeled GitHub, Slack, npm, PyPI, Stripe, Google, AWS and JWT credential shapes instead of certifying them clean.main2f544f969; the parent owner split is tracked by #5136, and the sibling-module changes in #7635 / #7636 explicitly leftloopx/contract.pyuntouched.LEAK_RULES["credential"]inloopx/contract.pykept its own stale alternation, which only recognized credentials that carried atoken=/password=/Authorization:/Bearerlabel. Unlabeled provider tokens therefore passed. The canonical public-safety ownerloopx/public_safe_text.pyalready carriesPROVIDER_TOKEN_SHAPE_PATTERN_SOURCE, which #7636 made the capability scanner consume, but the publication gate still had a narrower private copy.ok: true, exit 0,public boundary scan cleanat base; at this head the same command reports onecredentialerror,ok: false, exit 1. See thereal_entrypointandregression_parityrows.loopx-project/loopxmainat682080047(rebased).Author Declaration
AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.
Implemented against
CONTRIBUTING.md(loopx check --scan-path docs/ --scan-path examples/) andloopx/public_safe_text.pyat2f544f969.| Criterion (spec clause) | Disposition | Symbol / path | Test or command |
| --- | --- | --- | --- |
| Unlabeled provider credentials are rejected by the publication scan | implemented |
LEAK_RULES["credential"]in [loopx/contract.py](loopx/contract.py) |pytest tests/test_contract_credential_pattern_precision.py; real CLI probe || The gate reuses the canonical provider-shape owner instead of a second copy (the #5136 direction) | implemented |
PROVIDER_TOKEN_SHAPE_PATTERN_SOURCEimport from [loopx/public_safe_text.py](loopx/public_safe_text.py) | owner-pin test || No regression for labelled credentials or credential references | implemented |
_credential_match_is_referencekeeps ENV, Basic-template and placeholder handling; unlabeled matches use only the exact AWS documented example exemption | precision suite (44 passed), including two literal-token regressions || No false positives for credential references or for repository material that keeps provider placeholders split | implemented | split literals in one example and one test; JSON
\u0061escapes in one fixture | whole-repositoryscan_public_boundary→ok: true, 0 hits, 87 reference hits || Every provider shape the rule reuses is also a prefilter candidate, so no issuer is silently skipped | implemented |
LEAK_RULES["credential"].required_literalsin [loopx/contract.py](loopx/contract.py) | 13 newtest_every_authoritative_leak_pattern_has_a_matching_prefiltercases |contributingworkflow; ran the real CLI at base and head with an isolated home/registry so local runtime state could not influence the result; ran the focused suite, ruff, the example smoke andcanary premerge. I deliberately did not widen thelocal_private_pathrule (208 pre-existing false positives across docs/examples) or add a placeholder heuristic; the repository already has a recorded convention of splitting provider-shaped literals, which keeps every test exercising the scan.Review Follow-up
dummyorexampleinside an opaque token body no longer downgrades a credential to a reference.loopx check --scan-pathregressions for two synthetic provider shapes: a GitHub PAT containingdummyand an npm token containingexample. Both now return exit 1 with acredentialerror.mainat682080047. The focused precision suite is44 passed; the adjacent contract/prefilter/chat batch is134 passed, 4 failed, with only the pre-existing Windows platform failures described above.05c8d665696c3e0f0139e8e4593c77b91392fc52, author and commit timestamps were preserved, and GitHub now reportsSign-off: success.Scope And Continuation
LEAK_RULESto import the whole rule set instead of only the provider shape, that belongs to #5136 rather than to this fix.Validation
e17c66ac36dbab273f46e600edebc051e61aaf45(three commits rebased onto682080047f4548d0266111f5e924512f550df9d9)| Check kind | Result | Public-safe evidence / limitation |
| --- | --- | --- |
|
static|passed|uvx --from "ruff>=0.12,<0.16" ruff check loopx/contract.py tests/test_contract_credential_pattern_precision.py tests/test_chat_activity.py examples/control_plane/goal-artifact-lifecycle-projection-smoke.py→ All checks passed. ||
unit|passed|pytest tests/test_contract_credential_pattern_precision.py→ 44 passed; includes 8 parametrized provider shapes, the canonical-owner pin, a short-lookalike negative case and two literal-token regressions. The combined precision/prefilter/chat run is134 passed, 4 failed; the four are the same Windows symlink/CRLF harness failures at base. ||
regression_parity|passed| With the new provider arm removed in place, the provider-shape, owner-pin and placeholder-body regressions fail; at this head the precision suite has 44 passing tests. This is a mutation-scoped check, so it fails for the reason the fix addresses. ||
real_entrypoint|passed| Base2f544f969:loopx check --scan-path <file with a synthetic GitHub PAT>→ok: true, exit 0,public boundary scan clean. Head: same command →ok: false, exit 1, onecredentialerror. Isolated home/registry; no real credential used. ||
integration|passed|loopx canary premerge --from-git-diff --git-diff-base upstream/mainat the tested revision →status: passed, 11/11 selected checks, public boundary 0 failures, merge gate passed. The exact rebased head was also exercised through the documented CLI and focused suite. Two catalog canaries initially failed on this Windows host only because npm dev dependencies were missing and the console codec was cp936; both reproduce identically on the untouched base and pass afternpm ci --ignore-scriptsplus UTF-8 mode. ||
manual|passed| Whole-repositoryscan_public_boundary→ok: true, zero unresolved hits; explicit credential references remain classified rather than deleted. ||
real_backend|not_applicable| No database, authority store or network backend is touched. |44 passed. The contract/prefilter/chat batch is134 passed, 4 failed; the failures are the same Windows symlink-privilege and CRLF line-number cases at base, and are unrelated to this rule. The lifecycle-projection example and chat caller still exercise the same scan. I did not run the TypeScript package suites because no TypeScript file is touched.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).