Context
Follow-up from #168 (canonical signing payload fix) — the canonicalization fix alone is insufficient for full JSONB round-trip safety. packages/persistence/src/pg-token-store.ts rowToToken currently drops eight optional token fields on read, which means any token issued with those fields set will still fail signature validation after a Postgres round-trip even after #168 merges.
Fields dropped by rowToToken
modelConstraints
attestationRequirements
verifiableComputeRequirements
executionEnvelope
revocationEndpoint
behavioralConstraints
passportId
delegationDepth
Why it matters
The signing payload computed post-read will not match the signing payload computed pre-write when any of these fields were populated. The user flow: issue a token with behavioralConstraints, persist, re-read, try to verify → INVALID_SIGNATURE. This is the same failure class #168 solves for nested-key ordering, but at the field-presence level.
Scope
- Update
rowToToken in packages/persistence/src/pg-token-store.ts to preserve all eight optional fields on read
- Add a persistence round-trip regression test that issues, persists, reads, and re-verifies a token with every optional field populated
- Schema migration check — confirm the DB schema actually has columns for all eight fields; if not, add them in a migration
Blocks
References
Context
Follow-up from #168 (canonical signing payload fix) — the canonicalization fix alone is insufficient for full JSONB round-trip safety.
packages/persistence/src/pg-token-store.tsrowToTokencurrently drops eight optional token fields on read, which means any token issued with those fields set will still fail signature validation after a Postgres round-trip even after #168 merges.Fields dropped by
rowToTokenmodelConstraintsattestationRequirementsverifiableComputeRequirementsexecutionEnveloperevocationEndpointbehavioralConstraintspassportIddelegationDepthWhy it matters
The signing payload computed post-read will not match the signing payload computed pre-write when any of these fields were populated. The user flow: issue a token with
behavioralConstraints, persist, re-read, try to verify →INVALID_SIGNATURE. This is the same failure class #168 solves for nested-key ordering, but at the field-presence level.Scope
rowToTokeninpackages/persistence/src/pg-token-store.tsto preserve all eight optional fields on readBlocks
References