Repository navigation
CC:Tweaked HTTP lockdown, rebased onto main - #75
Open
OpenSource-For-Freedom wants to merge 3 commits into
Open
OpenSource-For-Freedom wants to merge 3 commits into
OpenSource-For-Freedom wants to merge 3 commits into
Conversation
Two independent defects, both found while triaging the paid-access backlog. CC:Tweaked HTTP was wide open. Children write and run Lua on this server, and the stock rules are `deny $private` then `allow *`, so any whitelisted player could make the SERVER issue outbound HTTP to any host, including the DO metadata endpoint. SSRF with a child at the keyboard, reachable today. The rules cannot be committed. They are Forge SERVER config, stored per-world at world/serverconfig/computercraft-server.toml, and both data/config/ and data/world/ are gitignored deliberately because tracking files the server rewrites leaves the droplet worktree dirty and aborts git pull --ff-only in gitops/deploy.sh. Pointing a config file at data/config/ would have been a silent no-op. So the rules go through itzg's PATCH_DEFINITIONS, applied at every container start, which also means they re-assert after a manual edit on the box. Player impact: pastebin and wget now fail with "domain not permitted" for every host. One entry above the catch-all deny allows a host back, which is also how the Instructor Terminal will get its single allowed origin. Not verified live. CI proves the patch is present, wired and deny-by-default; only reading the effective config inside the container proves it applied. tools/verify_cc_http.sh does that and must be run on the droplet after deploy. The playtime limiter was never off. #21 deleted the Windows playtime_limit.ps1 and wrote "there is currently no time limit of any kind" into DEPLOY.md and the changelog, conflating it with the KubeJS limiter, which was added 2026-07-20 and has been tracked, mounted and loading on every boot since. A parent told no parental control exists goes and finds another way, or leaves. The root cause was not the deletion, it was that nothing was observable. The limiter now logs on load and answers /playtime in game, DEPLOY.md carries a dated correction, and the test fails if the claim comes back. Both tests were validated by mutation: five deliberate breaks each, all caught.
…testing
Ran mc-image-helper patch against the pinned image over a seeded stock config,
which is the only way to know the lockdown actually applies. It did not.
Two format traps, each of which fails SILENTLY: the definition is rejected at
startup, the server boots with stock permissive rules, and CI stays green. For
a security control that is the worst available failure mode.
1. PATCH_DEFINITIONS pointing at a DIRECTORY requires each file to be a
PatchDefinition ({file, ops}). The {patches: [...]} PatchSet wrapper is only
valid when the variable names a single file. Wrong shape gave
"Unrecognized field".
2. No comments in the definition, not even //. The advertised
--json-allow-comments applies to the files being patched, not to the
definition read from the directory. A // line gave
"ALLOW_COMMENTS not enabled for parser".
Rationale moved out of the JSON into data/patches/README.md, which documents
both traps so the next person does not repeat them.
Also: the patcher rewrites TOML flattened and single-quoted rather than as
[[http.rules]] blocks. Both are valid TOML and Forge reads either, but the
first verify script grepped for `host = "*"` and would have reported a false
failure against the real output. It now parses the TOML with tomllib and
checks rule ORDER, and takes CONFIG_FILE so it can be tested without a
container.
Verified end to end locally: stock config in, deny-by-default out, parsed back
with tomllib to confirm seven rules in the right order with the catch-all deny
last. Verifier passes on the patched file and fails on stock rules.
Both real bugs are now CI failures, mutation-tested.
Brings fix/cc-http-lockdown-and-playtime-truth up to date with the nine commits main gained since it was cut (world guard, player cap, base image trim, dependabot). Two conflicts, both additive on both sides: ci.yml gains the lockdown and playtime steps alongside main's new world and custom-mods gates, and the shell-parse list carries tools/verify_cc_http.sh together with the alerts scripts; CHANGELOG keeps main's Removed entry and merges both Security bullets under one heading. This lockdown is a prerequisite for the in-world computer network work: it must land before any player-facing programs ship.
This branch has not been deployed
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
Rebase of the CC:Tweaked HTTP lockdown (branch
fix/cc-http-lockdown-and-playtime-truth, two commits, never merged) onto current main. It is the first prerequisite for the in-world computer network, tablets and drones work that starts next: handing kids programmable computers on a server whose HTTP rules aredeny $privatethenallow *is server-side request forgery with a child at the keyboard.What it does (unchanged from the original branch)
PATCH_DEFINITIONS: "/data/patches"appliesdata/patches/computercraft-http.jsontoworld/serverconfig/computercraft-server.tomlat every container start, deny-by-default. Re-asserts on every boot, so a hand edit on the box does not survive.tests/test_cc_http_lockdown.pykeeps the patch strict JSON and a PatchDefinition (not a PatchSet), the two formats that fail silently otherwise.tools/verify_cc_http.shproves the effective rules inside the running container, since local proof only shows the patch applies./playtime, load banner) plustests/test_playtime_limiter.py, correcting the documentation that claimed it was off while it was running.Merge resolution
Two conflicts, both additive on both sides:
ci.yml: the lockdown and playtime steps now run after the world tests; the shell-parse list carriestools/verify_cc_http.shtogether with main's alerts scripts.CHANGELOG.md: main's Removed entry kept; both Security bullets under one heading.Validation
All gates green on the merged tree: test_cc_http_lockdown, test_playtime_limiter, test_world_not_tracked, test_world_no_player_data, test_client_server_mods, test_custom_mods_reviewed, test_kubejs_script_hazards, test_security_alerts, test_design_role.js;
bash -non deploy.sh and verify_cc_http.sh;docker compose configvalidates; ci.yml parses.After merge
Run
tools/verify_cc_http.shon the droplet after the deploy carrying this lands. Player impact: the stockpastebinandwgetprograms fail with "domain not permitted"; allowing one host back is a single entry above the catch-all deny.