Repository navigation
Conversation
Directory response signatures were only checked when VerifyDirectorySignatures was set, so a signed directory with forged or tampered signatures was accepted silently by default. Add FetcherOptions.DirectorySignatures with three policies: - prefer (default): accept unsigned directories, as the draft allows, but hold any directory that carries signatures to Appendix B.1 and drop keys that fail it. - require: drop every key without a valid signature. - ignore: skip the check. VerifyDirectorySignatures is kept as a deprecated alias for require. Assisted-by: Claude Opus 5.5 via Claude Code Signed-off-by: Xe Iaso <me@xeiaso.net>
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
Directory response signatures (protocol draft Appendix B.1) were only checked when
VerifyDirectorySignatureswas set. By default, a signed directory with forged or tampered signatures was accepted silently.This adds
FetcherOptions.DirectorySignatureswith three policies:DirectorySignaturesPrefer(zero value, new default): an unsigned directory is accepted, as the draft allows ("A verifier MAY use a key obtained by resolving the directory itself whether or not it has valid proof"). A directory that carries anyhttp-message-signatures-directorysignature, or unparsable signature headers, is held to the full B.1 check, and keys that fail it are dropped.DirectorySignaturesRequire: drop every key without a valid signature.DirectorySignaturesIgnore: skip the check.VerifyDirectorySignaturesis kept as a deprecated alias forRequire, so existing callers still compile.Behavior change
Content-Digest: keys are now dropped by default (reported inDirectory.InvalidwithErrDirectoryUnbound).prefermode, once a directory has any signature, every key needs one. A server that signs some keys but not others loses the unsigned ones.DirectoryHandlersigns every key, so it is not affected.Testing
TestFetcherDirectorySignaturePolicycovers each policy against signed, unsigned, forged, and tampered directories, plus the deprecated bool.CGO_ENABLED=1 go test -race -count=1 ./...passes.Assisted-by: Claude Opus 5.5 via Claude Code