Skip to content

feat(cli): add strict verification profile and lenient profile hint#5

Merged
EulBite merged 1 commit into
mainfrom
feat/cli-strict-profile
May 31, 2026
Merged

feat(cli): add strict verification profile and lenient profile hint#5
EulBite merged 1 commit into
mainfrom
feat/cli-strict-profile

Conversation

@EulBite
Copy link
Copy Markdown
Owner

@EulBite EulBite commented May 31, 2026

Summary

spine-cli verify only exposed the lenient profile. The demo WAL is
signed under the strict, domain-separated contract that backs the browser
playground, so running the CLI against it failed every signature check and
reported INVALID, even though the WAL is genuinely valid.

This adds the strict profile to the CLI so the same WAL verifies on the CLI
and in the playground, and adds a hint so a profile mismatch no longer reads
as catastrophic failure.

Changes

  • verify --strict: routes to spine_core::verify_demo_wal (the
    playground contract). The signing key is pinned from --trusted-pubkey,
    --expected-root is mandatory, and each payload_hash is recomputed from
    the inline payload's canonical JSON. The two profiles stay cryptographically
    distinct (domain separation preserved); the CLI now exposes the strict
    contract rather than merging it with lenient.
  • Lenient profile hint: when every record fails signature verification
    under lenient, the report points at --strict instead of leaving a wall of
    identical errors.
  • Mandatory-flag and incompatibility handling: strict without
    --trusted-pubkey / --expected-root, or combined with --keystore, exits
    2 (usage error); a malformed pinned key surfaces as ERROR / exit 2.

Tests

Six new cli_smoke integration tests: strict valid, strict payload tamper
(payload_hash_mismatch), wrong pinned key (pubkey_mismatch, never a
signature failure), mandatory flags, --keystore rejection, and the lenient
profile hint. CLI smoke suite: 13 -> 19.

Verification

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace --all-features: green.
  • spine-cli clean under pedantic + nursery (--no-deps).

spine-cli verify exposed only the lenient profile, so the demo WAL
(signed under the strict, domain-separated contract that backs the
browser playground) failed every signature check and read INVALID.

Add --strict, routing to spine_core::verify_demo_wal: the signing key
is pinned from --trusted-pubkey, --expected-root is mandatory, and each
payload_hash is recomputed from the inline payload's canonical JSON.
The two profiles stay cryptographically distinct; this exposes the
strict contract on the CLI instead of merging it with lenient.

Also surface a hint when every record fails the lenient signature
check, pointing at --strict rather than leaving a wall of identical
errors.

Covered by six new cli_smoke tests.
@EulBite EulBite merged commit e2d38ad into main May 31, 2026
3 checks passed
@EulBite EulBite deleted the feat/cli-strict-profile branch May 31, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant