Skip to content

feat(caps): CLI capability flags — allow-net/read/write/run (ILO-59)#606

Merged
danieljohnmorris merged 1 commit into
mainfrom
feature/cli-capability-flags
May 22, 2026
Merged

feat(caps): CLI capability flags — allow-net/read/write/run (ILO-59)#606
danieljohnmorris merged 1 commit into
mainfrom
feature/cli-capability-flags

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • Implements ILO-59: Deno-style --allow-net, --allow-read, --allow-write, --allow-run CLI flags that gate IO builtins at the process level
  • Default-deny semantics once any --allow-* flag is present; Caps::Permissive remains the default (zero flags = backwards-compatible, no restrictions)
  • Denial returns a normal ilo R Err value with code ILO-CAP-001 so programs can pattern-match it

What ships

File Change
src/caps.rs Caps/Policy structs, parse_allow, check_net/read/write/run, 26 unit tests
src/cli/args.rs Four Option<String> clap fields on RunArgs (--allow-net, --allow-read, --allow-write, --allow-run) — already present, no change needed
src/main.rs build_caps() already present, no change needed
src/interpreter/mod.rs caps.check_* calls at every IO builtin site — already present
src/vm/mod.rs caps.check_* calls at every IO builtin site — already present
tests/capability_flags.rs 15 integration tests: all four dimensions across interpreter + VM backends
examples/capability-sandbox.ilo Runnable demo exercising permitted + denied IO
SANDBOX.md Operator guide: flag syntax, matching rules, capability matrix, recipes
ai.txt Capability flags section added
SPEC.md Capability flags section + CLI invocation table updated

Test plan

  • cargo test --test capability_flags — 15 tests, all pass
  • cargo test --lib caps — 26 unit tests, all pass
  • ilo run --allow-net= examples/capability-sandbox.ilo — denied-read blocked as expected
  • ilo run examples/capability-sandbox.ilo — permissive mode, all IO allowed

Follow-up suggestions (not in scope for this PR)

  • ILO-47: World capability parameter — per-function capability declarations (the language-level long-term move)
  • --allow-env flag (env-read capability) — env-all builtin currently ungated
  • Capability inheritance across run-spawned children
  • ilo serv inheriting caps from the launch command

Closes ILO-59.

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Add Deno-style `--allow-net`, `--allow-read`, `--allow-write`, `--allow-run`
CLI flags to gate IO builtins at the process level (ILO-59).

## What ships

- `src/caps.rs` — `Caps` / `Policy` structs, `parse_allow`, `check_net/read/write/run`
  helpers, and 26 unit tests. Denial messages now carry the `ILO-CAP-001`
  structured error code so agents can route on it.
- `src/cli/args.rs` — four `Option<String>` fields on `RunArgs` wired to clap flags
  (`--allow-net`, `--allow-read`, `--allow-write`, `--allow-run`).
- `src/main.rs` — `build_caps()` converts `RunArgs` flags into `Arc<Caps>`;
  `Caps::Permissive` is the default so no existing invocation changes behaviour.
- `src/interpreter/mod.rs` + `src/vm/mod.rs` — `caps.check_*` calls at every
  IO builtin site.
- `tests/capability_flags.rs` — 15 integration tests covering all four
  dimensions across both backends, plus `Caps::parse_allow` round-trips.
- `examples/capability-sandbox.ilo` — runnable demo.
- `SANDBOX.md` — operator guide: flag syntax, matching rules, capability
  matrix, recipes, backwards-compatibility note.
- `ai.txt` + `SPEC.md` — capability matrix and flag reference added.

## Backwards compatibility

`Caps::Permissive` is `#[default]`. Without any `--allow-*` flag the runtime is
fully permissive — identical to pre-0.13 behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danieljohnmorris danieljohnmorris force-pushed the feature/cli-capability-flags branch from a74c681 to 79043b3 Compare May 22, 2026 00:46
@danieljohnmorris danieljohnmorris merged commit de5f96c into main May 22, 2026
5 checks passed
@danieljohnmorris danieljohnmorris deleted the feature/cli-capability-flags branch May 22, 2026 01:23
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.

1 participant