[PR #237] [MERGED] fix(privileges): make scoped-spawn capability tests root-aware #278

Closed
opened 2026-10-29 14:21:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/237
Author: @huajq
Created: 9/1/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @yingdi-shan

Base: main ← Head: fix/privileges-test-root-aware


📝 Commits (1)

  • 414154c fix(privileges): make scoped-spawn capability tests root-aware

📊 Changes

2 files changed (+23 additions, -2 deletions)

View changed files

📝 CLAUDE.md (+2 -0)
📝 src/privileges.rs (+21 -2)

📄 Description

What

Makes the src/privileges.rs scoped-spawn capability tests pass when run as root: under root, assertions now cover only CapInh/CapAmb instead of all four capability sets.

Why

On execve, the kernel regrants an euid-0 child the full bounding set in CapPrm/CapEff unless SECBIT_NOROOT is set — so the all-sets-zero expectation only holds for non-root runners (CI). Under root, CapInh (preserved across execve) and CapAmb (survives only within the permitted ∩ inheritable intersection) are the sets that actually prove what the scoped spawn delegated.

Closes #169

Scope and non-goals

Included: root-aware capability assertions shared by the three scoped-spawn tests; a make test-unit environment note in CLAUDE.md.

Excluded: enforcing isolation under root via SECBIT_NOROOT — that changes scoped-spawn semantics for root deployments and deserves its own discussion (follow-up #2 in the issue).

Compatibility and operations

Test-only change plus a documentation note; no runtime behavior, API, config, or storage impact.

Validation

  • make fmt
  • make clippy
  • make test-unit

Commands and results:

cargo test -p agentenv --lib privileges            # as root: 4/4 pass (was 1 failed)
cargo test -p agentenv --lib privileges -- --ignored  # as root: 2/2 pass
cargo test -p agentenv --lib privileges            # as non-root: 4/4 pass
make test-unit                                     # as root: 789 passed; 1 failed
  # remaining failure is the pre-existing, unrelated image::resolver test
  # that needs registry network access (passes once the registry is reachable)

Risks and reviewer notes

None — test assertions and docs only. The non-root assertion set is unchanged, so CI behavior is identical.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/237 **Author:** [@huajq](https://github.com/huajq) **Created:** 9/1/2026 **Status:** ✅ Merged **Merged:** 9/2/2026 **Merged by:** [@yingdi-shan](https://github.com/yingdi-shan) **Base:** `main` ← **Head:** `fix/privileges-test-root-aware` --- ### 📝 Commits (1) - [`414154c`](https://github.com/kvcache-ai/AgentENV/commit/414154c01205fa022a8b8308877fae485b0b82b9) fix(privileges): make scoped-spawn capability tests root-aware ### 📊 Changes **2 files changed** (+23 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `CLAUDE.md` (+2 -0) 📝 `src/privileges.rs` (+21 -2) </details> ### 📄 Description ## What Makes the `src/privileges.rs` scoped-spawn capability tests pass when run as root: under root, assertions now cover only `CapInh`/`CapAmb` instead of all four capability sets. ## Why On `execve`, the kernel regrants an euid-0 child the full bounding set in `CapPrm`/`CapEff` unless `SECBIT_NOROOT` is set — so the all-sets-zero expectation only holds for non-root runners (CI). Under root, `CapInh` (preserved across `execve`) and `CapAmb` (survives only within the permitted ∩ inheritable intersection) are the sets that actually prove what the scoped spawn delegated. ## Related issue Closes #169 ## Scope and non-goals Included: root-aware capability assertions shared by the three scoped-spawn tests; a `make test-unit` environment note in `CLAUDE.md`. Excluded: enforcing isolation under root via `SECBIT_NOROOT` — that changes scoped-spawn semantics for root deployments and deserves its own discussion (follow-up #2 in the issue). ## Compatibility and operations Test-only change plus a documentation note; no runtime behavior, API, config, or storage impact. ## Validation - [x] `make fmt` - [x] `make clippy` - [x] `make test-unit` Commands and results: ```text cargo test -p agentenv --lib privileges # as root: 4/4 pass (was 1 failed) cargo test -p agentenv --lib privileges -- --ignored # as root: 2/2 pass cargo test -p agentenv --lib privileges # as non-root: 4/4 pass make test-unit # as root: 789 passed; 1 failed # remaining failure is the pre-existing, unrelated image::resolver test # that needs registry network access (passes once the registry is reachable) ``` ## Risks and reviewer notes None — test assertions and docs only. The non-root assertion set is unchanged, so CI behavior is identical. ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:21:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#278
No description provided.