fix(cap-drop): filter container cap_drop against host capability bounding set - #7795
Conversation
There was a problem hiding this comment.
Pull request overview
Adds capability-aware cap_drop filtering for hosts with restricted bounding sets.
Changes:
- Parses Linux
CapBndand filters Compose capabilities. - Adds an
AWF_SKIP_CAP_DROPescape hatch. - Adds tests, exports, and documentation.
Show a summary per file
| File | Description |
|---|---|
src/capability-filter.ts |
Implements capability filtering. |
src/compose-generator.ts |
Applies filtering to generated Compose configuration. |
src/docker-manager.ts |
Re-exports filtering helpers. |
src/capability-filter.test.ts |
Tests filtering behavior and integration. |
src/docker-manager-reexports.test.ts |
Tests new exports. |
docs/environment.md |
Documents the escape hatch. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Balanced
| | `AWF_SKIP_CAP_DROP` | Set to `1`, `true`, or `yes` to disable specifying `cap_drop` requirements in generated Docker Compose configurations (useful for hosts with trimmed capability bounding sets). | `1` | | ||
| | `NO_PROXY` | Domains bypassing Squid (host access mode) | `localhost,host.docker.internal` | | ||
|
|
||
| **Note:** Most of these are set automatically based on CLI options and should not be overridden manually. `AWF_SESSION_STATE_DIR` is an exception — it is the environment-variable equivalent of `--session-state-dir` and can be set by users to configure a predictable session-state output path. |
| * Reads the host capability bounding set (CapBnd) from /proc/self/status. | ||
| * Returns the BigInt bitmask if available and readable, or null if unavailable. | ||
| */ | ||
| export function getHostCapabilityBoundingSet(procStatusPath = '/proc/self/status'): bigint | null { |
|
@copilot address review feedback |
Addressed in 0b59608: capability filtering now probes CapBnd from a privileged container created through the configured Docker daemon using getLocalDockerEnv(), avoiding the CLI process/ARC-DinD mismatch. Documentation now identifies AWF_SKIP_CAP_DROP as a last-resort escape hatch that removes every cap_drop directive, including ALL. |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓
|
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...
|
|
✅ Build Test Suite completed successfully!
|
|
✅ Smoke Claude passed
|
|
❌ Smoke Gemini reports failed. Facets need polishing...
|
|
❌ Security Guard failed. Please review the logs for details.
|
Smoke Test: Copilot BYOK (Direct) ✅
Status: PASS | Running in direct BYOK mode (
|
|
Copilot Engine Smoke Test
Overall: PASS
|
Smoke Test: Claude Engine Validation
Overall result: PASS
|
|
Smoke Test: Services Connectivity
Overall: FAIL
|
|
Smoke Test: Docker Sbx Validation
Overall: PASS cc
|
|
PR titles:
GitHub reads: ❌ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Chroot Version Comparison Results
Overall: FAILED — Node.js version mismatch between host and chroot environment.
|
Smoke Test: API Proxy OTEL Tracing — Results
Overall: All scenarios pass or are expected-pending; no regressions found.
|
|
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS All repositories cloned successfully; all builds/installs succeeded; all tests passed. Note: Maven builds used
|
Hosts running container runtimes with trimmed capability bounding sets (e.g. Talos Linux under
arc-dind) fail to start AWF sandboxes because Docker rejects explicitcap_dropentries for capabilities absent from the host (e.g.,invalid CapDrop: ... "CAP_SYS_MODULE"). This change inspects the host process capability bounding set (/proc/self/statusCapBnd) and filters unsupported entries fromcap_dropbefore writingdocker-compose.yml, alongside anAWF_SKIP_CAP_DROPescape hatch.Capability Bounding Set Filtering (
src/capability-filter.ts)/proc/self/statusCapBndto map Linux capability bit positions (bits 0–40).CapBndfrom servicecap_droparrays, preservingALLwildcards and unrecognized capability names.AWF_SKIP_CAP_DROP(1,true,yes) to stripcap_dropdirectives entirely if capability dropping is prohibited.Compose Generation Integration (
src/compose-generator.ts,src/docker-manager.ts)filterComposeCapDropbefore returning fromgenerateDockerCompose.src/docker-manager.ts.Documentation (
docs/environment.md)AWF_SKIP_CAP_DROPenvironment variable in the configuration reference.Usage Example