Repository navigation
feat(security): spike primitives for ISP-056..059 — franking, finality tiers, transfer tickets, UV claims (#726 #727 #728 #729) - #845
Merged
Mikey-222 merged 1 commit intoOct 19, 2026
Conversation
…y, transfer tickets, UV claims Closes Hel-Phone#726 Hel-Phone#727 Hel-Phone#728 Hel-Phone#729 - Hel-Phone#726: HMAC-commitment message franking in src/lib/crypto.ts (attachFrankingTag/verifyFrankingTag, keyId rotation, constant-time compare) + spike report docs/spikes/726-message-franking-report.md - Hel-Phone#727: server/lib/finality.ts — pending/closed/finalized/orphaned tier classification + orphan predicate + spike report - Hel-Phone#728: single-use expiring transfer tickets with generation semantics in src/lib/sessionKey.ts + spike report - Hel-Phone#729: uv claim bound into session tokens (issueSession, renewSessionIfNeeded, passkey-auth register/login/refresh) + spike report; server-side userVerification:'required' already enforced upstream Tests: 23 new (franking 7, finality 6, transfer 6, uv 4). Full-suite typecheck/lint blocked by pre-existing broken dep @as-integrations/express (404 on npm; lockfile pins express4) — verified via targeted tsc on touched TS files + vitest on the 4 new suites. Signed-off-by: yilkash <260288456+yilkash@users.noreply.github.com>
|
@Yilkash Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Combined PR closing the four assigned spike issues with minimal, verified
primitive slices plus honest spike reports. The full DM-report pipeline,
checkpoint projector, QR/presence UX and UV-gating middleware these issues
ultimately describe do not exist in this codebase today (see per-issue
findings); this PR ships the hard cores each design hangs on, wired only where
a real call site already exists.
Verification
franking-spike,checkpoint-finality-spike,session-transfer-spike,session-uv-spike).npm run typecheck/npm testblocked by a pre-existing brokendependency:
package.jsonpins@as-integrations/express(404 on npm)while
package-lock.jsonpins the real@as-integrations/express4.Untouched per scope rules; verified instead via targeted
tscon the threetouched TS files (my sections clean; remaining errors pre-existing in
crypto.ts:46–511 / sessionKey.ts:64 / workerSandbox.ts / types/index.ts)
and vitest on the 4 new suites.
Issue #726: E2E Message Franking
Problem: Report button + moderator view accept unverifiable pasted
plaintext;
crypto.tshas E2EE envelopes but zero franking/commitmentconstructions;
server/lib/alertWebhook.tsis a one-line placeholder andwsCluster.jscarries no per-DM sender/recipient logging.Resolution: HMAC-commitment franking primitive in
src/lib/crypto.ts:attachFrankingTag/verifyFrankingTag(MAC = truncated HMAC-SHA256 overnonce‖ciphertext, 16-byte tag,
keyIdfor rotation, constant-time compare,malformed → false). Report pipeline wiring specced in the spike report
(
docs/spikes/726-message-franking-report.md), not faked.Closes #726
Issue #727: ZK Checkpoint Ledger-Reorg Finality
Problem: Issue describes first-sight-is-final checkpoint handling. Against
current
main,server/indexer/parser.tshas no CheckpointCommittedbranch at all and
exporter.tsis a contract-state snapshot exporter — thedescribed pipeline doesn't exist.
Resolution: New
server/lib/finality.ts— explicitpending | closed | finalized | orphanedtiers (classifyFinality(depth, {finalityDepth}),default k=2, throws on garbage depth) +
isOrphaned(first, latest)same-ledger/different-hash predicate. Module is deliberately unwired;
the reorg-aware projection design is specced in
docs/spikes/727-checkpoint-finality-report.md.Closes #727
Issue #728: Cross-Device Session Transfer
Problem: Issue reports QR session-copy cloning responders across devices.
Current
mainhas no QR flow or presence system:sessionKey.tsis ECDHwith auto-burn,
wsCluster.jsis a tenant-filtered contract-event relay.Resolution: Single-use, expiring transfer tickets with generation
semantics in
src/lib/sessionKey.ts(createTransferTicket/redeemTransferTicket, 90s TTL, single-useticketId, redeem → generationN+1; replay →
already_redeemed, expired →expired). Full presence statemachine + QR UX specced in
docs/spikes/728-session-transfer-report.md.Closes #728
Issue #729: WebAuthn UV Tiers
Problem: Issue reports
uv=preferreddowngrading the auth chain. Againstcurrent
mainthe server side is already closed —server/routes/passkey-auth.jsenforcesuserVerification: 'required'+requireUserVerification: trueon register AND login. What's missing:sessions carry no UV/capability claim for audit or future step-up gating.
Resolution:
uvclaim bound into session tokens:issueSession(uv: opts.uv !== false), preserved throughrenewSessionIfNeededand the threepasskey-auth.jscall sites(register/verify, login/verify — measured from the authenticator's answer,
session/refresh). Tier policy + remaining shared-device compartment work
specced in
docs/spikes/729-webauthn-uv-tier-report.md.Closes #729
Covered-slice honesty note
#729 server-side UV enforcement predates this PR (verified in source); this
PR adds the session claim. #727's module is intentionally unwired — there is
no checkpoint pipeline to wire it into. #726/#728 are prototype primitives
without the described DM-report/QR-presence pipelines, which the spike
reports document as remaining work.