Fix: Security tokens are logged verbatim (DataBiosphere/azul-private#377)#8085
Conversation
a0386c9 to
2d953c7
Compare
2d953c7 to
84e32c9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8085 +/- ##
===========================================
- Coverage 84.72% 84.71% -0.01%
===========================================
Files 165 165
Lines 24254 24294 +40
===========================================
+ Hits 20548 20580 +32
- Misses 3706 3714 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
(Posted by Claude Code) Security Design Review: Secret Redaction in Logs (#377) ObjectivePrevent APATs (JWTs), OAuth 2.0 access tokens, refresh tokens, and authorization codes from appearing unredacted in CloudWatch and GitLab CI logs. Threat ModelSecrets logged verbatim can be exfiltrated by anyone with read access to CloudWatch log groups or GitLab CI job logs, enabling token replay attacks. Changes Reviewed13 files changed across the branch (14 commits, excluding CI-only changes). Findings1. Redaction coverage — ADEQUATE All identified log emission sites are now covered:
2. Regex pattern specificity — ACCEPTABLE with caveats
3. Fallback in When 4. Used at sites where the string is known to be an isolated token (header values, 5. OpenSearch OpenSearch request/response bodies don't contain user secrets (they contain index data). Skipping redaction avoids a performance penalty on potentially large bodies. This is a conscious, documented trade-off. 6.
7. No secret leakage in assertion messages — VERIFIED
Residual Risks
VerdictThe changes are sound. The defense-in-depth approach (regex-based scanning at log sites + |
I decided to not redact signed URLs for now. Post-poned to https://github.com/DataBiosphere/azul-private/issues/390 |
Security design review
|
|
Clearing the approved queue in preparation for the higher-priority #7794. |
30e003b to
c07155b
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vate#377) Add FIXME comments to all log statements identified as logging unredacted APATs, OAuth access/refresh tokens, authorization codes, and URL signatures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…azul-private#377) Add __str__ to Authentication hierarchy: str() produces a redacted representation safe for logging, while repr() remains unredacted. Replace .redacted() calls with %s formatting and update the test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the ad-hoc prefix checks with a compiled regex. Captured groups are redacted while the rest of the match is preserved. The default mode scans for secrets anywhere in the string; fullmatch=True requires the entire string to be a secret. The regex accepts an optional case-insensitive 'Bearer ' prefix, simplifying _LoggingConnectionPool._redact. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…re/azul-private#377) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vate#377) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> fixup! Redact secrets in HTTP body log messages (DataBiosphere/azul-private#377)
…te#377) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…azul-private#377) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ivate#377) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ul-private#377) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-private#377) Extract _redact_header and _redact_headers functions to apply regex-based redaction to all HTTP headers, with a fail-closed fallback for unrecognized authorization header formats. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c07155b to
a5572b9
Compare
dsotirho-ucsc
left a comment
There was a problem hiding this comment.
Pro forma approval
Linked issues: DataBiosphere/azul-private#377
Checklist
Author
developissues/<GitHub handle of author>/<issue#>-<slug>1 when the issue title describes a problem, the corresponding PR
title is
Fix:followed by the issue titleAuthor (partiality)
ptag to titles of partial commitspartialor completely resolves all linked issuespartiallabelAuthor (reindex)
rtag to commit title or the changes introduced by this PR will not require reindexing of any deploymentreindex:devor the changes introduced by it will not require reindexing ofdevreindex:anvildevor the changes introduced by it will not require reindexing ofanvildevreindex:anvilprodor the changes introduced by it will not require reindexing ofanvilprodreindex:prodor the changes introduced by it will not require reindexing ofprodreindex:partialand its description documents the specific reindexing procedure fordev,anvildev,anvilprodandprodor requires a full reindex or carries none of the labelsreindex:dev,reindex:anvildev,reindex:anvilprodandreindex:prodAuthor (mirror)
mirror:devor the changes introduced by it will not require mirroring ofdevmirror:anvildevor the changes introduced by it will not require mirroring ofanvildevmirror:anvilprodor the changes introduced by it will not require mirroring ofanvilprodmirror:prodor the changes introduced by it will not require mirroring ofprodmirror:partialand its description documents the specific mirroring procedure fordev,anvildev,anvilprodandprodor requires a full mirroring or carries none of the labelsmirror:dev,mirror:anvildev,mirror:anvilprodandmirror:prodAuthor (API changes)
APIor this PR does not modify a REST APIa(A) tag to commit title for backwards (in)compatible changes or this PR does not modify a REST APIapp.pyor this PR does not modify a REST APIAuthor (upgrading deployments)
make docker_images.jsonand committed the resulting changes or this PR does not modifyazul_docker_images, or any other variables referenced in the definition of that variableutag to commit title or this PR does not require upgrading deploymentsupgradeor does not require upgrading deploymentsdeploy:sharedor does not modifydocker_images.json, and does not require deploying thesharedcomponent for any other reasondeploy:gitlabor does not require deploying thegitlabcomponentdeploy:runneror does not require deploying therunnerimageAuthor (hotfixes)
Ftag to main commit title or this PR does not include permanent fix for a temporary hotfixanvilprodandprod) have temporary hotfixes for any of the issues linked to this PRAuthor (before every review)
develop, squashed fixups from prior reviewsmake requirements_updateor this PR does not modifyDockerfile,environment,requirements*.txt,common.mk,Makefileorenvironment.bootRtag to commit title or this PR does not modifyrequirements*.txtreqsor does not modifyrequirements*.txtmake integration_testpasses in personal deployment or this PR does not modify functionality that could affect the IT outcomePeer reviewer (after approval)
Note that after requesting changes, the PR must be assigned to only the author.
System administrator (after approval)
demoorno demono demono sandboxN reviewslabel is accurateOperator
reindex:…labels andrcommit title tagmirror:…labelsno demodevelopOperator (deploy
.sharedand.gitlabcomponents)_select dev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unusedor this PR is not labeleddeploy:shared_select dev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab applyor this PR is not labeleddeploy:gitlab_select anvildev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unusedor this PR is not labeleddeploy:shared_select anvildev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab applyor this PR is not labeleddeploy:gitlabdeploy:gitlabdeploy:gitlabSystem administrator (post-deploy of
.gitlabcomponent)dev.gitlabare complete or this PR is not labeleddeploy:gitlabanvildev.gitlabare complete or this PR is not labeleddeploy:gitlabOperator (deploy runner image)
_select dev.gitlab && make -C terraform/gitlab/runneror this PR is not labeleddeploy:runner_select anvildev.gitlab && make -C terraform/gitlab/runneror this PR is not labeleddeploy:runnerOperator (sandbox build)
sandboxlabel or PR is labeledno sandboxdevor PR is labeledno sandboxanvildevor PR is labeledno sandboxsandboxdeployment or PR is labeledno sandboxanvilboxdeployment or PR is labeledno sandboxsandboxdeployment or PR is labeledno sandboxanvilboxdeployment or PR is labeledno sandboxsandboxor this PR is not labeledupgrade, or upgrade instructions do not apply tosandboxanvilboxor this PR is not labeledupgrade, or upgrade instructions do not apply toanvilboxsandboxor this PR does not remove catalogs or otherwise causes unreferenced indices insandboxanvilboxor this PR does not remove catalogs or otherwise causes unreferenced indices inanvilboxsandboxor this PR is not labeledreindex:devanvilboxor this PR is not labeledreindex:anvildevsandboxor this PR is not labeledreindex:devanvilboxor this PR is not labeledreindex:anvildevsandboxor this PR is not labeledmirror:devanvilboxor this PR is not labeledmirror:anvildevsandboxor this PR is not labeledmirror:devanvilboxor this PR is not labeledmirror:anvildevOperator (merge the branch)
pif the PR is also labeledpartialOperator (main build)
devanvildevdevdevanvildevanvildevdevor this PR is not labeledupgrade, or upgrade instructions do not apply todevanvildevor this PR is not labeledupgrade, or upgrade instructions do not apply toanvildevupgrade, or upgrade instructions do not apply to personal deployments_select dev.shared && make -C terraform/shared applyor this PR is not labeleddeploy:shared_select anvildev.shared && make -C terraform/shared applyor this PR is not labeleddeploy:shareddevanvildevOperator (reindex)
devor this PR is neither labeledreindex:partialnorreindex:devanvildevor this PR is neither labeledreindex:partialnorreindex:anvildevdevor this PR is neither labeledreindex:partialnorreindex:devanvildevor this PR is neither labeledreindex:partialnorreindex:anvildevdevor this PR is neither labeledreindex:partialnorreindex:devanvildevor this PR is neither labeledreindex:partialnorreindex:anvildevdevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdevor this PR does not require reindexingdevdevor this PR does not require reindexingdevdeploy_browserjob in the GitLab pipeline for this PR indevor this PR does not require reindexingdevanvildevor this PR does not require reindexinganvildevdeploy_browserjob in the GitLab pipeline for this PR inanvildevor this PR does not require reindexinganvildevOperator (mirroring)
devor this PR is not labelledmirror:devanvildevor this PR is not labelledmirror:anvildevdevor this PR is not labelledmirror:devanvildevor this PR is not labelledmirror:anvildevdevor this PR is not labelledmirror:devanvildevor this PR is not labelledmirror:anvildevOperator
upgradeandAPIlabels to the next promotion PRs or this PR carries neither of these labelsdeploy:shared,deploy:gitlab,deploy:runner,reindex:partial,reindex:anvilprod,reindex:prod,mirror:partial,mirror:anvilprodandmirror:prodlabels to the next promotion PRs or this PR carries none of these labelsdeploy:shared,deploy:gitlab,deploy:runner,reindex:partial,reindex:anvilprod,reindex:prod,mirror:partial,mirror:anvilprodandmirror:prodlabels, from the description of this PR to that of the next promotion PRs or this PR carries none of these labelsShorthand for review comments
Lline is too longWline wrapping is wrongQbad quotesFother formatting problem