Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions architecture/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ All paths are relative to `crates/openshell-sandbox/src/`.
| `l7/tls.rs` | Ephemeral CA generation (`SandboxCa`), per-hostname leaf cert cache (`CertCache`), TLS termination/connection helpers, `looks_like_tls()` auto-detection |
| `l7/relay.rs` | Protocol-aware bidirectional relay with per-request OPA evaluation, credential-injection-only passthrough relay |
| `l7/rest.rs` | HTTP/1.1 request/response parsing, body framing (Content-Length, chunked), deny response generation |
| `l7/path.rs` | Request-target canonicalization: percent-decoding, dot-segment resolution, `;params` stripping, encoded-slash policy. Single source of truth for the path both OPA evaluates and the upstream receives. |
| `l7/provider.rs` | `L7Provider` trait and `L7Request`/`BodyLength` types |
| `secrets.rs` | `SecretResolver` credential placeholder system — placeholder generation, multi-location rewriting (headers, query params, path segments, Basic auth), fail-closed scanning, secret validation, percent-encoding |

Expand Down
7 changes: 7 additions & 0 deletions crates/openshell-sandbox/data/sandbox-policy.rego
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ method_matches(actual, expected) if {
}

# Path matching: "**" matches everything; otherwise glob.match with "/" delimiter.
#
# INVARIANT: `input.request.path` is canonicalized by the sandbox before
# policy evaluation — percent-decoded, dot-segments resolved, doubled
# slashes collapsed, `;params` stripped, `%2F` rejected (unless an
# endpoint opts in). Patterns here must therefore match canonical paths;
# do not attempt defensive matching against `..` or `%2e%2e` — those
# inputs are rejected at the L7 parser boundary before this rule runs.
path_matches(_, "**") if true

path_matches(actual, pattern) if {
Expand Down
1 change: 1 addition & 0 deletions crates/openshell-sandbox/src/l7/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! evaluated against OPA policy, and either forwarded or denied.

pub mod inference;
pub mod path;
pub mod provider;
pub mod relay;
pub mod rest;
Expand Down
Loading
Loading