Skip to content

test: strengthen Linux boundary and credential-daemon checks - #187

Merged
kevin-orellana merged 3 commits into
mainfrom
feature/linux-integration-boundaries
Oct 30, 2026
Merged

kevin-orellana merged 3 commits into
mainfrom
feature/linux-integration-boundaries

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem: Linux test results need to distinguish executed assertions from platform exclusions and early returns. The prior coverage also lacks a durable agent/tool metadata check, and unrelated credential failures can conceal an incorrect test setup.

Solution: Add paired Linux checks for hidden metadata, unsupported-grant startup refusal, and system-information boundaries. Verify the complete credential request and the exact expected error. Negative fixtures must reach their intended error before testing rejection.

Trade-off: Nine macOS-only cases remain declared skips on Linux. Some have Linux counterparts with different supported behavior. The real credential daemon, external HTTPS fixtures, and separate permission changes remain outside this candidate's proof.

Description

This refresh includes current main 21609dc94d26e1392ea74be5af4faf5f8c63a1a4 and the earlier PR187 changes. Main declares 129 deterministic cases; this PR adds four Linux cases, for 133. The current product was rebuilt and tested; old-head results are not used as current evidence.

The metadata case checks both agent and tool access to the same owned file. An explicit read grant exposes its metadata and contents. Without that grant, both operations must report absence. A separate missing file, completion markers, tool-start authorization, and host-side content checks establish that the probes ran.

Credential checks require the full request object and the specific unknown-environment error. The negative fixtures check their own expected parse or daemon error first. This prevents a truncated response or unrelated transport failure from satisfying the intended test. The live test requires health and an authorized known-environment listing before its unknown-environment request.

Existing denial checks and platform declarations remain. No product interface, permission policy, or automated workflow changes. Prepared with Codex and independently reviewed. The automated re-review at 34e3d0b also found no new defects and recommended approval; this is not human approval.

Related Issues

Related to #48; this PR does not close the broader coverage issue.

Type of Change

Other: integration tests, assertion repairs, and coverage reconciliation.

Testing

Tested revision: 34e3d0b8ece45386f0a651f0822548f869f4c96b. Main baseline: 21609dc94d26e1392ea74be5af4faf5f8c63a1a4.

Native Linux: Amazon Linux 2023.12.20261029, ARM64, kernel 6.12.111-136.204.amzn2023.aarch64, Rust/Cargo 1.98.1. Experimental Linux support was enabled. HOME=/local/home/keorel is the canonical spelling of the same operator home. This lets the existing Git denial assertions run while #198 retains ownership of their fixture repair.

The following rows describe integration tests, not unit tests.

Category What the tests prove Results and remaining gaps
Containment Box limits tested file, process, network, environment, and tool operations according to grants and refusals. 69 passed; nine declared macOS-only cases skipped, with their Linux disposition below.
Monty Box's Python interpreter checks file and network effects through policy and refuses tested escape paths. 14 passed; this does not qualify arbitrary Python packages or native Python workloads.
Policy Box applies permit and deny rules to tested tool starts, protected state, and outbound requests. Nine passed; separate ignored temporal-policy defects remain.
Shell Box's Shell checks command effects, shared policy history, file operations, and separation between requests. 24 passed; the separate ignored append defect remains.
Telemetry Box records tested decisions and identities and rejects attempts to forge trusted telemetry. Eight passed; the external HTTPS trace-context case remains separately ignored.
Credential component integration The credential API handles local sources and synthetic daemon responses and rejects incorrect unknown-environment results. 29 executed and passed on Linux and macOS; one optional real-daemon test returned early, although Cargo reports 30 passes.

The deterministic result is 133 expected and recorded: 124 passed, nine skipped, zero failures or errors. Its coverage_gate=full means every manifest case has a result; it does not mean every product requirement is covered. There are no quarantined cases or unexpected deterministic skips.

Linux/macOS differences and missing execution

Cases or checks Current disposition
CN-D-01, CN-D-02 macOS tests denial of future paths. Linux instead refuses absent deny targets at startup; CN-LINUX-FUTURE-DENY checks refusal and an existing-target control.
CN-L-01 macOS supports list-only access. CN-LINUX-LIST checks Linux startup refusal beside a read-grant control; possible future Landlock support requires separate validation.
CN-T-05, CN-E-04 macOS tests metadata discovery and its existence-disclosure residual. CN-LINUX-METADATA checks hidden ungranted metadata/content for agents and tools; it is not a census of every runtime path.
CN-F-02, CN-F-03 macOS checks file authority through its native interfaces. #199 separately implements and tests Linux permission restrictions; this candidate does not contain that fix.
CN-I-13 The macOS kqueue disclosure case has no identical Linux mechanism. Existing Linux process checks remain; they do not cover every possible process query.
CN-P-02 macOS restricts named sysctl queries. CN-LINUX-SYSTEM-INFORMATION instead checks declared Linux identity/statistics fields and hostname-change refusal with an isolated successful control.
CN-F-04, CN-I-11 These characterize actual permission and terminal effects; a pass does not prove unsafe-mode or terminal-injection protection.
Alias read protection The ordinary Linux test executes write checks but omits read protection. The explicit diagnostic still fails at the read assertion; this is the accepted Linux exception, not a new failure caused by this PR.
Real daemon and external HTTPS The real daemon is unavailable. Two HTTPS integration cases remain ignored on both systems; the coverage chat owns those fixture follow-ups.

The manifest contains 112 shared cases, 12 Linux-only cases, and nine macOS-only cases. Native macOS compiled all updated harness targets and passed the credential tests. The four new Linux cases recorded four declared macOS skips. Hosted run 41013940746 passed both deterministic jobs: Linux recorded 124 passes and nine declared skips; macOS recorded 121 passes and 12 declared skips. Both recorded all 133 cases with zero failures or errors. Hosted checkout uses the pull-request merge commit d69ede75ea8ca51528acd69a57bf08ea4dd5c767; its tree 49623b30c7bce138126d0b1bf8eae727861ec8a9 matches the tested branch head. The hosted Linux workspace job, lint, native macOS checks, and code scans passed. The macOS workspace job remains in progress; no all-checks-passed claim is made.

Separate unit and support evidence

The hosted Linux workspace job passed but printed 99 skip diagnostics for unavailable containment or namespace prerequisites, unsupported architecture, a missing alias helper, and the absent real daemon. This is a diagnostic-line count, not 99 unique tests. Its green status does not prove those assertions ran. The native ARM64 results below supply the executed containment evidence; #185 separately owns gate enforcement.

The Linux workspace reported 1,882 passes and seven ignores across 20 unit/binary targets. Its 109 Cargo integration targets reported 2,696 passes and nine ignores. These targets include component/API tests and process tests; they are not all end-to-end tests.

The first workspace invocation exited 101 because seven documentation targets reported missing compiled dependencies (E0463) after overlapping build checks. All runtime targets passed. A subsequent, serialized documentation run exited zero: 13 passed and one ignored across eight targets. This does not turn the original invocation into a clean pass.

The standalone harness's 93 unit tests passed separately; its one documentation example remained ignored. Credential unit tests passed on both platforms: 204 on each. These subset and cross-platform counts must not be added into a unique-test total.

The workspace run preceded the last credential-fixture correction; the corrected credential suite was rerun separately and passed.

The ignored workspace cases comprise shared defects, deferred measurements, external fixtures, the accepted alias-read diagnostic, and child helpers invoked by parent tests. They must not all be treated as missing integration coverage. The 16 runtime ignores comprise three shared policy defects, one shared Shell defect, three deferred measurements, two external HTTPS fixtures, one alias-read diagnostic, and six child helpers. The parent tests for those helpers passed. One documentation example is also ignored.

Assertion sensitivity

Independent checks changed the serialized request version and weakened the expected-error guard; the tests rejected both changes. Granting the hidden file to either agent or tool made the metadata denial check fail. Restored source passed.

The synthetic live fixture completed health, known-environment listing, and unknown-environment lookup in order. Six incorrect fixtures failed: wrong error, malformed response, incompatible health protocol, empty credential list, absent socket, and stale socket. These prove test sensitivity, not compatibility with the shipped daemon.

Commands

cargo build -p strands-box -p strands-box-containment --all-features --locked
install -m 0755 target/debug/strands-box-sock-alias target/debug/deps/strands-box-sock-alias
PATH="$PWD/target/debug:$PATH" HOME=/local/home/keorel EXPERIMENTAL_LINUX_SUPPORT=TRUE cargo test --workspace --locked --all-features --no-fail-fast -- --show-output
PATH="$PWD/target/debug:$PATH" HOME=/local/home/keorel EXPERIMENTAL_LINUX_SUPPORT=TRUE DET_RESULTS_DIR="$PWD/.agents/explorations/integ-current-main-20261030/final-native" bash test-integ/run.sh
cargo test -p strands-box-credentials --locked --all-features -- --show-output
cargo fmt --all --check
cargo fmt --manifest-path test-integ/Cargo.toml --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::too_many_arguments -A clippy::only_used_in_recursion -A clippy::await_holding_refcell_ref -A clippy::explicit_auto_deref -A clippy::chunks_exact_to_as_chunks -A dead_code -A non_snake_case
cargo test --workspace --locked --all-features --doc -- --show-output
bash scripts/test-all.sh box-examples

Mac compilation used cargo test --manifest-path test-integ/Cargo.toml --all-features --locked --no-run. Credential tests used the same command as Linux. Workspace lint passed with the existing repository allowances. Standalone harness lint retained one warning in unchanged cn_native_egress.rs; there were no new warnings. The examples command found no scripted examples; no live SDK tutorial ran. Independent credential build, no-default build, and private documentation checks passed.

Detailed per-case results, the 29-row requirement matrix, commands, source/binary hashes, and raw logs are retained in the owned worktree under .agents/explorations/integ-current-main-20261030/. The harness's legacy commit stamp reports unknown in this mapped worktree; validation-summary.json records the actual revision and binary hashes separately.

No deployment, Runtime restoration, positive native cloud enforcement, performance parity, or release qualification is claimed.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features)
  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings

The lint command includes the repository's documented allowances, as shown above.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

Linux startup refusals lack paired controls for their permitted alternatives.
The optional live credential-daemon test accepts any hard failure, including a stale socket.

## Solution

Add Linux tests for absent deny paths, list-only grants, and the system-information boundary.
Retain successful startup controls and verify that hostname changes fail.
Require daemon health and caller access before checking the specific unknown-environment response.
Add local response and stale-socket checks, and document the live fixture.
Production behavior and automated workflows do not change.

## Tests

Linux ARM64: the three new cn_linux_* cases passed and rejected altered test inputs.
The restored tests passed again. The existing cn_w_03 startup-refusal case passed.
All 93 harness unit tests passed.
Credential tests reported 204 unit and 29 integration passes, including one explicit live-daemon skip.
A synthetic live fixture passed and six setup/response faults failed as required.
The all-features workspace log reports 4,493 passes, zero failures, and 17 ignored tests.
The workspace reports missing helper, accepted alias-read, and real-daemon skip diagnostics.
Workspace clippy passed with the repository's vendored-code allowances. Formatting passed.
Independent review found no code or documentation defect and passed its scoped gates.
The examples script found no scripted examples. No live agent or real daemon ran.
macOS validation requires the hosted checks.
The full native suite passed 123 cases with nine declared macOS-only skips and no failures.
The first native run failed unchanged cn_l_02 on a symlinked HOME spelling.
The same directory's canonical HOME spelling made the focused control and full suite pass.
Comment thread crates/credentials/tests/end_to_end.rs Resolved
@github-actions

Copy link
Copy Markdown

Assessment: Approve

Solid, focused test-only change. Each Linux refusal is paired with a positive control, the refused workload is verified never to run, and system state (deny path, protected file contents, host hostname) is checked unchanged — so a false "refused" cannot pass. The credential-daemon changes close a real false-positive: the live test now requires a healthy, caller-accessible fixture and the exact unknown-environment mapping, and a new local test proves a stale socket cannot satisfy that assertion.

Review notes
  • Assertion accuracy: Verified every asserted message against source — the unknown-environment mapping (credsd.rs), the list refusal (filesystem.rs:417), and the absent-deny refusal (filesystem.rs:322) all match the real box startup output.
  • Harness fit: cn_linux_* cases follow the existing det_case! pattern; the unshare control in the system-information test only executes where the box itself is usable, so hosts lacking namespace capabilities skip rather than error.
  • Testing: One optional inline suggestion — the deterministic credsd request could be asserted as a whole object rather than two fields.
  • Scope: No production code, frozen surface, or workflow changes; no new dependencies. Documentation added for the live-daemon fixture.

Nicely constructed negative-plus-control tests that make the refusals hard to fake.

@github-actions

Copy link
Copy Markdown

Assessment: Approve (re-review at 34e3d0b; previous review was at b6d8e98)

The commits since my last review add cn_linux_metadata_visibility.rs, unrelated_daemon_failures_cannot_satisfy_the_unknown_environment_assertion, and the full-object request assertion. The rest of the diff comes from the main merge. I found no new defects. The earlier inline suggestion is addressed (REQUEST_ID is 1, so the "id": 1 literal is correct).

Correction to my previous summary: I wrote that hosts lacking namespace capabilities "skip rather than error". That was wrong. test-integ is excluded from the workspace, and per test-integ/README.md an unusable box fails the harness's positive control as an ERROR (suite RED), not a SKIP. The unshare control's DET_ERROR: prefix therefore puts a host without user namespaces in the correct infrastructure category. This changes nothing in the code.

What I checked (each held)
  • Metadata case — every ungranted row is ENOENT because the boundary hides the file: the agent and tool rows each have a granted control on the same file. In the tool-granted row, STAT_OK can only come from the [tool.metadata_probe] boundary, because the agent has no grant in that row. That proves the tool table matched, so the ungranted tool row's ENOENT is the tool's own. refused_as rejects a probe that never ran.
  • Absent control: a hidden file and a truly absent path give the same errno, so a stat cannot reveal whether the file exists.
  • Unrelated daemon failures: all three asserted messages (malformed body, INTERNAL, malformed result) match parse_response and map_error. I made INTERNAL return the unknown-environment message instead, and the new test failed, so it catches that regression. Change restored.
  • Live test setup is fatal when configured: I ran it with an absent explicit CREDSD_SOCKET, then with only CREDSD_TEST_ENVIRONMENT set. Both failed, as they should. With neither set, it skips.
  • Repository rules: "prove the workload entered and the effect absent" (test-integ/README.md) and "reintroduce the defect and watch each test fail" (crates/credentials/AGENTS.md) both hold.
  • Not run here: the cn_linux_* cases. This host is x86_64 with unprivileged user namespaces restricted, and Linux containment is aarch64-only. All 8 credsd_e2e tests pass locally.

@kevin-orellana
kevin-orellana merged commit bba49cc into main Oct 30, 2026
24 checks passed
@kevin-orellana
kevin-orellana deleted the feature/linux-integration-boundaries branch October 30, 2026 15:12
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.

3 participants