Repository navigation
rl harness: run trusted process argv and workspace probes without a login shell #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f02dcdb
rl harness: run trusted process argv and workspace probes without a l…
kmccleary3301 77aed81
Merge branch 'main' of https://github.com/kmccleary3301/breadboard in…
kmccleary3301 71f2e20
docs: ACR for trusted process argv without a login shell
kmccleary3301 0ed8ed6
rl harness: reject shell startup hooks in trusted runtime environments
kmccleary3301 1a09d72
rl harness: limit shell startup hook rejection to trusted-process run…
kmccleary3301 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
77 changes: 77 additions & 0 deletions
77
docs/contracts/policies/acr/ACR-20260930-trusted-argv-nonlogin.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # ACR-20260930-trusted-argv-nonlogin | ||
|
|
||
| - `acr_id`: `ACR-20260930-trusted-argv-nonlogin` | ||
| - `title`: Run trusted process argv and workspace probes without a login shell | ||
| - `author`: BreadBoard RL implementation | ||
| - `date`: 2026-09-30 | ||
| - `status`: implemented | ||
|
|
||
| ## 1) Problem Statement | ||
|
|
||
| `TrustedProcessHandle` (`breadboard/rl/harness/sandbox.py`) ran three trusted executions through the pinned shell as a **login** shell (`<pinned bash> -lc …`): | ||
| - `run_argv`, which serves setup and verifier argv and `ProcessLease.execute`; | ||
| - `measure_repository_base_commit`, which runs `git rev-parse --verify HEAD^{commit}` with a 256-byte output limit; | ||
| - `workspace_diff`. | ||
|
|
||
| A login shell sources `/etc/profile` and the first of `~/.bash_profile`, `~/.bash_login` and `~/.profile`. Those files are in state the policy can write, so a policy command could get its own code run inside the trusted executions. It could print extra output, change the exit status, or change working state before the requested argv ran. | ||
|
|
||
| Measured defect on IBM Slurm, 2026-09-30, runtime v11, SMoE SWE training (job 128376), episode hihbg4el: | ||
| - The policy ran `cp /tmp/test_fix.py ~/.bash_profile`. | ||
| - The verifier's base-commit probe sourced that file and exceeded its 256-byte output limit. | ||
| - The episode failed closed with `output_limit_exceeded`. | ||
|
|
||
| The graded patch did not depend on these probes. It comes from the shell-free sealed diff (`sealed_workspace_diff`, which runs pinned git by descriptor with a private `HOME` and `GIT_CONFIG_GLOBAL=/dev/null`). The probes could still misreport or fail. | ||
|
|
||
| ## 2) Scope and Surfaces | ||
|
|
||
| - Kernel danger-zone: yes, under `breadboard/**`. This change touches `breadboard/rl/harness/sandbox.py` only. | ||
| - `TrustedProcessHandle.run_argv`, `measure_repository_base_commit` and `workspace_diff` pass `-c` instead of `-lc` to the pinned shell. The argv, positional parameters, environment, timeouts and output limits are unchanged. | ||
| - A `TRUSTED_PROCESS` `InstalledRuntime` rejects a `fixed_environment` that carries `BASH_ENV` or any `BASH_FUNC_*` key (`fixed environment cannot carry shell startup hooks`). | ||
| - Every trusted-process launch runs the pinned host shell non-interactively with `-c`: the stopped-process bootstrap, the native worker, and the three executions above. | ||
| - Such a shell sources `$BASH_ENV` and imports exported functions, which can override `exec` and `printf`, before the requested argv runs. If `BASH_ENV` named a policy-writable file, it would reopen the same hole. | ||
| - `ENV` is read only by interactive shells. | ||
| - Hardened Docker/gVisor runtimes exec argv inside the container without that wrapper, so they keep their admitted environment unchanged. | ||
| - The production composer's fixed environment is `PATH`, `HOME`, `LANG` and `LC_ALL`. | ||
| - Not changed: policy-facing `run_shell` and `run_native_tool` keep `-lc`, so policy commands still see the image's login environment. The idle process argv is also unchanged. | ||
| - This matches the existing backends: | ||
| - The Docker backend's `run_argv` executes argv directly. | ||
| - The native worker launch already uses `-c` ("Not a login shell: the image's /etc/profile would replace the admitted worker PATH"). | ||
|
|
||
| ## 3) Coupling and Generalization Impact | ||
|
|
||
| - Harness- and task-neutral. Trusted executions now run exactly the argv the runtime requested, whatever shell startup files the workload has written. No task or image may rely on login-profile side effects inside setup/verifier argv. Those argv already receive their environment from the admitted runtime's fixed environment. | ||
|
|
||
| ## 4) Change Classification | ||
|
|
||
| - Classification: `behavioral-change`. Trusted argv and workspace probes no longer source shell startup files. There is no schema or wire-format change. | ||
|
|
||
| ## 5) Evidence and Validation Plan | ||
|
|
||
| - New real-execution test `tests/rl/harness/test_sandbox_process_integration.py::test_trusted_argv_ignores_policy_written_login_profile`: | ||
| - The policy writes `$HOME/.profile` and `$HOME/.bash_profile` through `run_shell`. | ||
| - A sensitivity check asserts that the policy's own login shell runs the profile. | ||
| - The trusted base commit must then equal `HEAD`, `workspace_diff` must be unchanged, and `execute` must print only the requested argv's output. | ||
| - `test_run_argv_executes_requested_command_through_pinned_shell` and `test_workspace_diff_uses_nested_repository_and_types_missing_git` pin `-c`. | ||
| - IBM Linux (bash, `/bin/sh` = dash), on the runtime lineage (`e4src/trusted-argv-nonlogin-v11` on runtime-v11 source `ecd17010`, job 129406): | ||
| - Without the change, the three tests fail. The new test fails with `SandboxLaunchError: workspace base commit measurement failed`. | ||
| - With the change, all three pass. | ||
| - `test_verifier_snapshot`, `test_sandbox_runtime`, `test_v2_service`, `test_production_composition_runtime` and `test_headless_runner` have the same results in both trees, as does the rest of `test_sandbox_process_integration`. | ||
| - On `main`, the two pinning tests fail before and pass after (job 129373). The sealed test is skipped as `runtime_unsupported` on hosts without namespace/UID mapping. | ||
| - `test_trusted_process_runtime_rejects_shell_startup_hooks` (`BASH_ENV` and `BASH_FUNC_exec%%`, each for trusted-process and hardened-Docker runtimes) runs on macOS: | ||
| - Trusted-process cases fail before the validation and pass after. | ||
| - Hardened-Docker cases fail under an ungated check and pass with the gate. | ||
| - The sandbox runtime, Docker sandbox, native phase admission, v2 service and verifier snapshot suites have identical results otherwise. | ||
| - Runtime `bbagent-runtime/v12` carries only the `-c` change, not the hook validation. Its composed fixed environment has neither key. | ||
|
|
||
| ## 6) Rollout Plan | ||
|
|
||
| - RL runtime lineage: `e4src/trusted-argv-nonlogin-v11` builds `bbagent-runtime/v12`. | ||
| - Main: this PR. | ||
|
|
||
| ## 7) Rollback Plan | ||
|
|
||
| - Revert the commit. There is no configuration surface. | ||
|
|
||
| ## 8) Approvals | ||
|
|
||
| - This artifact records the implementation decision and its evidence. It does not assert external PR acceptance or BMoE promotion. |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.