Repository navigation
feat(api): stop copying the token in RequestHeaderSession on instances - #70
Merged
Merged
Conversation
RequestHeaderSession copied the SecurityToken request header into the response header, echoing the request token that SEC-08 already keeps out of instance bodies. On an api.New instance it no longer does; it still answers 401 without the header. The default instance keeps the v0 copy. Instances are new in v1, so v0 programs see no change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
josuegiron
changed the base branch from
fix/drop-basic-secret-header
to
master
November 21, 2026 17:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason
RequestHeaderSessioncopied theSecurityTokenrequest header into the response header. That echoes the request token, which SEC-08 (#65, Q36) already keeps out of response bodies onapi.Newinstances. Owner decision (2026-11-21): instances stop the copy, and the default instance keeps it.Scope and stack
fix/drop-basic-secret-header). Both PRs edit adjacent lines of the README security notes (theBasicTokenline and the token-echo line), so they would conflict if both targetedmaster. Merge fix(api)!: stop copying the basic password into Basic-Secret #69 first, then retarget this PR tomaster. The stack merges cleanly with fix(api): send the request info error from RequestBasic getters #68 as well (tested locally).RequestHeaderSessionno longer sets theSecurityTokenresponse header.New()defaults line), the README security note, and the migration guide ("No token echo" and its checklist item).New()behavior; this PR does not anticipate it.feat(api), not breaking. Instances are new in v1, so v0 programs see no change.Changes
middlewares.go: set the response header only when!instanceFrom(r).fromNew. This is the same checkgetSecurityTokenuses. The doc comment is updated, including a corrected first line.instance_token_echo_test.go: a table-drivenTestRequestHeaderSessionResponseHeaderwith three cases:README.md,docs/adr/0001-v1-instance-api.md,docs/migration-v1.md: updated as described under Scope.Release notes
Instance changes: on an
api.Newinstance,RequestHeaderSessionno longer copies theSecurityTokenrequest header into the response header. It still answers 401 when the header is missing. This completes "no token echo" (SEC-08) on instances. A client that read the token back from that response header must keep its own copy, or the handler must set the header. The default instance, and aRequestHeaderSessionplaced outsidea.Handler, still copy it as in v0.Verification
TestRequestHeaderSessionResponseHeaderfails on the oldmiddlewares.go; all cases pass after the change.gofmt -l .prints nothing;go vet ./...ok;go test -race ./...ok;govulncheck ./...found no vulnerabilities.🤖 Generated with Claude Code