Repository navigation
research(cef): diagnostic-only Linux sandbox feasibility inventory #402
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 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e68b65f
research(cef): diagnostic-only Linux sandbox feasibility inventory
qnbs 600f0d8
fix(cef): address CodeRabbit findings on sandbox inventory PR
qnbs 190d532
docs(cef): sandbox acceptance criteria + split conflated dependency-i…
qnbs c32f154
docs(cef): write the upgrade playbook proactively, breaking a real ci…
qnbs ea433d1
docs(cef): fix risk-register drift on R-06 and R-13 (external review …
qnbs 2be4f86
fix(ci): add continue-on-error to match the sandbox inventory step's …
qnbs 2e1d09c
Merge branch 'main' into research/cef-wave2-sandbox-feasibility
qnbs 1ad2325
fix(cef): address CodeRabbit's post-sync review wave on PR #402
qnbs 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
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,74 @@ | ||
| #!/usr/bin/env node | ||
| /** | ||
| * CEF Linux sandbox feasibility inventory (Wave 2, roadmap Sandbox posture item — "Not yet | ||
| * attempted" in docs/architecture/native-readiness.md). | ||
| * | ||
| * Diagnostic-only, non-invasive — reports real evidence about whether this runner can support | ||
| * Chromium's Linux sandbox, before any attempt to actually enable it (CefSettings.no_sandbox is | ||
| * currently `true` unconditionally, apps/desktop-cef/src/main.cpp, ADR-0020). Never changes | ||
| * worldscript_host's build or runtime behavior. | ||
| * | ||
| * Background (confirmed against CEF's own docs/sandbox_setup.md and Chromium's | ||
| * docs/linux_sandboxing.md before writing this — CEF has no Linux-specific sandbox API, unlike | ||
| * cef_sandbox_win.h/cef_sandbox_mac.h; the sandbox is entirely a Chromium-internal mechanism, | ||
| * toggled only via CefSettings.no_sandbox): | ||
| * - Layer-1 (process/namespace isolation): the legacy setuid `chrome-sandbox` helper (needs | ||
| * root ownership + the setuid bit), or the modern unprivileged user-namespaces sandbox | ||
| * (preferred automatically since Chromium M-43 if the kernel/policy allows it — no setuid | ||
| * binary needed at all). | ||
| * - Layer-2 (seccomp-bpf syscall filtering): independent of layer-1, needs Linux kernel >= 3.5. | ||
| * | ||
| * This script checks real, functional evidence for layer-1 feasibility — not just documentation | ||
| * claims — since a sysctl value alone doesn't prove unprivileged namespace creation actually | ||
| * succeeds (AppArmor profiles or container restrictions can block it even when the sysctl says | ||
| * "enabled"). | ||
| * | ||
| * Run: node scripts/cef/check-linux-sandbox-inventory.mjs | ||
| */ | ||
| import { execFileSync } from 'node:child_process'; | ||
| import fs from 'node:fs'; | ||
|
|
||
| function tryRun(cmd, args) { | ||
| try { | ||
| return execFileSync(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'] }) | ||
| .toString() | ||
| .trim(); | ||
| } catch { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| console.log('[check-sandbox-inventory] CEF Linux sandbox feasibility inventory:'); | ||
|
|
||
| const kernelRelease = tryRun('uname', ['-r']); | ||
| console.log(` kernel release: ${kernelRelease ?? '(uname failed)'}`); | ||
|
|
||
| // QNBS-v3: this sysctl is a Debian/Ubuntu-specific patch, not present on every distro/kernel — | ||
| // its absence is itself informative (means the mainline kernel default applies), not an error. | ||
| let sysctlValue = null; | ||
| try { | ||
| sysctlValue = fs.readFileSync('/proc/sys/kernel/unprivileged_userns_clone', 'utf8').trim(); | ||
| console.log(` kernel.unprivileged_userns_clone: ${sysctlValue}`); | ||
| } catch { | ||
| console.log(' kernel.unprivileged_userns_clone: (sysctl not present on this kernel/distro)'); | ||
| } | ||
|
|
||
| // QNBS-v3: functional test, not just reading the sysctl — AppArmor profiles or container-level | ||
| // restrictions (e.g. missing CAP_SYS_ADMIN, seccomp policies on the runner itself) can block | ||
| // unprivileged namespace creation even when the sysctl claims it's allowed. | ||
| const unshareTest = tryRun('unshare', ['--user', '--pid', '--fork', 'true']); | ||
| const unshareWorks = unshareTest !== null; | ||
| console.log( | ||
| ` unshare --user --pid --fork (functional test): ${unshareWorks ? 'succeeded' : 'FAILED'}`, | ||
| ); | ||
|
|
||
| const aaEnabled = fs.existsSync('/sys/module/apparmor/parameters/enabled') | ||
| ? fs.readFileSync('/sys/module/apparmor/parameters/enabled', 'utf8').trim() | ||
| : null; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| console.log(` AppArmor module enabled: ${aaEnabled ?? '(not present)'}`); | ||
|
|
||
| console.log( | ||
| `\n[check-sandbox-inventory] Verdict: unprivileged user-namespace sandboxing appears ` + | ||
| `${unshareWorks ? 'FEASIBLE' : 'NOT FEASIBLE'} on this runner (functional test, not just a sysctl read). ` + | ||
| `This is informational only — no sandbox behavior was changed by running this script.`, | ||
| ); | ||
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.