M3 phase-3 server batch: recovery anti-abuse (KEY-17), trustee-only migration (H-4), pairing/wrap hardening (KEY-19/13), golden vectors (3.7) #136

Closed
opened 2026-11-09 18:54:25 +01:00 by amiryahaya · 3 comments
Owner

Server-side slice of Phase 3 (Key Management & Multi-Device) — the part buildable before the client phases land. Source: phase-3.8 audit remediation items, gaps verified in code 2026-11-10.

Slices (each its own PR):

  1. KEY-17 recovery-initiation anti-abuse — CreateRecoveryRequest currently notifies trustees only:
    • notify the ACCOUNT OWNER (email + all enrolled devices) with a cancel path
    • per-account cool-down between initiations (pending-request dedupe exists; a time cool-down does not)
    • trustee approval step-up (IDA-07) — verify/enforce in ApproveRecoveryRequest
  2. H-4 trustee-only migration (drop the legacy server share) — SetupRecovery still stores ServerShare (line 37: existing.ServerShare = req.ServerShare): the server-held share contradicts the trustee-only 2-of-3 design. Remove server_share from the contract + schema (migration), SetupRecovery reworked to trustee shares only. Staging/no-prod = safe break.
  3. KEY-13 wrap-fetch rate limiting + anomaly alert — verify wrap-fetch endpoint limiter coverage; alert on anomalous volume.
  4. KEY-19 pairing secret — verified OK server-side (256-bit RandomNumberGenerator); approve-sheet fingerprint display = client phase. No server work beyond a test pinning the entropy contract.
  5. 3.7 golden vectors — key-hierarchy blob-format test vectors (same hierarchy across platforms) — test infrastructure for the client SDK phases.

Acceptance: KEY-17 acceptance (initiation-flood exercises alert the owner; a phished trustee cannot complete recovery alone); server share ceases to exist; wrap-fetch limits enforced.

Server-side slice of Phase 3 (Key Management & Multi-Device) — the part buildable before the client phases land. Source: phase-3.8 audit remediation items, gaps verified in code 2026-11-10. **Slices (each its own PR):** 1. **KEY-17 recovery-initiation anti-abuse** — CreateRecoveryRequest currently notifies trustees only: - notify the ACCOUNT OWNER (email + all enrolled devices) with a cancel path - per-account cool-down between initiations (pending-request dedupe exists; a time cool-down does not) - trustee approval step-up (IDA-07) — verify/enforce in ApproveRecoveryRequest 2. **H-4 trustee-only migration (drop the legacy server share)** — SetupRecovery still stores ServerShare (line 37: existing.ServerShare = req.ServerShare): the server-held share contradicts the trustee-only 2-of-3 design. Remove server_share from the contract + schema (migration), SetupRecovery reworked to trustee shares only. Staging/no-prod = safe break. 3. **KEY-13 wrap-fetch rate limiting + anomaly alert** — verify wrap-fetch endpoint limiter coverage; alert on anomalous volume. 4. **KEY-19 pairing secret** — verified OK server-side (256-bit RandomNumberGenerator); approve-sheet fingerprint display = client phase. No server work beyond a test pinning the entropy contract. 5. **3.7 golden vectors** — key-hierarchy blob-format test vectors (same hierarchy across platforms) — test infrastructure for the client SDK phases. Acceptance: KEY-17 acceptance (initiation-flood exercises alert the owner; a phished trustee cannot complete recovery alone); server share ceases to exist; wrap-fetch limits enforced.
Author
Owner

