Harden server/sketch runner, prune dead code, add agent docs#4
Merged
Conversation
Server (src/main.cpp): - Cap request bodies at 5 MiB (transport + handler), add read/write timeouts, and stop leaking internal error text to clients. - Remove the dead /api/hello endpoint and the noisy Asio heartbeat (kept the io_context as an idle infra placeholder). - Join the Asio thread on the early bind-failure return. Frontend (public/script.js): - Tighten the sketch iframe sandbox to allow-scripts only (opaque origin) so user code can't reach the local API, cookies, or storage. Tooling/docs: - Replace the invalid build_and_distribute.bat stub with a clean one. - Add AGENTS.md and CLAUDE.md describing the architecture, HTTP contract, and security model. - Rewrite README.md for production. 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.
What & why
Production hardening pass over the app, removal of dead/demo code, and new contributor/agent documentation.
Hardening —
src/main.cppset_payload_max_length) and inside the save handler (returns413rather than writing unbounded data to disk).set_read_timeout(10s)/set_write_timeout(30s)so a slow or oversized client can't tie up the loopback server./api/save-scriptpreviously returnedex.what()to the client; it now logs tostderrand returns a generic message.return.Hardening —
public/script.jsallow-scripts allow-same-origin→allow-scripts. User sketches now run in an opaque origin and cannot reach the local HTTP API, cookies, or storage. p5.js still loads and error reporting viapostMessagestill works.Dead code removed
/api/helloendpoint.[asio] heartbeatto stdout every 5s. Theio_contextthread is kept as an idle infrastructure placeholder (per maintainer preference) with an explanatory comment.build_and_distribute.bat(# To dois not a valid batch comment — it would error if run) with a clean documented stub.Documentation
Reviewer notes
neo-processingDebug target on Windows/MSVC — compiles and links cleanly, and the re-embeddedscript.jsis included. (The pre-existing build cache pinned an uninstalled Windows SDK; that was environment drift, fixed by reconfigure, unrelated to these edits.)allow-same-originto the sketch iframe or change the bind from127.0.0.1without a replacement isolation strategy.🤖 Generated with Claude Code