Conversation
Post-merge hardening from the batch review of the accounts/billing epic (PRs #259–#272). One blocker found in review + three low-risk fixes: - [BLOCKER, #265] Enforce StoreKit `environment` on the cloud IAP endpoint. Sandbox transactions are Apple-signed with the SAME cert chain as Production and cost the buyer $0, so /api/billing/iap accepting them = free real credit for anyone with a sandbox tester Apple ID. The endpoint now rejects any non-Production transaction in the cloud edition (LISA_IAP_ALLOW_SANDBOX=1 re-opts a non-prod/staging deploy back in). The JWS signature verification itself was already sound. - [#263] costMicroUSD: clamp a non-finite token count (NaN/Infinity) -> 0, so it can't poison the usage ledger, balance.json, or the budget breaker. - [#263] GET /api/billing/usage: on cloud, a shared-demo-token caller (no account) no longer reads the GLOBAL home's aggregate usage; mirrors /quota. - [#260/#269] Session cookies gain the Secure attribute on the cloud (HTTPS) edition (HttpOnly + SameSite=Strict already present); local/mac http path is unchanged. typecheck + full test suite (1089 pass / 0 fail) + build all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Post-merge hardening from the batch review of the accounts/billing epic (PRs #259–#272). One blocker surfaced in review plus three low-risk fixes.
typecheck+ full test suite (1089 pass / 0 fail) + build all green.⛔️ Blocker — StoreKit sandbox credits real money (#265)
verifyAppleJWSwas already sound (real ES256 + x5c chain to a pinned Apple Root G3), butvalidateTransactionparsedenvironmentand never enforced it. Sandbox transactions are Apple-signed with the same chain and cost the buyer $0 → a free sandbox tester Apple ID could mint real credit by POSTing a sandbox JWS to prod/api/billing/iap.Fix: the cloud IAP endpoint now rejects any non-
Productiontransaction (sandbox_rejected);LISA_IAP_ALLOW_SANDBOX=1re-opts a non-prod/staging deploy back in. Local/mac dev is unaffected.Optimizations
costMicroUSDclamps a non-finite token count (NaN/Infinity) → 0, so it can't poison the ledger,balance.json, or the budget breaker.GET /api/billing/usagegates oncloud && !accountUid→ a shared-demo-token caller no longer reads the GLOBAL home's aggregate usage (mirrors/quota); local ledger stays visible on mac.Secureon the cloud (HTTPS) edition (HttpOnly + SameSite=Strict were already set); local http path unchanged.Deferred to follow-up (tracked separately)
Firestore turn-lease heartbeat (#272), fail-closed global cap (#267), request body caps (#264/#266/#260), SIWA nonce (#261/#269), async scrypt +
/registerrate-limit (#260), and the pre-existing cross-usermoodBus/SSE broadcast (#262) — the top item to close before multi-user launch.🤖 Generated with Claude Code