fix: redact remaining SDK-owned credential containers in formatted output

Aperta
#287 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ffumero2003 ci sta già lavorando.

Dal 3/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

Context

blazer redacts secrets in formatted output for exactly one credential type: SSECKey implements String(), GoString(), and Format() (b2/ssec.go:76-80), test-pinned across every format verb. The other SDK-owned credential containers print their secrets verbatim under %v, %+v, %#v, and %x:

  • base.Key.Secret
  • base.AuthData.AuthToken (and the same material held via b2.AuthData / InMemoryAccountInfo, b2/accountinfo.go:43)
  • base.B2
  • WebhookNotificationTarget.HMACSHA256SigningSecret

A developer or an automated agent printing one of these structs while debugging (for example log.Printf("%+v", client)) leaks the application key, session token, or signing secret into logs or an LLM context window. This is the Go sibling of the formatted-output credential leaks already tracked on the TypeScript and Java SDKs (backblaze-labs/demand-side-ai#1278, backblaze-labs/demand-side-ai#1279).

Evidence

A synthetic probe printed each container with %v, %+v, %#v, and %x; all four disclosed the secret for the containers listed above. SSECKey and the high-level b2.Key did not disclose under the same probe.

Acceptance criteria

  • R1. Every SDK-owned credential container redacts its secret under %v, %+v, %#v, %x, and GoString(), following the existing SSE-C pattern: String/GoString/Format plus holding the secret in an unexported field so embedded-field formatting stays protected.
  • R2. The SSE-C redaction test matrix (all format verbs plus embedded-field cases) is extended to cover every credential container.
  • R3. Upload-token holders base.URL and FileChunk are checked and redacted if they expose token material.
  • R4. Any change to a public string field (for example base.Key.Secret, AuthData.AuthToken) ships with a compatibility note and a Changed changelog entry.

In scope

  • Formatted-output redaction for the SDK-owned credential containers listed in Context, their formatting/embedded-field tests, and the required compatibility documentation.

Out of scope

  • Explicit secret access through Key.Secret() and raw key inputs supplied by the caller — those are intended access, not accidental formatting exposure.
  • Error-wrapping metadata loss — tracked in a separate issue.

Verification

Run the repository regression checks with live credentials unset:

unset B2_APPLICATION_KEY_ID B2_APPLICATION_KEY B2_ACCOUNT_ID B2_ACCOUNT_KEY
go build ./...
go vet ./...
go test -race -count=1 ./base ./b2/...
  • Use synthetic secrets only. Exercise all specified format verbs and embedded-field cases for every listed credential container, including upload-token holders when applicable.
  • Demonstrate the leakage before the change, red under a deliberate redaction break, and green after restoration; check the required public-field compatibility note and Changed fragment.
  • Expected result: the checks above succeed and the observable outcomes in Acceptance criteria are demonstrated. If a check cannot run, report Could not run because: ...; if it starts but fails, report Could not complete because: .... A skipped check is not a pass.

Links

  • Pattern to follow: b2/ssec.go:76-80
  • Sibling leaks: backblaze-labs/demand-side-ai#1278 (TypeScript), backblaze-labs/demand-side-ai#1279 (Java)
Lingua principale
Go
Stelle
66
Fork
18
Merge medio
1g 10h
PR unite (30g)
132

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Backblaze/blazer

Tutte le issue di Backblaze/blazer

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.