Slice 1 LANDED: KEY-17 anti-abuse (PR #137 squash, PR runs api-ci 12270 + security-ci 12271 green, suite 977/0/39, coverage 87.62%). Owner alert on both initiation paths (in-app recovery_alert + email best-effort), per-account 15-min cool-down (429 recovery_cooldown + audit) enforced across cancel, owner-only cancel endpoint (new Cancelled status, trustees notified), trustee approval recent-auth gate (LastLoginAt >15 min → 403 reauth_required + security audit). TestFixture minted sessions stamp LastLoginAt. Remaining: slice 2 (H-4 trustee-only ServerShare removal), slices 3-5.

Slice 1 LANDED: KEY-17 anti-abuse (PR #137 squash, PR runs api-ci 12270 + security-ci 12271 green, suite 977/0/39, coverage 87.62%). Owner alert on both initiation paths (in-app recovery_alert + email best-effort), per-account 15-min cool-down (429 recovery_cooldown + audit) enforced across cancel, owner-only cancel endpoint (new Cancelled status, trustees notified), trustee approval recent-auth gate (LastLoginAt >15 min → 403 reauth_required + security audit). TestFixture minted sessions stamp LastLoginAt. Remaining: slice 2 (H-4 trustee-only ServerShare removal), slices 3-5.
Author
Owner

Slice 2 LANDED: H-4 trustee-only migration (PR #138 squash, PR runs api-ci 12305 + security-ci 12306 green, suite 977/0/39, coverage 87.70%). server_share dropped from the /setup contract + RecoverySetup schema (migration DropServerShare); GET /api/recovery/share endpoint REMOVED (file + SEC-04 registry + matrix row) — the public DID-keyed server-share distribution was the live H-4 liability. Completion keeps both gates (KeyProof fixed-time + approved trustee request, #86 epoch). RecoveryShamirTests reworked to trustee-only; RecoveryProbeEvidenceTests retired (endpoint gone). Remaining: KEY-13 wrap-fetch limiter check, KEY-19 entropy pin, golden vectors.

Slice 2 LANDED: H-4 trustee-only migration (PR #138 squash, PR runs api-ci 12305 + security-ci 12306 green, suite 977/0/39, coverage 87.70%). server_share dropped from the /setup contract + RecoverySetup schema (migration DropServerShare); GET /api/recovery/share endpoint REMOVED (file + SEC-04 registry + matrix row) — the public DID-keyed server-share distribution was the live H-4 liability. Completion keeps both gates (KeyProof fixed-time + approved trustee request, #86 epoch). RecoveryShamirTests reworked to trustee-only; RecoveryProbeEvidenceTests retired (endpoint gone). Remaining: KEY-13 wrap-fetch limiter check, KEY-19 entropy pin, golden vectors.
Author
Owner

ALL SERVER-SIDE SLICES RESOLVED — closing. Verification outcome for the last two items:

  • Slice 3 (KEY-13 wrap-fetch) — ALREADY COVERED, verified: the wrap-fetch fixed-window limiter (30/min prod, 50/min testing, partitioned session-else-IP) is pinned by RateLimitSecurityTests.WrapFetch_TripsAfterLimit_Returns429 (51-request probe → 429), and rejections flow through RateLimitRejectionHandler's security.ratelimited audit (the anomaly-evidence tail). No new code needed.
  • Slice 4 (KEY-19 pairing secret) — ALREADY COVERED, verified: AuthorizePairing generates a 256-bit secret (double the ≥128-bit bar), stored only as SHA-256, 10-min single-use TTL — pinned by DeviceKeyWrapTests.Pairing_Init_ReturnsHighEntropySecretAndTenMinuteTtl. The approve-sheet fingerprint display is client-phase.
  • Slice 5 (3.7 golden vectors) — DEFERRED to M7: the cross-platform key-blob vectors require the client SDK hierarchy implementation (Phase 8); the server-side contract is already pinned by the wrap/signature tests (WrapAuthenticityTests + KEY-16 vectors). Will move to the M7 SDK issue when it opens.

Landed slices: #137 slice 1 (KEY-17: owner alert both paths + email, 15-min cool-down enforced across cancel, owner cancel endpoint, trustee recent-auth gate) + #138 slice 2 (H-4: server share removed from contract/schema/public endpoint — trustee-only 2-of-3 is now the only recovery path, completion gated by KeyProof + approved request).

Final suite state: 977/0/39, coverage 87.7%.

ALL SERVER-SIDE SLICES RESOLVED — closing. Verification outcome for the last two items: - **Slice 3 (KEY-13 wrap-fetch) — ALREADY COVERED, verified**: the wrap-fetch fixed-window limiter (30/min prod, 50/min testing, partitioned session-else-IP) is pinned by RateLimitSecurityTests.WrapFetch_TripsAfterLimit_Returns429 (51-request probe → 429), and rejections flow through RateLimitRejectionHandler's security.ratelimited audit (the anomaly-evidence tail). No new code needed. - **Slice 4 (KEY-19 pairing secret) — ALREADY COVERED, verified**: AuthorizePairing generates a 256-bit secret (double the ≥128-bit bar), stored only as SHA-256, 10-min single-use TTL — pinned by DeviceKeyWrapTests.Pairing_Init_ReturnsHighEntropySecretAndTenMinuteTtl. The approve-sheet fingerprint display is client-phase. - **Slice 5 (3.7 golden vectors) — DEFERRED to M7**: the cross-platform key-blob vectors require the client SDK hierarchy implementation (Phase 8); the server-side contract is already pinned by the wrap/signature tests (WrapAuthenticityTests + KEY-16 vectors). Will move to the M7 SDK issue when it opens. Landed slices: **#137 slice 1** (KEY-17: owner alert both paths + email, 15-min cool-down enforced across cancel, owner cancel endpoint, trustee recent-auth gate) + **#138 slice 2** (H-4: server share removed from contract/schema/public endpoint — trustee-only 2-of-3 is now the only recovery path, completion gated by KeyProof + approved request). Final suite state: 977/0/39, coverage 87.7%.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/failsulit#136
No description provided.