Skip to content

Protect local web APIs with launch tokens and strict request validation - #6

Merged
Jo2234 merged 1 commit into
mainfrom
fix/github-review-2026-10-04
Oct 4, 2026
Merged

Jo2234 merged 1 commit into
mainfrom
fix/github-review-2026-10-04

Conversation

@Jo2234

@Jo2234 Jo2234 commented Oct 4, 2026

Copy link
Copy Markdown
Owner

The local web server previously accepted foreign-origin text/plain requests that could invoke learner-data deletion or provider-backed commands. All API reads and writes now require a fresh launch token, validated loopback Host/Origin headers, and strict bounded JSON before state or provider work begins. The served browser UI sends the token automatically; Electron IPC and CLI stdin remain compatible.

The patch also handles malformed length headers and excessive JSON nesting with structured errors, prevents token-page framing/caching, and documents migration for local HTTP scripts and embedded servers. HTTP clients must bootstrap the token and reload after a server restart; remote binding and tokenless requests are intentionally refused.

Validation: 145 Python tests, JavaScript renderer/IPC/token regressions, Ruff, mocked smoke, independent malformed-request probes, and actual IPv4/IPv6 server startup checks passed. Requests rejected by the security gates caused no state/provider/dispatch effects. Opus lead and Codex adversarial checker agreed on this exact patch.

Acceptance limits: the RP loopback page was unreachable from the shared browser preview. Browser-shaped real HTTP requests and executable JavaScript VM checks passed; native Electron, camera and paid providers were not exercised.

@Jo2234
Jo2234 merged commit 28c77e2 into main Oct 4, 2026
4 checks passed
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