Merged
Conversation
6f4a3db to
e41a0b0
Compare
cdecker
reviewed
Mar 12, 2026
| pub struct CanonicalJsonValue<'a>(pub &'a serde_json::Value); | ||
|
|
||
| impl Serialize for CanonicalJsonValue<'_> { | ||
| fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> |
Collaborator
There was a problem hiding this comment.
Ok, I was about to mention my concern about canonical encodings when I saw this. Great work, and thanks for going the extra mile. I like the canonical ordering for structs. One last question: whitespace being a major issue with JSON encoding, I assume that this skips any whitespace that there might be?
Collaborator
|
Excellent work so far 👍 |
e41a0b0 to
a01653b
Compare
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.
This PR adds end-to-end integrity protection for persisted signer state. The signer derives a dedicated state-signing key from the root secret, signs outgoing shard updates, and verifies signatures on incoming shards. Signature repairs propagate naturally through diff/sketch sync, allowing previously unsigned entries to be upgraded over time.
Key design decisions:
Per-shard signatures. Signatures are attached per shard rather than to the full state blob to remain compatible with differential sync.
Signature policy. The default policy is soft: missing signatures are accepted and repaired during sync, while invalid signatures are rejected. The hard policy rejects both missing and invalid signatures, and off explicitly disables verification.
Canonical serialization. Shards are signed using canonical JSON instead of preserving raw JSON bytes. This keeps the implementation simpler while relying on a well-defined serializer.
Operator recovery. Recovery is implemented as a session-scoped override with audit logging.
Tower storage. Tower storage remains opaque. No DB schema or migration changes are required, and the protocol is unchanged except for adding a per-entry signature field.
Replay protection. Replay protection is intentionally deferred. There is no external monotonic counter yet, so this change protects integrity but does not prevent replay of older validly signed state.