Skip to content

v1 runtime batch - #330

Merged
jothimani-rajendran merged 10 commits into
mainfrom
v1-runtime
Oct 26, 2026
Merged

jothimani-rajendran merged 10 commits into
mainfrom
v1-runtime

Conversation

@jothimani-rajendran

@jothimani-rajendran jothimani-rajendran commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Batch branch for the remaining runtime-touching hardening. Each item lands as its own commit(s); the owner syncs the compiled runtime and goldens once at the end of the batch.

Items

  • SR-4e: the rendered runtime is independent of the Python patch release. ast.unparse on 3.12.0 to 3.12.x writes same-quote nested f-strings that are a SyntaxError on 3.11; the renderer now lowers any f-string holding a string literal to ''.join([...]), so the output is byte-identical and parses on 3.11 on every interpreter. Adds tests/test_runtime_render_portable.py.
  • SR-4f: toggle trust (hardening). An off in .chock/guardrails.json or ~/.chock/guardrails.json is honoured only by a session that started after that file's record last changed. A merged plugin binds each session, by the session log's id, to the toggle files and records it first sees; if one changes during the session every member stays on until the next session. The session-start hook binds the session and lists every member that is off, by scope. The Stop-time check refuses a turn's end while a file changed during the session switches a member off. The built-in protection (never toggleable) also refuses an agent's shell or Edit/Write change to a session's binding file. The docs state that a toggle is not a security boundary against an agent running as the person; interactive confirmation is a later item. No new secret or key. Adds toggle_state.py (shipped beside the wrapper) and tests for the binding, the turn-end check and the protected binding file.
  • SR-8a: path hardening. On macOS and Windows, where the filesystem ignores letter case, the write gate, the MCP gateway's path check and the outside-repository globs now match forbidden-path patterns and scope globs without regard to case, in addition to the on-disk spelling. A case_blind override (stdin key to the runner, keyword on evaluate_gate, judged_files and the gateway's judge/evaluate) makes it testable on any platform; the default is the platform's. The bash probe in guard_runner.find_bash now receives the guard path as an argument instead of building it into the shell string. Adds tests/test_case_blind_gates.py and a probe test in tests/test_bash_discovery.py, plus two changelog fragments. Worked against v1-runtime as it stands: gate/repo_names.py (SR-3) is not on this branch and arrives at rc.3, so this item does not use it.

More items will be added here.

Expected CI state

Compiled drift and runtime goldens (including the plugin-target goldens, which now list the session-start wrapper and the new shipped module) are red until the single sync; no goldens or .chock/ files are committed here. SR-8a also changes the runner, so tests/test_runner_selfcontained.py::test_vendored_gate_py_matches_source joins them until the sync.

…R-4e)

Lower f-strings holding a string literal before ast.unparse, so the rendered runtime is
byte-identical and parses on 3.11 on every supported interpreter. Adds a render test on the
running interpreter, a 3.11 parse check and a cross-interpreter byte comparison.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
…s record changed (SR-4f)

A merged plugin binds each session, by the session log's id, to the toggle
files and records it first sees. If one changes during the session every
member stays on until the next session. The session-start hook binds the
session and lists every member that is off, by scope; the Stop-time check
refuses a turn's end while a file changed during the session switches a
member off. Docs state a toggle is not a security boundary against an agent
running as the person.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
…t (SR-4f)

Move the toggle file's format, its record and the session binding into a
sibling module shipped beside the wrapper; bind a session in the user's
state folder so a change of directory cannot start a new binding; keep the
docs free of paths that do not exist in this repository.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
…licate helper (SR-4f)

The built-in protection now refuses an agent's shell or Edit/Write change to
a session's binding (guardrails-session-*.json under .chock/state/), so a
session cannot be rebound to match a forged toggle. Remove the duplicated
_states in the toggle wrapper.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
find_bash now runs a fixed script and hands it the guard path as $1,
so a path holding shell syntax is probed as plain text.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
…dows (SR-8a)

The write gate, the MCP gateway's path check and the outside-repository
globs compare forbidden-path patterns and scope globs case-insensitively
where the filesystem ignores case, so a protected file that does not
exist yet is covered too. A case_blind override makes the behaviour
testable on any platform.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
The golden records the hook command the Linux CI job builds; a build on
Windows writes the cmd.exe form instead, which has its own tests.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran marked this pull request as ready for review October 26, 2026 01:41
Both record the session-start wrapper and the shipped chock_bundle_state.py
that SR-4f added; their test file was not in the batch sync's list.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
The main ruleset requires the head to be up to date before a merge; the
merge brings nothing the rc branch does not already carry.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran merged commit 1f6222b into main Oct 26, 2026
28 checks passed
jothimani-rajendran added a commit that referenced this pull request Oct 26, 2026
The main ruleset requires the head to be up to date before a merge; the
merge brings nothing the rc branch does not already carry.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
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