fix: scrub 14 more Xray secret-detector false positives in deps#206
Merged
fix: scrub 14 more Xray secret-detector false positives in deps#206
Conversation
The customer's Xray scan against `cloud-drdroidlab:1.0.2` reported 25 "Plaintext API keys" / "Hardcoded secrets" violations under the `block-exposures-high-critical` rule. 14 of the 25 are addressable by extending the existing scrub block in this Dockerfile; the remaining 11 are genuine false positives in upstream code (public OAuth2 endpoint URLs, IETF/OASIS URNs, Kubernetes OpenAPI field-name maps, the Azure IMDS link-local IP) that require Xray ignore rules. Scrubs added (each addresses one or more flagged lines, no runtime impact since none are read by the runtime image): - `find /build/deps -path '*.dist-info/RECORD' -delete` → drops 5 violations (setuptools×3, datadog_api_client, awscli RECORD files flagged for SHA-256 hash content matching "plaintext API key" heuristics; RECORD is only used by `pip uninstall` / `pip show --files`). - `find /build/deps/kubernetes -type f \( -name '*_test.py' -o -name 'test_*.py' \) -delete` → drops 1 violation in `kubernetes/config/incluster_config_test.py:153`. Test fixtures with hardcoded sample tokens; the test files ship in the wheel but are never imported at runtime. - `sed 's/?token=ppEuaNXBW4//g' .../PyMySQL.../METADATA` → drops 1 violation. CodeCov badge URL token in the package's long description. - Extend `requests_oauthlib/oauth1_session.py` scrub: replace existing `EXAMPLE_TOKEN_*` / `EXAMPLE_SECRET` placeholders (plus the original raw RFC-5849 example tokens) with `<oauth_token>` / `<client_secret>` style angle-bracket placeholders that the new scanner does not flag. Drops 4 violations on lines 225, 240, 273. - `oauthlib/oauth1/rfc5849/parameters.py:31` → replace 4 RFC-5849 example values (`0685bd9184jfhq22`, `ad180jjd733klru7`, signature, nonce) with angle-bracket placeholders. Drops 1 violation. - `oauthlib/oauth2/rfc6749/request_validator.py:332` → replace `'askfjh234as9sd8'` and `'23sdf876234'` (RFC-6749 bearer-token example) with `'<access_token>'` / `'<refresh_token>'`. Drops 1 violation. - `google/auth/aio/credentials.py:92` → replace `StaticCredentials(token="token123")` docstring example with `token="<token-value>"`. Drops 1 violation. Verified in the rebuilt image: - 0 RECORD files under /code/deps - 0 test files under /code/deps/kubernetes - 0 EXAMPLE_* literals in requests_oauthlib (32 angle-bracket placeholders instead) - 0 occurrences of the CodeCov token in PyMySQL METADATA - All flagged docstring lines now show angle-bracket placeholders Trivy scan post-rebuild: 13 debian base HIGH (unchanged), 0 secrets, 0 python pkg vulns. No regressions. Predicted customer impact: 25 → 11 violations. The remaining 11 are all in the same false-positive class as the existing 7 documented in the local Xray triage notes; they break into 3 clusters (Google auth URLs+URN, Kubernetes OpenAPI field-name maps, three standalone — Azure IMDS endpoint, AWS EKS prefix, Django auth label). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sidPhoenix17
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The customer's Xray scan against
cloud-drdroidlab:1.0.2reported 25 "Plaintext API keys" / "Hardcoded secrets" violations under theblock-exposures-high-criticalrule. 14 of the 25 are addressable by extending the existing scrub block in this Dockerfile; the remaining 11 are genuine false positives in upstream code (public OAuth2 endpoint URLs, IETF/OASIS URNs, Kubernetes OpenAPI field-name maps, the Azure IMDS link-local IP) that require Xray ignore rules.Scrubs added (each addresses one or more flagged lines, no runtime impact since none are read by the runtime image):
find /build/deps -path '*.dist-info/RECORD' -delete→ drops 5 violations (setuptools×3, datadog_api_client, awscli RECORD files flagged for SHA-256 hash content matching "plaintext API key" heuristics; RECORD is only used bypip uninstall/pip show --files).find /build/deps/kubernetes -type f \( -name '*_test.py' -o -name 'test_*.py' \) -delete→ drops 1 violation inkubernetes/config/incluster_config_test.py:153. Test fixtures with hardcoded sample tokens; the test files ship in the wheel but are never imported at runtime.sed 's/?token=ppEuaNXBW4//g' .../PyMySQL.../METADATA→ drops 1 violation. CodeCov badge URL token in the package's long description.requests_oauthlib/oauth1_session.pyscrub: replace existingEXAMPLE_TOKEN_*/EXAMPLE_SECRETplaceholders (plus the original raw RFC-5849 example tokens) with<oauth_token>/<client_secret>style angle-bracket placeholders that the new scanner does not flag. Drops 4 violations on lines 225, 240, 273.oauthlib/oauth1/rfc5849/parameters.py:31→ replace 4 RFC-5849 example values (0685bd9184jfhq22,ad180jjd733klru7, signature, nonce) with angle-bracket placeholders. Drops 1 violation.oauthlib/oauth2/rfc6749/request_validator.py:332→ replace'askfjh234as9sd8'and'23sdf876234'(RFC-6749 bearer-token example) with'<access_token>'/'<refresh_token>'. Drops 1 violation.google/auth/aio/credentials.py:92→ replaceStaticCredentials(token="token123")docstring example withtoken="<token-value>". Drops 1 violation.Verified in the rebuilt image:
Trivy scan post-rebuild: 13 debian base HIGH (unchanged), 0 secrets, 0 python pkg vulns. No regressions.
Predicted customer impact: 25 → 11 violations. The remaining 11 are all in the same false-positive class as the existing 7 documented in the local Xray triage notes; they break into 3 clusters (Google auth URLs+URN, Kubernetes OpenAPI field-name maps, three standalone — Azure IMDS endpoint, AWS EKS prefix, Django auth label).