Skip to content

internal/witness: return 404 for unknown log, matching the spec#63

Open
lukevalenta wants to merge 1 commit intoFiloSottile:mainfrom
lukevalenta:lvalenta/witness-unknown-log-404
Open

internal/witness: return 404 for unknown log, matching the spec#63
lukevalenta wants to merge 1 commit intoFiloSottile:mainfrom
lukevalenta:lvalenta/witness-unknown-log-404

Conversation

@lukevalenta
Copy link
Copy Markdown

Summary

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, which returns 404 for an unknown origin and reserves 403 for "no trusted-key signature verifies".

Split the switch so errUnknownLog returns 404 while errInvalidSignature continues 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.

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
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