feat(config): declarative custom-paths boundary checking via --config#26
Draft
sublimino wants to merge 4 commits into
Draft
feat(config): declarative custom-paths boundary checking via --config#26sublimino wants to merge 4 commits into
sublimino wants to merge 4 commits into
Conversation
sublimino
marked this pull request as draft
May 26, 2026 11:04
sublimino
force-pushed
the
feat/bwrap-detection
branch
2 times, most recently
from
May 27, 2026 14:34
07a45a4 to
6734b1d
Compare
sublimino
force-pushed
the
feat/custom-path-config
branch
2 times, most recently
from
June 16, 2026 09:39
68edc6a to
dfdb865
Compare
- Use filepath.Join for home-relative paths in scanTargetedPathsForHome so Windows drive-letter separators are handled correctly - Remove incorrect early-return guards that skipped all checks on Windows - Update path assertions in tests to use filepath.Join - Skip chmod-based permission test on Windows (chmod is a no-op there)
Adds a --config flag that accepts a YAML file declaring expected filesystem access boundaries for a sandboxed AI agent. The probe evaluates must_block, must_read, must_readwrite, and audit path categories and reports pass/fail findings per path. - pkg/config/config.go: load and validate YAML config (identity + custom_paths) - pkg/tasks/baseline/custom_paths.go: probe logic for each path category - pkg/tasks/custom_paths_task.go: task wiring into the probe report - cmd/scan.go: --config flag plumbed into scan command - cmd/cmd.go: viper config separated from --config flag to avoid collision - go.mod: add viper dependency - tests/example/: Docker-based alice/bob demo; generic two-user config, Dockerfile with synthetic credential files, coloured run.sh driver - Makefile: add 'make install' and 'make docker-test' targets - .gitignore: exclude personal tests/cpai-*/ configs from repo
sublimino
force-pushed
the
feat/custom-path-config
branch
from
June 17, 2026 11:58
dfdb865 to
5d9c067
Compare
…th lists Remove the Windows early-return stub from scanTargetedPathsForHome(). Split sensitive paths and system write paths into platform functions (platformSensitivePaths, platformSystemWritePaths, platformDefaultHome) defined in filesystem_unix.go and filesystem_windows.go respectively. Unix-only absolute paths (/etc/passwd, /proc/self/cgroup, /.dockerenv etc.) move to filesystem_unix.go. Windows gets its own credential locations (Credential Manager, %APPDATA%/gcloud, 1Password local data, Windows system dirs). Cross-platform home-relative paths stay in filesystem.go and resolve correctly on both OSes via filepath.Join. Fixes 10 Windows unit test failures introduced by the filepath.Join migration in the previous commit.
On Windows, Unix absolute paths (/etc/passwd, /var/run/docker.sock etc.) are correctly absent from buildSensitivePathsForHome — the test was asserting they must be present unconditionally. Split the assertion by platform: Unix asserts the full set of Unix absolute paths; Windows asserts Unix paths are absent and accepts Windows-specific entries.
albrodfer1
approved these changes
Jun 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a
--config <yaml>flag tosandbox-probe scanfor declarative filesystem boundary checking. Users define expected access rules in a YAML file; the scanner reports violations as structured findings.What's new
--config <path>flag (global, persistent)Config schema (
pkg/config/)Four path categories:
must_block— readdir + open must be denied (Landlock/DAC enforcement check)must_read— readdir must succeed (system tooling reachable)must_readwrite— readdir + write must succeed (active workspace)audit— all four ops probed, no pass/fail (informational)Per-entry fields:
path,label,severity(critical/error/warn),reason,check_files(per-file open=denied inside a dir),check_ops(override which ops are tested),stat_may_fail,note.Findings
custom_path_violation— a must_* expectation was not metcustom_path_audit— audit-only observation (stat/readdir/open/write state)Each finding includes path, label, op, severity, expected, got, and message.
Example config
tests/example/alice-sandbox.yaml— a complete boundary spec for an AI agent user, declaring which host paths must be blocked (SSH keys, AWS creds, kubeconfig, host source tree) and which must be accessible (system tooling,/tmp, agent workspace).Testing
Validated end-to-end with nono + Landlock active:
must_blockcredential paths: readdir + open correctly denied under sandbox/tmpgrant working after explicit path in nono profile patch--configYAML parsed only byconfig.LoadConfig(), not fed to viperFiles changed
pkg/config/config.goLoadConfig()with validationpkg/config/config_test.goalice-sandbox.yamlpkg/tasks/baseline/custom_paths.goCheckCustomPaths()runnerpkg/tasks/custom_paths_task.goTaskinterface wrappercmd/cmd.go--configpersistent flag; viper isolation fixcmd/scan.gotests/example/Windows support
Removed the Windows early-return stub from
scanTargetedPathsForHome(). Sensitive paths and system write paths are now split into platform functions (filesystem_unix.go/filesystem_windows.go), so the scanner runs real credential detection on all three platforms.