Skip to content

Commit f37da23

Browse files
committed
chore: merge main into docker-podman-volumes
2 parents 08b333d + 3a4463e commit f37da23

62 files changed

Lines changed: 5151 additions & 1247 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ ocsf_emit!(event);
160160
- Always use [Conventional Commits](https://www.conventionalcommits.org/) format for commit messages
161161
- Format: `<type>(<scope>): <description>` (scope is optional)
162162
- Common types: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `ci`, `perf`
163+
- Sign each commit for DCO compliance (`git commit -s`, or include a `Signed-off-by: Name <email>` trailer)
163164
- Never mention Claude or any AI agent in commits (no author attribution, no Co-Authored-By, no references in commit messages)
164165

165166
## Pre-commit

‎architecture/compute-runtimes.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ Docker and Podman also accept per-sandbox driver-config mounts for existing
4444
runtime-managed named volumes and tmpfs mounts. Podman additionally accepts
4545
image mounts through its image-volume API. User-supplied host bind mounts are
4646
available only when explicitly enabled in the active local driver table of
47-
`gateway.toml`; driver-owned supervisor, token, and TLS bind mounts stay
48-
reserved.
47+
`gateway.toml`. Host bind mounts are an unsafe operator override because they
48+
place gateway-host filesystem state inside the sandbox and can negate OpenShell
49+
workspace isolation and filesystem-policy controls. Driver-owned supervisor,
50+
token, and TLS bind mounts stay reserved.
4951

5052
Kubernetes deployments may set an AppArmor profile on sandbox agent containers
5153
through the driver configuration. The Helm chart defaults sandbox agents to

‎crates/openshell-cli/src/auth.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ pub async fn browser_auth_flow(gateway_endpoint: &str) -> Result<String> {
102102
));
103103
}
104104

105+
#[cfg(test)]
106+
if std::env::var("OPENSHELL_TEST_BROWSER_AUTH_FAIL")
107+
.is_ok_and(|v| v == "1" || v.eq_ignore_ascii_case("true"))
108+
{
109+
return Err(miette::miette!(
110+
"browser authentication failed (OPENSHELL_TEST_BROWSER_AUTH_FAIL is set)"
111+
));
112+
}
113+
105114
let listener = TcpListener::bind("127.0.0.1:0").await.into_diagnostic()?;
106115
let local_addr = listener.local_addr().into_diagnostic()?;
107116
let callback_port = local_addr.port();

‎crates/openshell-cli/src/lib.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub mod auth;
1212
pub mod completers;
1313
pub mod edge_tunnel;
1414
pub mod oidc_auth;
15+
pub mod output;
1516
pub(crate) mod policy_update;
1617
pub mod run;
1718
pub mod ssh;

‎crates/openshell-cli/src/main.rs‎

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,10 @@ enum SandboxCommands {
12751275
#[arg(long = "label")]
12761276
labels: Vec<String>,
12771277

1278+
/// Environment variables to inject into the sandbox (KEY=VALUE format, repeatable).
1279+
#[arg(long = "env", value_name = "KEY=VALUE")]
1280+
envs: Vec<String>,
1281+
12781282
/// Approval mode for agent-authored policy proposals.
12791283
///
12801284
/// `manual` (default): every proposal lands in the draft inbox for
@@ -1381,6 +1385,10 @@ enum SandboxCommands {
13811385
#[arg(long, overrides_with = "tty")]
13821386
no_tty: bool,
13831387

1388+
/// Environment variables to set for the command (KEY=VALUE format, repeatable).
1389+
#[arg(long = "env", value_name = "KEY=VALUE")]
1390+
envs: Vec<String>,
1391+
13841392
/// Command and arguments to execute.
13851393
#[arg(required = true, trailing_var_arg = true, allow_hyphen_values = true)]
13861394
command: Vec<String>,
@@ -2558,6 +2566,7 @@ async fn main() -> Result<()> {
25582566
auto_providers,
25592567
no_auto_providers,
25602568
labels,
2569+
envs,
25612570
approval_mode,
25622571
command,
25632572
} => {
@@ -2592,6 +2601,9 @@ async fn main() -> Result<()> {
25922601
labels_map.insert(parts[0].to_string(), parts[1].to_string());
25932602
}
25942603

2604+
// Parse --env flags into a HashMap<String, String>.
2605+
let env_map = run::parse_env_pairs(&envs)?;
2606+
25952607
// Parse --upload specs into [(local_path, sandbox_path, git_ignore)].
25962608
let upload_specs: Vec<(String, Option<String>, bool)> = upload
25972609
.iter()
@@ -2639,6 +2651,7 @@ async fn main() -> Result<()> {
26392651
tty_override,
26402652
auto_providers_override,
26412653
&labels_map,
2654+
&env_map,
26422655
&approval_mode,
26432656
&tls,
26442657
))
@@ -2664,20 +2677,26 @@ async fn main() -> Result<()> {
26642677
let dest_display = sandbox_dest.unwrap_or("~");
26652678
eprintln!("Uploading {} -> sandbox:{}", local.display(), dest_display);
26662679
if !no_git_ignore && let Ok((base_dir, files)) = run::git_sync_files(local) {
2667-
run::sandbox_sync_up_files(
2668-
&ctx.endpoint,
2669-
&name,
2670-
&base_dir,
2671-
&files,
2672-
local,
2673-
sandbox_dest,
2674-
&tls,
2675-
)
2676-
.await?;
2677-
eprintln!("{} Upload complete", "✓".green().bold());
2678-
return Ok(());
2680+
if !files.is_empty() {
2681+
run::sandbox_sync_up_files(
2682+
&ctx.endpoint,
2683+
&name,
2684+
&base_dir,
2685+
&files,
2686+
local,
2687+
sandbox_dest,
2688+
&tls,
2689+
)
2690+
.await?;
2691+
eprintln!("{} Upload complete", "✓".green().bold());
2692+
return Ok(());
2693+
}
2694+
eprintln!(
2695+
"{} .gitignore filtering excluded all files in {}; uploading unfiltered",
2696+
"⚠".yellow().bold(),
2697+
local.display(),
2698+
);
26792699
}
2680-
// Fallback: upload without git filtering
26812700
run::sandbox_sync_up(&ctx.endpoint, &name, local, sandbox_dest, &tls).await?;
26822701
eprintln!("{} Upload complete", "✓".green().bold());
26832702
}
@@ -2751,6 +2770,7 @@ async fn main() -> Result<()> {
27512770
timeout,
27522771
tty,
27532772
no_tty,
2773+
envs,
27542774
command,
27552775
} => {
27562776
let name = resolve_sandbox_name(name, &ctx.name)?;
@@ -2762,13 +2782,15 @@ async fn main() -> Result<()> {
27622782
} else {
27632783
None // auto-detect
27642784
};
2785+
let env_map = run::parse_env_pairs(&envs)?;
27652786
let exit_code = run::sandbox_exec_grpc(
27662787
endpoint,
27672788
&name,
27682789
&command,
27692790
workdir.as_deref(),
27702791
timeout,
27712792
tty_override,
2793+
&env_map,
27722794
&tls,
27732795
)
27742796
.await?;

0 commit comments

Comments
 (0)