Skip to content

fix(auth): bind defensive-delete state in op signatures - #157

Merged
Antonov548 merged 27 commits into
mainfrom
auth/op-authored-at-claims
Sep 20, 2026
Merged

Antonov548 merged 27 commits into
mainfrom
auth/op-authored-at-claims

Conversation

@marcus-pousette

@marcus-pousette marcus-pousette commented May 21, 2026 •

Copy link
Copy Markdown
Collaborator

Sequence: #217 is merged; this PR targets main and should land before #255. Keep the pending auth minor unreleased until #255 lands.

Part of #38.

Problem

A defensive delete's knownState determines whether unseen descendants are restored. It travelled with the operation but was not covered by its signature, so a relay could change or remove it without invalidating the signature.

Before / after

// Before: delete semantics were outside the signed input
sign(domain, documentId, operationIdentity, lamport, operationFields)

// After: presence and exact canonical bytes are also signed
sign(
  domain,
  documentId,
  operationIdentity,
  lamport,
  operationFields,
  knownStatePresence,
  knownStateLength,
  versionVectorV0Bytes,
)

Policy

Operation knownState
Delete Required canonical VersionVector v0 bytes
Other kinds Must be absent

The shared codec comes from #217. Auth adds only its 1 MiB, 4,096-entry, and 32-byte replica-id limits. Verification uses copied exact bytes and decodes them only after the signature is valid.

Compatibility

The auth extension for Sync v0 is unreleased, so this revises the existing treecrdt/op-sig/v1 format in place. Sync v0, VersionVector v0, and the auth signing domain are independently versioned. Recreate old development signatures; the Sync envelope is unchanged.

Verification

  • Auth build and test suite
  • High-level sync tests
  • Shared engine conformance: signed-delete roundtrip, exact-state persistence, and unseen-child restoration (validated locally on native SQLite)
  • State mutation/removal, malformed bytes, limit, full-u64, strict Ed25519, and mutable-input coverage

@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from 451ff04 to 523a530 Compare May 21, 2026 15:26
@marcus-pousette
marcus-pousette changed the base branch from auth/session-options-cleanup to main May 21, 2026 15:26
@marcus-pousette
marcus-pousette marked this pull request as ready for review May 21, 2026 15:31
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from 0a731d9 to 7ac06a4 Compare July 11, 2026 20:14
@marcus-pousette marcus-pousette changed the title Add signed op auth authoredAt claims fix(auth): bind delete state in versioned op signatures Jul 11, 2026
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch 2 times, most recently from 87b2ba2 to ac53060 Compare July 11, 2026 20:38
@marcus-pousette marcus-pousette added bug Something isn't working area:auth Authorization, capabilities, proofs, signatures, crypto, and privacy area:sync Sync protocol, reconciliation, transport, discovery, and sync servers labels Jul 12, 2026
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from ac53060 to 879801d Compare July 12, 2026 12:18
@marcus-pousette
marcus-pousette changed the base branch from main to fix/sqlite-storage-known-state July 12, 2026 12:18
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from 879801d to 9fae7fa Compare July 13, 2026 14:07
@marcus-pousette
marcus-pousette force-pushed the fix/sqlite-storage-known-state branch from 28a8c38 to c065a37 Compare July 13, 2026 14:07
@marcus-pousette marcus-pousette changed the title fix(auth): bind delete state in versioned op signatures fix(auth): bind defensive-delete state in op signatures Jul 13, 2026
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from 9fae7fa to b2419be Compare July 13, 2026 15:50
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from b2419be to dc6f43f Compare August 19, 2026 08:52
@marcus-pousette
marcus-pousette force-pushed the fix/sqlite-storage-known-state branch from 67c5db1 to a46cb8c Compare August 19, 2026 08:52
@marcus-pousette
marcus-pousette changed the base branch from fix/sqlite-storage-known-state to main August 20, 2026 11:30
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from dc6f43f to 3e7d3bc Compare August 20, 2026 11:30
@marcus-pousette
marcus-pousette force-pushed the auth/op-authored-at-claims branch from f1783b6 to 0aae043 Compare September 3, 2026 14:39
@marcus-pousette
marcus-pousette changed the base branch from maintenance/remove-version-vector-legacy-serde to main September 18, 2026 08:08
@Antonov548
Antonov548 merged commit 0837798 into main Sep 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:auth Authorization, capabilities, proofs, signatures, crypto, and privacy area:sync Sync protocol, reconciliation, transport, discovery, and sync servers bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants