Skip to content

fix(api)!: stop copying the basic password into Basic-Secret - #69

Merged
josuegiron merged 1 commit into
masterfrom
fix/drop-basic-secret-header
Nov 21, 2026
Merged

josuegiron merged 1 commit into
masterfrom
fix/drop-basic-secret-header

Conversation

@josuegiron

@josuegiron josuegiron commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Reason

After a successful check, api.BasicToken copied the plain password into the Basic-Secret request header. Anything downstream that forwards, dumps or logs request headers could leak it (SEC-02, part 3). The owner decided on 2026-11-21 to remove it in v1.0.0, on the default instance and on api.New instances, as a breaking change.

Scope

Changes

  • middlewares.go: drop r.Header.Set("Basic-Secret", secret), add r.Header.Del("Basic-Secret"), and update the doc comment.
  • security_test.go: three tests, each run on the default instance and on an instance:
    • the password is not copied;
    • a client-sent Basic-Secret is removed;
    • Basic-Client is still set.
  • README.md: security note.
  • docs/migration-v1.md:
    • a Summary bullet;
    • a "Breaking: no Basic-Secret header" section in Step 1;
    • a checklist item.

Release notes

Breaking change: api.BasicToken no longer copies the plain password into the Basic-Secret request header. It also removes a Basic-Secret header the client sent. This applies to the default instance and to api.New instances. Basic-Client is still set. Handlers that read Basic-Secret must take the password from their own credential source, for example r.BasicAuth() or their secret store.

Verification

  • TestBasicTokenDoesNotCopyThePasswordIntoBasicSecret and TestBasicTokenRemovesAClientSentBasicSecret fail on the old middlewares.go and pass after the change.
  • gofmt -l . prints nothing; go vet ./... ok; go test -race ./... ok (all packages); govulncheck ./...: no vulnerabilities found.
  • Reviewed with the BMad quick review lens. Three findings were fixed: the guide summary, the guide placement, and one behavior per test. Two were not defects.

🤖 Generated with Claude Code

BasicToken copied the plain password into the Basic-Secret request
header, where anything that forwards, dumps or logs request headers
could leak it. It no longer sets the header, and it removes one the
client sent, so a handler never reads a client-chosen value there.
Basic-Client is still set. This applies to the default instance and to
api.New instances.

BREAKING CHANGE: BasicToken no longer sets the Basic-Secret request
header. Handlers that read Basic-Secret must take the password from
their own credential source, for example r.BasicAuth() or their secret
store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@josuegiron
josuegiron merged commit 3de76a7 into master Nov 21, 2026
2 checks passed
@josuegiron
josuegiron deleted the fix/drop-basic-secret-header branch November 21, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant