Network policy layer for devcontainers — Cedar policy for outbound HTTP access with a container-scoped observe-then-enforce workflow. Rust + Tokio.
cargo test --all-features # run all tests
cargo clippy --all-features -- -D warnings # lint (warnings are errors)
cargo fmt --check # check formatting
cargo build --release # release build (stripped, LTO)The CI workflow (.github/workflows/ci.yml) runs on every PR and push to main:
- test job:
cargo test,cargo clippy -D warnings,cargo fmt --check - build job: cross-platform release builds (x86_64/aarch64 for Linux and macOS)
The test job is a required status check on main — PRs cannot merge until it passes.
Note: the file list below reflects the current codebase (host-side proxy +
in-container gateway). The in-container rewrite (docs/designs/in-container- rewrite.md) will delete several of these (launch.rs, container.rs) and
split the proxy into a new strait-agent crate. Update this section as the
rewrite lands.
src/main.rs-- CLI entry point (clap):proxy,launch,init,generate,test,watch,explain,diff,templatesubcommandssrc/config.rs— unified TOML config (strait.toml) parsingsrc/ca.rs— session-local CA cert generation (rcgen)src/policy.rs— Cedar policy engine for HTTP actions, URL-derived resource hierarchy, and per-request evaluationsrc/credentials.rs— credential store: bearer tokens and AWS SigV4, env-var source, header injectionsrc/sigv4.rs— AWS Signature Version 4 request signingsrc/mitm.rs— TLS termination, HTTP/1.1 keep-alive, request parsing, policy eval, credential injection, upstream forwardingsrc/audit.rs— structured JSON audit logging (session ID, decisions, latency)src/container.rs— Docker/Podman container management via bollard: lifecycle, gateway wiring, and CA trust injectionsrc/launch.rs—strait launchorchestrator: observe/warn/enforce modes, proxy + container coordinationsrc/observe.rs— observation pipeline: JSONL file + Unix socket streaming, versioned event schemasrc/watch.rs—strait watchcolored real-time event viewersrc/generate.rs— Cedar policy generation from observations, wildcard collapsingsrc/replay.rs—strait test --replaypolicy verification against observationssrc/explain.rs— human-readable Cedar policy summariessrc/diff.rs— semantic Cedar policy diffinghost/src/templates.rs— built-in network policy templates (GitHub, AWS, container sandbox)host/src/presets.rs— devcontainer presets + server-side policy preset library (container sessions opt in viaRegisterContainer.preset_ids)src/health.rs— health check HTTP endpointtests/integration.rs— loopback integration tests (TLS echo server, no network)tests/launch_integration.rs— Docker-based container lifecycle tests
See docs/designs/devcontainer-strategy.md for the current architecture and
docs/designs/in-container-rewrite.md for the Phase 1-4 plan moving the data
plane from host to in-container. The bullets below reflect the target state.
- Container-based sandboxing -- Docker/Podman/OrbStack. Not kernel sandboxes (ESF, Seatbelt). Ships cross-platform, no special OS permissions.
- Cedar over OPA -- sub-ms evaluation, embeddable, no sidecar process.
- Network-only Cedar model --
Action::"http:GET",Action::"http:POST",Action::"http:DELETE"govern outbound HTTP policy. - Data plane inside the container, control plane on the host -- the MITM
proxy runs as root inside the container; the agent runs as a non-root user.
The host runs
strait-host, which owns rules, decisions, credentials, and the desktop UI, and serves many containers at once. - iptables REDIRECT at entrypoint -- the container entrypoint installs
iptables rules that redirect all outbound TCP to the local proxy, then drops
privileges. No
HTTPS_PROXYenv var, no bypass path for tools that ignore proxy conventions. - Session-local CA -- new CA cert generated on each startup by the in-container proxy. Trust injection happens entirely inside the container.
- Credential injection on allow only -- credentials live on the host. On allow, the in-container proxy fetches the credential over gRPC and injects it into the outbound request. Never persisted in the container.
- Observe-then-enforce workflow --
--observe->generate->--warn->--policy. Solves policy paralysis. - No container orchestration in strait --
strait launchis removed. Install via the devcontainer feature or bring-your-own-sandbox (sandcastle, hand-rolled Docker, Podman). Users keep the orchestration tool they already use; strait is the policy layer on top. - General-purpose tool -- not ninthwave-specific. Standalone binary, separate repo.
- Conventional commits:
feat:,fix:,refactor:,test:,docs:,chore: - Rust 2021 edition, stable toolchain
- All clippy warnings treated as errors
cargo fmtenforced in CI- Integration tests use loopback TCP/TLS (no external network access)
- Launch integration tests require Docker
- Test helpers use a
NoVerifycert verifier for echo server connections only - Tracing via
tracingcrate, structured JSON to stderr - No AI slop signals in user-facing text (em dashes, flowery language). Keep prose direct and plain.