Harden chat context IDs against path traversal #54

Open
lost-rob0t wants to merge 27 commits from rage/43-context-id-containment into main
lost-rob0t commented 2026-08-24 12:10:24 +00:00 (Migrated from github.com)

Fixes #43.

RAGE starts with the deterministic security regression only. The first commit proves externally-derived context IDs can currently escape usr/chats through persistence/removal paths; production code follows only after the regression is observed red.

Security invariants:

  • context IDs are opaque identifiers, never filesystem path fragments;
  • persistence/removal independently enforce chat-root containment;
  • invalid external/internal IDs fail explicitly before filesystem mutation;
  • valid existing chat IDs remain compatible.
Fixes #43. RAGE starts with the deterministic security regression only. The first commit proves externally-derived context IDs can currently escape `usr/chats` through persistence/removal paths; production code follows only after the regression is observed red. Security invariants: - context IDs are opaque identifiers, never filesystem path fragments; - persistence/removal independently enforce chat-root containment; - invalid external/internal IDs fail explicitly before filesystem mutation; - valid existing chat IDs remain compatible.
nsaspy changed title from WIP: Harden chat context IDs against path traversal to Harden chat context IDs against path traversal 2026-08-27 19:43:11 +00:00
ci(context-id): fetch install-nix-action by full URL
Some checks failed
Context ID Security / regression (pull_request) Failing after 2m5s
b96dd5fb9d
cachix/install-nix-action is not mirrored on data.forgejo.org, so the
runner fails action resolution before any step runs. Reference the
action by its fully-qualified URL instead.
ci(context-id): drop forgejo token from nix github fetches
Some checks failed
Context ID Security / regression (pull_request) Has been cancelled
b9cd77e4d7
secrets.GITHUB_TOKEN on Forgejo is an instance token, not a GitHub one;
nix tarball fetches with it get HTTP 401 from api.github.com. Fetch the
public flake inputs anonymously.
ci(context-id): retrigger when the nix environment changes
Some checks failed
Context ID Security / regression (pull_request) Has been cancelled
acde9d8730
Merge branch 'main' into rage/43-context-id-containment
Some checks failed
Context ID Security / regression (pull_request) Has been cancelled
9e3b457c7c
Merge branch 'main' into HEAD
Some checks failed
Context ID Security / regression (pull_request) Has been cancelled
Android APK / build (pull_request) Has been cancelled
2887d43e63
ci(context-id): share the heavy-ci queue across workflows
Some checks failed
Context ID Security / regression (pull_request) Failing after 15m49s
26ff75adb8
fix(nix): sandbox derivation builds on the CI runner
Some checks failed
Context ID Security / regression (pull_request) Has been cancelled
317b6a5664
ci(context-id): run on the host nix runner
Some checks failed
Context ID Security / regression (pull_request) Failing after 31s
ae6dc65ad2
The docker runner container cannot sandbox nix builds; run the
regression on the registered host runner (nix) with sandboxed
multi-user nix and drop the redundant installer step.
ci(context-id): use the nix-ci lane
Some checks failed
Context ID Security / regression (pull_request) Failing after 51s
41aba80851
fix(ci): run pytest as a module so the repo root is importable
All checks were successful
Context ID Security / regression (pull_request) Successful in 46s
96af5bd02e
Bare pytest does not put the working directory on sys.path, so the
context-id tests cannot import the helpers package. 'python -m pytest'
inserts the cwd, matching the other workflows.
All checks were successful
Context ID Security / regression (pull_request) Successful in 46s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin rage/43-context-id-containment:rage/43-context-id-containment
git switch rage/43-context-id-containment

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff rage/43-context-id-containment
git switch rage/43-context-id-containment
git rebase main
git switch main
git merge --ff-only rage/43-context-id-containment
git switch rage/43-context-id-containment
git rebase main
git switch main
git merge --no-ff rage/43-context-id-containment
git switch main
git merge --squash rage/43-context-id-containment
git switch main
git merge --ff-only rage/43-context-id-containment
git switch main
git merge rage/43-context-id-containment
git push origin main
Sign in to join this conversation.
No description provided.