instar 1.3.2009 → 1.3.2011

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dashboard-pair/service-yes.js +48 -5
  2. package/dist/core/PinAttemptStore.d.ts +11 -0
  3. package/dist/core/PinAttemptStore.d.ts.map +1 -1
  4. package/dist/core/PinAttemptStore.js +30 -7
  5. package/dist/core/PinAttemptStore.js.map +1 -1
  6. package/dist/core/devGatedFeatures.d.ts.map +1 -1
  7. package/dist/core/devGatedFeatures.js +6 -0
  8. package/dist/core/devGatedFeatures.js.map +1 -1
  9. package/dist/data/standards-guard-index.json +1 -1
  10. package/dist/data/standards-guard-index.meta.json +2 -2
  11. package/dist/data/standards-registry.meta.json +1 -1
  12. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  13. package/dist/native/instar-desktop-host +0 -0
  14. package/dist/recommended/confirmStats.d.ts +52 -0
  15. package/dist/recommended/confirmStats.d.ts.map +1 -0
  16. package/dist/recommended/confirmStats.js +149 -0
  17. package/dist/recommended/confirmStats.js.map +1 -0
  18. package/dist/recommended/confirmTokens.d.ts +29 -4
  19. package/dist/recommended/confirmTokens.d.ts.map +1 -1
  20. package/dist/recommended/confirmTokens.js +51 -9
  21. package/dist/recommended/confirmTokens.js.map +1 -1
  22. package/dist/recommended/reoffers.d.ts +9 -3
  23. package/dist/recommended/reoffers.d.ts.map +1 -1
  24. package/dist/recommended/reoffers.js +27 -3
  25. package/dist/recommended/reoffers.js.map +1 -1
  26. package/dist/server/AgentServer.d.ts +2 -0
  27. package/dist/server/AgentServer.d.ts.map +1 -1
  28. package/dist/server/AgentServer.js +151 -46
  29. package/dist/server/AgentServer.js.map +1 -1
  30. package/dist/server/CapabilityIndex.js +1 -1
  31. package/dist/server/CapabilityIndex.js.map +1 -1
  32. package/dist/server/middleware.d.ts.map +1 -1
  33. package/dist/server/middleware.js +4 -0
  34. package/dist/server/middleware.js.map +1 -1
  35. package/dist/server/publicPinHook.d.ts +61 -0
  36. package/dist/server/publicPinHook.d.ts.map +1 -0
  37. package/dist/server/publicPinHook.js +3 -0
  38. package/dist/server/publicPinHook.js.map +1 -0
  39. package/dist/server/recommendedServiceRoutes.d.ts +19 -0
  40. package/dist/server/recommendedServiceRoutes.d.ts.map +1 -1
  41. package/dist/server/recommendedServiceRoutes.js +94 -8
  42. package/dist/server/recommendedServiceRoutes.js.map +1 -1
  43. package/dist/server/routes.d.ts +2 -0
  44. package/dist/server/routes.d.ts.map +1 -1
  45. package/dist/server/routes.js +25 -0
  46. package/dist/server/routes.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/data/awareness/approval-link-guess-bound.md +4 -0
  49. package/src/data/awareness/recommended-services-reoffers.md +1 -1
  50. package/src/data/builtin-manifest.json +47 -47
  51. package/src/data/feature-ladders.json +1 -0
  52. package/src/data/standards-guard-index.json +1 -1
  53. package/src/data/standards-guard-index.meta.json +2 -2
  54. package/src/data/standards-registry.meta.json +1 -1
  55. package/src/data/state-coherence-registry.json +34 -0
  56. package/upgrades/1.3.2010.md +20 -0
  57. package/upgrades/1.3.2011.md +36 -0
  58. package/upgrades/side-effects/recommended-services-reoffers.md +3 -0
  59. package/upgrades/side-effects/sec135-approval-link-guess-bound.md +134 -0
@@ -0,0 +1,134 @@
1
+ # Side-Effects Review — Confirm-page PIN guesses from strangers go through the sign-in limits (SEC-135)
2
+
3
+ **Version / slug:** `sec135-approval-link-guess-bound`
4
+ **Date:** `2026-11-21`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `echo (separate pass over the security-sensitive diff, recorded below)`
7
+
8
+ ## Summary of the change
9
+
10
+ Spec: `docs/specs/sec135-approval-link-guess-bound.md` (approved by Justin 2026-11-21 10:16 PST, Telegram topic 141385: accept the experience cost at medium, faster staged path (b)).
11
+
12
+ The recommended-services confirm page gave every page open its own 5-guess PIN budget, and anyone could open 30 a minute, so about 9,000 PIN guesses an hour per machine were possible. Behind one dev-gated switch, `security.approvalLinks.enabled`:
13
+
14
+ - `src/server/AgentServer.ts`: the sign-in closures are split into a decision (`publicPinAdmission`) and sign-in/step-up's renderer (`publicPinAdmit`, bodies unchanged); `publicPinFailure` charges every durable key in one write and takes extra keys; `readCurrentPin` is sign-in's own PIN read. A new synchronous `publicPinVerify` (insecure-connection first, class admission, per-request key, constant-time compare, one-write charge, in-memory per-request fallback) and `publicPinContext` are exposed as `ctx.publicPin` (`src/server/publicPinHook.ts`).
15
+ - `src/core/PinAttemptStore.ts`: `recordFailures(keys)` (one persist) and `windowSeconds`; `recordFailure` delegates to it.
16
+ - `src/server/routes.ts`: the switch (`resolveDevAgentGate`), `verifyConfirmPin` and `ownerOpen` deps for the recommended-services routes. `checkConfirmPin` stays as the off path; `/mcp/approve/:id` and the email-code route are untouched.
17
+ - `src/server/recommendedServiceRoutes.ts`: the confirm POST renders the verifier's verdict (fixed `pin-paused` wording on the public path, a separate one on marker/local); the GET gives owner opens their own allowance and protected tokens, `too-many-pages` with a refill time, `allProtected` for an owner open when all 50 are protected; `confirmStats` in `GET /recommended-services`; graduation evidence rows.
18
+ - `src/recommended/confirmTokens.ts`: `mint(binding, { protected })`, owner allowance, eviction rules; no options = old behaviour exactly. `src/recommended/confirmStats.ts`: the counters, flushed at most once a minute.
19
+ - `dashboard-pair/service-yes.js`: `X-Instar-Request` on the open, retry brakes, the new messages.
20
+ - `src/server/middleware.ts`: a comment at the CORS allow-header list.
21
+ - Registries: `src/core/devGatedFeatures.ts`, `src/data/feature-ladders.json` (`security.approvalLinks`), `src/data/state-coherence-registry.json` (`pin-attempts`, `recommended-service-confirm-stats`), awareness entry `src/data/awareness/approval-link-guess-bound.md`.
22
+
23
+ ## Decision-point inventory
24
+
25
+ - Confirm-answer admission (public path) — modify — from "per-token budget only" to sign-in's public limits plus the per-token budget (invariant per spec: same numbers as sign-in).
26
+ - Confirm-answer admission (marker / local paths) — modify — sign-in's marker path and local budget, plus the per-token budget.
27
+ - Confirm-page mint (owner open) — add — separate 30/min allowance, protected rows.
28
+ - Token eviction at the 50-per-service cap — modify (switch on only) — oldest unprotected; refuse when all are protected.
29
+ - Sign-in and step-up admission — pass-through — refactored onto the same functions, answers unchanged.
30
+
31
+ ---
32
+
33
+ ## 1. Over-block
34
+
35
+ The intended cost, accepted by the owner: an owner on a browser that never unlocked the dashboard, away from the machine, is refused while a public limit is reached (an attack, their own repeated wrong tries, or their network's allowance spent), exactly as on sign-in. They see a message naming the ways through. A local process flooding owner opens can fill the 50 protected rows for a service; the owner then sees the "still active" message (inherited local gap, spec section 3). A many-tab browser restore beyond 30 owner opens a minute retries with brakes and may give up after three tries with a reload message.
36
+
37
+ ---
38
+
39
+ ## 2. Under-block
40
+
41
+ - A process on the machine itself reaches the local path (bounded by the 10-per-5-minute local budget), as on sign-in.
42
+ - A stolen remembered-browser marker uses the marker path (its own backoff and abuse cap of 50), as on sign-in.
43
+ - The fleet keeps today's exposure until the maturation review graduates the switch (accepted, faster staged path).
44
+ - `/mcp/approve/:id` is out of scope by design: a stranger cannot mint its request ids.
45
+ - The email-code route keeps today's public aggregate (unchanged by design).
46
+
47
+ ---
48
+
49
+ ## 3. Level-of-abstraction fit
50
+
51
+ Right layer: the limits are sign-in's own, reached through one hook beside sign-in, so the two surfaces cannot drift. The confirm route only renders the verdict. No parallel limiter is added.
52
+
53
+ ---
54
+
55
+ ## 4. Signal vs authority compliance
56
+
57
+ - [x] Yes — but the logic is deterministic rate limiting on an irreversible-consequence boundary (a guessed PIN grants owner authority), which the spec classifies as an invariant.
58
+
59
+ These are rate controls, not judgments: they bound guess counts and never decide identity. A marker or local connection only picks the allowance; the PIN remains the only proof.
60
+
61
+ ---
62
+
63
+ ## 4b. Judgment-point check
64
+
65
+ No new static heuristic at a competing-signals point. Every number is piece 1c's shipped sign-in policy. The owner allowance (30/min, 50 rows) is the spec's declared judgment-candidate with floor, arbiter and fallback (the existing store values).
66
+
67
+ ---
68
+
69
+ ## 5. Interactions
70
+
71
+ - Sign-in and confirm answers now share the throttle and the durable aggregate: a flood on either refuses strangers on both (intended).
72
+ - `PIN_ALERT_ONLY_KEY` is now fed on confirm pages only by marked and local wrong guesses (with the switch on); `/mcp/approve` still feeds it as before. Stranger confirm guesses raise `DashboardPin.bruteForce` instead.
73
+ - Sign-in's local-budget and durable charges now happen in one write instead of up to three; counts are identical.
74
+ - The existing per-token key format (`req:<sha256 of recsvc:id:token>`) is reused, so counts carry across a switch flip.
75
+
76
+ ---
77
+
78
+ ## 6. External surfaces
79
+
80
+ - New response fields: `pin-paused` 429 body on confirm POST; `retryAfterSeconds` and `allProtected` on `too-many-pages` (switch on); `confirmStats` in `GET /recommended-services` (switch on).
81
+ - The confirm page now sends `X-Instar-Request: 1` on its GET (harmless with the switch off) and keeps a short-lived retry lock in localStorage.
82
+ - Nothing visible to other agents.
83
+
84
+ ## 6b. Operator-surface quality
85
+
86
+ The refusal wordings are the spec's fixed plain sentences and name what to do. An expired page says it timed out and asks for a reload.
87
+
88
+ ---
89
+
90
+ ## 7. Multi-machine posture
91
+
92
+ - Page tokens (with `protected`): machine-local by design. machine-local-justification: physical-credential-locality (spec Multi-machine posture: single-use credential accepted only on the minting machine; replicating would add a forgery path through unauthenticated pull replication).
93
+ - PIN counters: no new rows; `state/pin-attempts.json` is now declared machine-local in the registry, describing piece 1c's per-machine posture.
94
+ - Confirm counters: per machine, proxied-on-read (each machine reports its own; the graduation review sums every machine's from the pool roster).
95
+
96
+ ---
97
+
98
+ ## 8. Rollback cost
99
+
100
+ Set `security.approvalLinks.enabled: false` (restores piece 1c's behaviour exactly), or revert the commit. Older code ignores the `protected` token field; token rows expire within 30 minutes. `confirm-stats.json` becomes unused and harmless. No migration.
101
+
102
+ ---
103
+
104
+ ## Conclusion
105
+
106
+ Closes the SEC-135 guessing rate on development agents now and on the fleet after the maturation review, with no new limits and sign-in's behaviour unchanged.
107
+
108
+ ## Second-pass review
109
+
110
+ Separate pass over the security-sensitive diff (AgentServer verifier, PinAttemptStore, confirm route, token store, owner-open check):
111
+
112
+ - No await between admission, compare and charge in `publicPinVerify`; the parallel last-attempt test confirms exactly one compare.
113
+ - The constant-time compare hashes both sides to 32 bytes first, as sign-in does.
114
+ - The per-request key is checked on all three paths and has an in-memory fallback when the store is absent; the store keeps counts in memory when a write fails. The in-memory map's 4096-entry cap cannot evict a live token's counter, because the verifier only runs for a live token (at most 50 per service).
115
+ - `ownerOpen` requires the exact header and a verified HMAC marker or own-loopback host; the CORS allow list excludes the header (pinned by a test).
116
+ - Found and fixed in this pass: a stranger's mint refused because all 50 rows were protected originally returned `allProtected: true`, telling a stranger that owner pages were live. Now only an owner open gets the flag.
117
+ - Insecure-connection refusal comes first and is not counted.
118
+
119
+ Concur with the review.
120
+
121
+ ## After Local Verify (2026-11-23)
122
+ The full run on head e485208cc failed one unit test, and the run record does not name the file. On a head brought up to date with main, the fifteen unit tests nearest this change pass: the SEC-135 suites, the ladder, dev-gated, awareness and bounded-accumulation registries, the PIN store and verifier, and the middleware and security scans. The change is resubmitted unchanged for a fresh run.
123
+
124
+ ## Release 1.3.1989 conflict repair
125
+
126
+ Tier 2 maintenance under the existing approved specification. A fresh remote readback identified published PR 3586 head 467c8eafd4b767cbea5761aeaa58fd0fbcc4a72d. The existing isolated checkout was fast-forwarded to that published head before merging current main ec9401e5bdf28ed5ab1ff13f88e0032cc7895fc6. The single conflict is Git suggesting that the still-unreleased note move from upgrades/next to the released-note directory. The resolution keeps the original fragment byte-for-byte in upgrades/next so the normal release assembler still includes it. The routes source auto-merges; no runtime behavior is manually changed.
127
+
128
+ The existing over-block, under-block, layer fit, signal versus authority, interactions, external-surface, multi-machine and rollback analysis remains applicable. Per-request counters and their store-outage fallback, public and owner/local budget separation, constant-time comparison, source identity derivation, owner-open proof, bounded records and insecure-connection refusal order remain the existing approved behavior. No new authority, limit, credential, data migration or production activation is introduced. Rollback is an ordinary merge correction; installed state is untouched.
129
+
130
+ Verification uses one sequential runner under normal admission for focused service/verifier/store checks, the real HTTP flood suite, the production lifecycle suite and TypeScript. Full exact-head verification remains with throughput after publication, main repairs and the retained order. All native, owner-phone, recovery and PIN prerequisite holds remain. One scoped maintenance review and one planned normal commit; no new design rounds. Final results and independent review are recorded below after completion.
131
+
132
+ Final focused results: 45 unit checks, one full HTTP flood check and three production lifecycle checks passed (49 total), followed by TypeScript with exit zero. The flood check still bounds strangers while the remembered browser and this computer retain access. The sequential runner stopped between steps only to record actual results and used normal admission throughout.
133
+
134
+ Independent reviewer /root/review_3586_release_note concurred after reading the staged merge and artifact. The fragment is byte-identical in upgrades/next; the verifier, counters, fallback, budgets, trusted source identity, owner-open proof and refusal ordering retain their published-parent behavior, and the routes merge retains main additions. Full exact-successor verification remains required after publication and main repairs. Existing order, dependency and safety holds remain intact.