internal/witness: return 404 for unknown log, matching the spec#63
Open
lukevalenta wants to merge 1 commit intoFiloSottile:mainfrom
Open
internal/witness: return 404 for unknown log, matching the spec#63lukevalenta wants to merge 1 commit intoFiloSottile:mainfrom
lukevalenta wants to merge 1 commit intoFiloSottile:mainfrom
Conversation
c2sp.org/tlog-witness says the witness MUST respond with "404 Not Found" when the checkpoint origin is unknown. serveAddCheckpoint currently collapses errUnknownLog and errInvalidSignature onto a single StatusForbidden (403) case, which diverges from the spec and from sigsum-go's sigsum-witness reference implementation [1], both of which return 404 for an unknown origin and reserve 403 for "no trusted-key signature verifies". Split the switch so errUnknownLog returns 404 while errInvalidSignature (and the new note.UnverifiedNoteError / note.InvalidSignatureError mapping that feeds into it) continues to return 403. [1] https://git.glasklar.is/sigsum/core/sigsum-go/-/blob/main/cmd/sigsum-witness/sigsum-witness.go#L154-L161
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.
Summary
c2sp.org/tlog-witness says the witness MUST respond with "404 Not Found" when the checkpoint origin is unknown.
serveAddCheckpointcurrently collapseserrUnknownLoganderrInvalidSignatureonto a singleStatusForbidden(403) case, which diverges from the spec and from sigsum-go's sigsum-witness, which returns 404 for an unknown origin and reserves 403 for "no trusted-key signature verifies".Split the switch so
errUnknownLogreturns 404 whileerrInvalidSignaturecontinues to return 403.Context
Noticed while cross-checking the Cloudflare witness implementation (azul PR #218) against sunlight and sigsum-go to resolve a separate spec ambiguity about invalid trusted-key signatures (see C2SP PR). All three implementations agree on the 403/invalid-signature path, but only sunlight returns 403 for an unknown origin — the spec and sigsum-go both say 404.
Testing
go build ./...clean.go test ./internal/witness/...— no existing tests in the package.