delego 0.3.0 — implement wire protocol 0.3 (query-fold) - #12
Merged
Conversation
…rprint The action_fingerprint preimage now carries the canonicalized query (spec $4.2): split on '&', first-'=' split, RFC 3986 percent-decoding with '+' as space, sorted by name then value by code point, duplicates preserved, fragment excluded; a bare URL contributes "query": []. Every fingerprint changes — breaking; protocol bumps to 0.3, package to 0.3.0. /orders?to=me and /orders?to=attacker are now different actions, so an approval for one cannot release the other. Brokers forward the (now fingerprint-bound) query and refuse only a #fragment. Rate-limited policies run propose's count->decide->execute->append inside the ledger transaction lock, making the cap exact on one host — the 0.2.3 changelog claimed this but engine.propose never used audit.transaction(). 'delego verify' prints the chain head, accepts --expected-head, and states that truncation cannot be ruled out when no anchor is given (spec $8.3).
Two paths violated 'every decision and execution is recorded as a receipt' (spec $7/$8): resolve() with an unknown approval id denied without writing to the ledger (approval-id probing left no evidence), and a broker refusal/failure during execution propagated with nothing written — including the broker's own BrokerRefusal guard. Both are now recorded as execution/deny receipts; the broker exception is still re-raised.
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.
What
Implements wire protocol 0.3 (
__protocol_version__ = "0.3", package 0.3.0).Breaking — the URL query is folded into the
action_fingerprintpreimage (spec §4.2)ProposedAction.canonical_queryimplements the spec's canonicalization steps mechanically (split on&, first-=split, RFC 3986 percent-decoding with+as space, sort by name then value by code point, duplicates preserved, fragment excluded)."query"([]for a bare URL) — every fingerprint changes./orders?to=meand/orders?to=attackerare now different actions, so an approval for one cannot release the other (the last structural confused-deputy gap).fingerprinted_url= scheme+host+path+query) and refuse only a#fragment(BrokerRefusal, never a silent strip). Newhas_fragment/canonical_query;has_querykept for 0.2-era adapters.Fixed
resolve()with an unknown approval id and broker refusals/failures during execution now leaveexecution/denyreceipts (previously both were invisible in the ledger).engine.proposenever usedaudit.transaction(). Rate-limited policies now run the whole sequence under the ledger lock — cap exact on one host; consistency class documented in SECURITY.md. Regression test: 8 concurrent proposes vsmax: 2→ exactly 2 allows.Added
delego verifyprints the chain head, accepts--expected-head SEQ:HASH, and — with no anchor — states that truncation cannot be ruled out (spec §8.3 auditor obligation).Policy.has_rate_limit;server.jsonbumped to 0.3.0.Not included
The §9 authorization token (optional profile; separate roadmap item).
Verification
resolve, rate-limit cap under 8-way concurrency, broker-refusal receipt, unknown-id receipt).examples/demo.pyend-to-end green; CLI verify smoke-tested (anchor match + truncation detection).hashing/resolvevectors land in a follow-up spec PR — merge this PR first, the spec repo's conformance CI installsdelego@main).