Skip to content

Persistence round-trip: rowToToken drops 8 optional token fields (follow-up to #168) #175

@pshkv

Description

@pshkv

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

  1. Update rowToToken in packages/persistence/src/pg-token-store.ts to preserve all eight optional fields on read
  2. Add a persistence round-trip regression test that issues, persists, reads, and re-verifies a token with every optional field populated
  3. Schema migration check — confirm the DB schema actually has columns for all eight fields; if not, add them in a migration

Blocks

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions