Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ jobs:
with:
persist-credentials: false
- name: Compile harness
run: python3 -m py_compile runner/*.py
run: python3 -m py_compile runner/*.py tests/runtime_fixture_check.py
- name: Run deterministic tests
run: python3 -m unittest discover -s tests -v
run: python3 -m unittest discover -s tests -p "test_*.py" -v

runtime-fixtures:
needs: deterministic-tests
runs-on: ubuntu-latest
timeout-minutes: 10
env:
TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
- name: Install observation dependency
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends strace
- name: Restrict trusted runner workspace
run: |
sudo chmod 700 /home/runner
sudo chmod 700 "$GITHUB_WORKSPACE"
- name: Run controlled runtime fixtures
run: sudo python3 tests/runtime_fixture_check.py --sha "$TARGET_SHA"
6 changes: 5 additions & 1 deletion .github/workflows/runtime-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ jobs:
path.chmod(0o600)
PY

- name: Run bounded harness
- name: Restrict trusted runner workspace
run: |
sudo chmod 700 /home/runner
sudo chmod 700 "$GITHUB_WORKSPACE"

- name: Run bounded harness
run: |
sudo python3 runner/run_review.py \
--request-file "$RUNNER_TEMP/request.json" \
--result-file "$RUNNER_TEMP/result.json"
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ It executes a bounded request on a disposable GitHub-hosted Ubuntu runner and re
- Credentials: `NONE`; public/synthetic data only.
- Target acquisition, install hooks, and runtime execute as a dedicated unprivileged OS user.
- Target environment is rebuilt from an allowlist and does not inherit GitHub/Actions credentials.
- Target workspace is separate from the trusted harness/result paths.
- The allowlisted PATH includes only trusted runner tool directories required for Git, Node.js, npm, and standard system tools.
- Target workspace is separate from the trusted harness/result paths, and the runtime workflow removes target-user read access to the trusted checkout.
- Entrypoints are resolved and checked for workspace containment before execution.
- Target stdout/stderr is captured as untrusted data, bounded, and sanitized before inclusion in results.
- Process, open-file, file-size, CPU-time, output-volume, phase, and job time limits bound execution.
Expand All @@ -30,6 +31,8 @@ Run **Actions → Bounded MCP runtime review → Run workflow** and supply one `

v1 supports one executable stop condition: `output_capture_limit`. Any unknown stop condition is rejected as unsupported rather than interpreted as free-form instructions.

For `mcp_initialize`, the harness starts the stdio server, sends `initialize`, waits for the matching JSON-RPC response, sends `notifications/initialized`, and then terminates the disposable target process tree itself. A normal long-lived MCP server is therefore not expected to exit after initialization.

## Result

The workflow uploads `mcp-runtime-result/result.json` for three days. Execution states are evidence states only: `COMPLETED`, `TARGET_FAILED`, `TIMEOUT`, `STOPPED`, `RUNTIME_UNSUPPORTED`, or `HARNESS_ERROR`.
Expand All @@ -38,15 +41,17 @@ The result records request scope, environment/isolation assumptions, exact commi

## Controlled fixtures

Before using third-party runtime output as security evidence, validate the harness against this repository's exact merged commit using `fixtures/safe/server.js`, `fixtures/noisy/server.js`, and `fixtures/failure/server.js`. All three use the repository-root `package-lock.json`.
CI validates the harness against this repository's exact commit using `fixtures/safe/server.js`, `fixtures/noisy/server.js`, and `fixtures/failure/server.js`.

The fixture job verifies the persistent MCP initialize lifecycle, process cleanup, trusted-checkout isolation, filesystem observations, process/network traces, and timeout behavior before changes are accepted on `main`.

## Development

Deterministic CI compiles the harness and runs standard-library unit tests. It never dispatches arbitrary third-party targets.
Deterministic CI compiles the harness and runs standard-library unit tests. A separate CI job executes only repository-controlled runtime fixtures; it never accepts an arbitrary external target from PR data.

```bash
python3 -m py_compile runner/*.py
python3 -m unittest discover -s tests -v
python3 -m py_compile runner/*.py tests/runtime_fixture_check.py
python3 -m unittest discover -s tests -p "test_*.py" -v
```

Do not add real credentials, private source, customer data, automatic security verdicts, self-hosted runners, or a general arbitrary-command interface.
25 changes: 19 additions & 6 deletions fixtures/noisy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@ const fs = require('fs');
const https = require('https');
const { spawn } = require('child_process');
const readline = require('readline');

const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });

rl.on('line', (line) => {
const request = JSON.parse(line);
fs.writeFileSync('noisy-fixture-output.txt', 'unexpected write\n');
spawn(process.execPath, ['-e', 'setTimeout(()=>{}, 250)'], {stdio:'ignore'});
https.get('https://example.com/', (res) => res.resume()).on('error', () => {});
process.stdout.write(JSON.stringify({jsonrpc:'2.0', id:request.id, result:{protocolVersion:'2025-06-18', capabilities:{}, serverInfo:{name:'noisy-fixture', version:'1'}}}) + '\n');
setTimeout(() => rl.close(), 500);
const message = JSON.parse(line);
if (message.method === 'initialize') {
fs.writeFileSync('noisy-fixture-output.txt', 'unexpected write\n');
spawn(process.execPath, ['-e', 'setTimeout(()=>{}, 250)'], { stdio: 'ignore' });
https.get('https://example.com/', (res) => res.resume()).on('error', () => {});
setTimeout(() => {
process.stdout.write(JSON.stringify({
jsonrpc: '2.0',
id: message.id,
result: {
protocolVersion: '2025-06-18',
capabilities: {},
serverInfo: { name: 'noisy-fixture', version: '1' }
}
}) + '\n');
}, 500);
}
});
19 changes: 15 additions & 4 deletions fixtures/safe/server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
const fs = require('fs');
const readline = require('readline');

const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });

rl.on('line', (line) => {
const request = JSON.parse(line);
fs.writeFileSync('safe-fixture-output.txt', 'initialized\n');
process.stdout.write(JSON.stringify({jsonrpc:'2.0', id:request.id, result:{protocolVersion:'2025-06-18', capabilities:{}, serverInfo:{name:'safe-fixture', version:'1'}}}) + '\n');
rl.close();
const message = JSON.parse(line);
if (message.method === 'initialize') {
fs.writeFileSync('safe-fixture-output.txt', 'initialized\n');
process.stdout.write(JSON.stringify({
jsonrpc: '2.0',
id: message.id,
result: {
protocolVersion: '2025-06-18',
capabilities: {},
serverInfo: { name: 'safe-fixture', version: '1' }
}
}) + '\n');
}
});
Loading
Loading