Repository navigation
fix(redaction): redact authorization tokens in response diagnostics - #372
ffumero2003 wants to merge 10 commits into
Conversation
Quality Keeper — Advisory ReviewSource:
Quality Keeper assessed the repository, executed checks, and collected results, covering 19 quality expectations. Five repository-quality areasHard expectations keep their exact Evidence State. Advisory applicability questions are separate. Implementation or suite presence is not proof of a trusted run.
Observability — 0 hard, 0 advisoryCan operators understand and diagnose repository-owned runtime behavior? Hard expectations None selected. Applicability Review Gaps (advisory) None. Product Analytics — 0 hard, 0 advisoryDoes repository-owned product analytics instrumentation behave safely and as declared? Hard expectations None selected. Applicability Review Gaps (advisory) None. User Feedback — 0 hard, 0 advisoryDo repository-owned feedback and support-intake flows behave safely and accessibly? Hard expectations None selected. Applicability Review Gaps (advisory) None. Reliability — 3 hard, 0 advisoryDoes repository-owned software fail, recover, time out, and report health predictably? Hard expectations
Applicability Review Gaps (advisory) None. Security — 4 hard, 0 advisoryDo static controls and repository-owned security behaviors protect the intended boundaries? Hard expectations
Applicability Review Gaps (advisory) None. Other registered quality — 12 hard, 0 advisoryRegistered Testing Types not assigned to one of the five focused areas. Hard expectations
Applicability Review Gaps (advisory) None. Result
CoveredQuality Keeper found acceptable evidence for one or more expectations in these Testing Types.
Needs attentionQuality Keeper does not yet have acceptable evidence for these Testing Types. Some have partial checks that need to run, be fixed, or be connected. Others need new proof or seeded tests. In both cases, Quality Keeper cannot count them as covered yet.
Quality Keeper changes no Evidence State. Pending, missing, executed-but-not-exercised, and review items are not passing, and seeded scaffolds are next actions, not evidence, until applied and re-evaluated. Full breakdown (19 expectations)
New to these terms? Start with the Quality Keeper Standards Wiki to learn what each testing type means, why it applies, and what counts as evidence. |
Context
Several credential-bearing responses already render safely in diagnostics (
B2Client,Bucket, the account-info stores, the Partner responses). Four native responses did not: the results ofB2Client.authorize()andRawClient.authorizeAccount(), download-authorization responses, upload-URL responses and upload-part-URL responses.JSON.stringify()and Node inspection printed theirauthorizationToken.Changes
src/response-redaction.ts: non-enumerabletoJSONand Node inspect hooks that show a placeholder forauthorizationToken; direct field access still returns the real token. Under Bun the response carries an inheritedtoJSONhook, so its prototype differs fromObject.prototype(documented).authorizeAccountResponseForPersistence,downloadAuthorizationResponseForPersistence,getUploadUrlResponseForPersistence,getUploadPartUrlResponseForPersistence), exported from the package root and from@backblaze-labs/b2-sdk/raw. A response rebuilt from diagnostic JSON is rejected with the newB2AuthorizationTokenRedactedError.B2Client.authorize()andInMemoryAccountInfo.setAuth()store a hook-free copy, so file-backed caches and custom account-info stores persist the real token.UploadUrlPool.checkin()and the part-URL store reject placeholder tokens.JSON.stringify()of these responses, with the persistence helpers as the migration.Verification
pnpm run verifyis green (lint, spelling, typechecks, sdkharness, build, docs, package-export probes, 87 test files, 2604 passed | 9 skipped).bun testrun is the real check.Decisions and known limits
client.accountInfo.getAuth()still returns the plain stored object, so printing it shows the token. This is unchanged from before and is out of scope here.FileAccountInfo.load()treats a cache file holding the placeholder like any invalid cache and starts empty (documented, behavior unchanged).Closes #371