Skip to content

fix(sanitizer): redact whole Azure AccountKey and SAS sig values (TSK-011) - #110

Merged
jmlweb merged 1 commit into
mainfrom
hustle/maintainer/task-2026-11-25
Nov 25, 2026
Merged

jmlweb merged 1 commit into
mainfrom
hustle/maintainer/task-2026-11-25

Conversation

@jmlweb

@jmlweb jmlweb commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Problem (TSK-011, from RPT-011)

Azure Storage secrets were only partly redacted:

  • Connection string: AccountKey=<key> came out as AccountKey=[REDACTED_ID]/K1SZFPTOtr/KBHBeksoGMGw==. AccountKey was not a secret-assignment name, so only the opaque-id rule ran. That rule cannot start after = and stops at the first / or +.
  • SAS URL: sig=AbCdEf%2B…%3D came out as sig=AbCdEf%[REDACTED_ID]%3D.

What changed

  • src/core/sanitizer.ts
    • Added account[_-]?key to the secret-assignment names (otherName). The existing unquoted-value rule now takes the whole key, including /, + and ==, up to ;, &, ,, ), a quote or whitespace. Result: AccountKey=[REDACTED_SECRET];BlobEndpoint=….
    • Added a dedicated rule ([?&]sig=)… that redacts the SAS signature up to &, #, whitespace, a quote, ,, ; or ). URL-encoded characters such as %2B and %3D are included. Result: &sig=[REDACTED_SECRET]&spr=https.
    • sig has its own rule anchored on ?/& and is not in otherName: there, the [A-Za-z0-9_-]* affixes would match design= and signature=.
  • src/core/sanitizer.test.ts: new Azure Storage credentials block with 6 tests.
  • docs/SPECS.md: the redaction list now mentions AccountKey= and the SAS sig.
  • .backlog: TSK-011 moved to complete with evidence. Added learning LRN-009.

Acceptance criteria and evidence

  1. sanitize() replaces the whole AccountKey value in an Azure Storage connection string, including base64 keys containing / or + and trailing ==
    • Tests redacts the whole AccountKey of an Azurite connection string and redacts an AccountKey containing + and quoted in a command pass.
    • Both failed before the fix.
    • They assert AccountKey=[REDACTED_SECRET];… and that no fragment of the key (Eby8vd, K1SZFPTOtr, KBHBeksoGMGw, ==, ab+CD, …) remains.
  2. sanitize() replaces the whole sig value of an Azure SAS URL, including URL-encoded characters such as %2B and %3D
    • Tests redacts the whole URL-encoded sig of a SAS URL and redacts a sig that ends the URL pass.
    • Both failed before the fix.
    • They assert &sig=[REDACTED_SECRET]&spr=https, no %2B/%3D left, and the other SAS parameters (sv, ss) kept.
  3. Regression tests in src/core/sanitizer.test.ts cover the Azurite connection string and a SAS URL
    • The Azure Storage credentials block covers both.
    • It also has two guard tests: keeps punctuation that closes a SAS URL in prose and leaves words that merely contain sig alone (design=flat config=signature=on is unchanged).
    • The Azurite key is the public development key. The test splits it into parts so secret scanning does not flag it.
  4. pnpm check && pnpm test && pnpm build pass
    • pnpm check exited 0.
    • pnpm test: 26 files, 495/495 tests passed.
    • pnpm build exited 0.
    • All three ran locally on Node 22.

Verification

Test first: the 4 redaction tests failed on main (Tests 4 failed | 158 passed in sanitizer.test.ts). They pass after the change, and the full check, test and build gates pass as listed above.

🤖 Generated with Claude Code

…-011)

AccountKey was not a secret-assignment name, so only the first alphanumeric
run of a base64 storage key was caught by the opaque-id rule and the rest
(after / or +, plus the trailing ==) leaked. Add account[_-]?key to the
secret-assignment names, and redact the sig query parameter of Azure SAS
URLs, including URL-encoded characters such as %2B and %3D.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jmlweb

jmlweb commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

🤖 hustle review: approve — Sanitizer change redacts whole AccountKey and SAS sig values as claimed, with a narrowly anchored sig rule, regression and guard tests, and updated docs and backlog. Only cosmetic backlog nits remain.

@jmlweb
jmlweb merged commit 8de7567 into main Nov 25, 2026
8 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 25, 2026
## [4.1.8](v4.1.7...v4.1.8) (2026-11-25)

### Bug Fixes

* **sanitizer:** redact whole Azure AccountKey and SAS sig values (TSK-011) ([#110](#110)) ([8de7567](8de7567))

### Chores

* **backlog:** file and triage ya29 and dckr_pat/GitLab token redaction gaps ([#107](#107)) ([70f8b71](70f8b71))
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.1.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant