From 2ad86c1b2e3e81a26e0fd38ec860398acb31f2fc Mon Sep 17 00:00:00 2001 From: Jesse Jaggars Date: Tue, 8 Sep 2026 15:37:26 +0000 Subject: [PATCH 1/3] fix(cli): fail closed when OIDC refresh fails (#2817) * fix(cli): fail closed when OIDC refresh fails Signed-off-by: Jesse Jaggars * fix(cli): fall back to unexpired OIDC token on refresh failure Signed-off-by: Jesse Jaggars --------- Signed-off-by: Jesse Jaggars --- crates/openshell-bootstrap/src/oidc_token.rs | 39 ++++ crates/openshell-cli/src/main.rs | 64 +++--- .../sandbox_create_lifecycle_integration.rs | 184 +++++++++++++++++- docs/reference/gateway-auth.mdx | 2 +- skills/openshell-cli/SKILL.md | 2 +- 5 files changed, 255 insertions(+), 36 deletions(-) diff --git a/crates/openshell-bootstrap/src/oidc_token.rs b/crates/openshell-bootstrap/src/oidc_token.rs index f21a115c80..282d2ddeca 100644 --- a/crates/openshell-bootstrap/src/oidc_token.rs +++ b/crates/openshell-bootstrap/src/oidc_token.rs @@ -124,6 +124,21 @@ pub fn is_token_expired(bundle: &OidcTokenBundle) -> bool { now + 30 >= expires_at } +/// Check whether the stored access token has actually expired. +/// +/// Unlike [`is_token_expired`], this does not include the 30-second refresh +/// window. Tokens without expiry metadata are treated as valid. +pub fn is_token_actually_expired(bundle: &OidcTokenBundle) -> bool { + let Some(expires_at) = bundle.expires_at else { + return false; + }; + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_secs(); + now >= expires_at +} + #[cfg(test)] mod tests { use super::*; @@ -163,6 +178,30 @@ mod tests { }); } + #[test] + fn expiry_checks_distinguish_refresh_window_from_actual_expiry() { + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_secs(); + let bundle = OidcTokenBundle { + access_token: "token".to_string(), + refresh_token: None, + expires_at: Some(now + 10), + issuer: "https://issuer.example.com".to_string(), + client_id: "openshell-cli".to_string(), + }; + + assert!(is_token_expired(&bundle)); + assert!(!is_token_actually_expired(&bundle)); + + let expired = OidcTokenBundle { + expires_at: Some(now.saturating_sub(1)), + ..bundle + }; + assert!(is_token_actually_expired(&expired)); + } + #[test] fn oidc_login_prompt_marker_is_per_gateway() { let tmp = tempfile::tempdir().unwrap(); diff --git a/crates/openshell-cli/src/main.rs b/crates/openshell-cli/src/main.rs index befac54759..2af5b92b25 100644 --- a/crates/openshell-cli/src/main.rs +++ b/crates/openshell-cli/src/main.rs @@ -156,8 +156,11 @@ fn resolve_gateway_name(gateway_flag: &Option) -> Option { /// Handles Cloudflare Access and OIDC auth modes by loading the stored token /// and setting it on `TlsOptions`. For OIDC, automatically refreshes the token /// if it's near expiry. -fn apply_auth(tls: &mut TlsOptions, gateway_name: &str) { - let _ = apply_auth_with_status(tls, gateway_name); +fn apply_auth(tls: &mut TlsOptions, gateway_name: &str) -> Result<()> { + if let Some(error) = apply_auth_with_status(tls, gateway_name) { + return Err(miette::miette!(error)); + } + Ok(()) } /// Apply stored authentication and return a user-facing preparation failure, @@ -206,12 +209,17 @@ fn apply_auth_with_status(tls: &mut TlsOptions, gateway_name: &str) -> Option { tracing::warn!("OIDC token refresh failed: {e}"); - // Use the expired token anyway — server will reject it - // with a clear error prompting re-login. - tls.oidc_token = Some(bundle.access_token); - Some(format!( - "OIDC token refresh failed; run `openshell gateway login {gateway_name}`" - )) + if openshell_bootstrap::oidc_token::is_token_actually_expired(&bundle) { + Some(format!( + "OIDC token refresh failed: {e}\ncached OIDC token has expired; run `openshell gateway login {gateway_name}`" + )) + } else { + tls.oidc_token = Some(bundle.access_token); + eprintln!( + "Warning: OIDC token refresh failed; continuing with the cached token: {e}" + ); + None + } } } } else { @@ -2506,7 +2514,7 @@ async fn run_async() -> Result<()> { GatewayCommands::Info { output } => { if let Ok(ctx) = resolve_gateway(&cli.gateway, &cli.gateway_endpoint) { let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; run::gateway_info(&ctx.name, &ctx.endpoint, &tls, output.as_str()).await?; } else { run::gateway_info_not_configured()?; @@ -2574,7 +2582,7 @@ async fn run_async() -> Result<()> { Some(Commands::Whoami { output }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; run::whoami(&ctx.endpoint, &tls, output.as_str()).await?; } @@ -2677,7 +2685,7 @@ async fn run_async() -> Result<()> { } => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let name = resolve_sandbox_name(name, &ctx.name, &cli.workspace)?; let local = local.unwrap_or_else(|| target_port.to_string()); run::service_forward_tcp( @@ -2699,7 +2707,7 @@ async fn run_async() -> Result<()> { let spec = openshell_core::forward::ForwardSpec::parse(&port)?; let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let name = resolve_sandbox_name(name, &ctx.name, &cli.workspace)?; run::sandbox_forward( &ctx.endpoint, @@ -2730,7 +2738,7 @@ async fn run_async() -> Result<()> { }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match command { ServiceCommands::Expose { sandbox, @@ -2792,7 +2800,7 @@ async fn run_async() -> Result<()> { }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let name = resolve_sandbox_name(name, &ctx.name, &cli.workspace)?; run::sandbox_logs( &ctx.endpoint, @@ -2816,7 +2824,7 @@ async fn run_async() -> Result<()> { }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match policy_cmd { PolicyCommands::Set { name, @@ -2970,7 +2978,7 @@ async fn run_async() -> Result<()> { }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match settings_cmd { SettingsCommands::Get { name, global, json } => { @@ -3049,7 +3057,7 @@ async fn run_async() -> Result<()> { }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match draft_cmd { DraftCommands::Get { name, status } => { let name = resolve_sandbox_name(name, &ctx.name, &cli.workspace)?; @@ -3124,7 +3132,7 @@ async fn run_async() -> Result<()> { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let endpoint = &ctx.endpoint; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match command { InferenceCommands::Set { provider, @@ -3275,7 +3283,7 @@ async fn run_async() -> Result<()> { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let endpoint = &ctx.endpoint; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let exit_code = Box::pin(run::sandbox_create( endpoint, &ctx.name, @@ -3318,7 +3326,7 @@ async fn run_async() -> Result<()> { } => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let local = std::path::Path::new(&local_path); run::sandbox_upload( &ctx.endpoint, @@ -3338,7 +3346,7 @@ async fn run_async() -> Result<()> { } => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let local_dest = dest.as_deref().unwrap_or("."); eprintln!("Downloading sandbox:{sandbox_path} -> {local_dest}"); run::sandbox_sync_down( @@ -3356,7 +3364,7 @@ async fn run_async() -> Result<()> { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let endpoint = &ctx.endpoint; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match other { SandboxCommands::Create { .. } | SandboxCommands::Upload { .. } @@ -3615,7 +3623,7 @@ async fn run_async() -> Result<()> { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let endpoint = &ctx.endpoint; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match command { WorkspaceCommands::Create { name, labels } => { @@ -3681,7 +3689,7 @@ async fn run_async() -> Result<()> { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let endpoint = &ctx.endpoint; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; match command { ProviderCommands::Create { @@ -3896,7 +3904,7 @@ async fn run_async() -> Result<()> { Some(Commands::Term { theme }) => { let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?; let mut tls = tls.with_gateway_name(&ctx.name); - apply_auth(&mut tls, &ctx.name); + apply_auth(&mut tls, &ctx.name)?; let channel = openshell_cli::tls::build_channel(&ctx.endpoint, &tls).await?; let interceptor = openshell_core::auth::EdgeAuthInterceptor::new( tls.oidc_token.as_deref(), @@ -3940,7 +3948,7 @@ async fn run_async() -> Result<()> { None => tls, }; if let Some(ref g) = gateway_name_opt { - apply_auth(&mut effective_tls, g); + apply_auth(&mut effective_tls, g)?; } run::sandbox_ssh_proxy(&gw, &sid, &tok, &effective_tls).await?; } @@ -3959,7 +3967,7 @@ async fn run_async() -> Result<()> { meta.gateway_endpoint }; let mut tls = tls.with_gateway_name(&g); - apply_auth(&mut tls, &g); + apply_auth(&mut tls, &g)?; run::sandbox_ssh_proxy_by_name(&endpoint, &n, &tls, &cli.workspace).await?; } // Legacy name mode with --server only (no --gateway-name). @@ -4645,7 +4653,7 @@ mod tests { store_edge_token("edge-gateway", "token-123").unwrap(); let mut tls = TlsOptions::default(); - apply_auth(&mut tls, "edge-gateway"); + apply_auth(&mut tls, "edge-gateway").unwrap(); assert_eq!(tls.edge_token.as_deref(), Some("token-123")); }); diff --git a/crates/openshell-cli/tests/sandbox_create_lifecycle_integration.rs b/crates/openshell-cli/tests/sandbox_create_lifecycle_integration.rs index 7be771c442..3c48cdfc8d 100644 --- a/crates/openshell-cli/tests/sandbox_create_lifecycle_integration.rs +++ b/crates/openshell-cli/tests/sandbox_create_lifecycle_integration.rs @@ -38,6 +38,7 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::time::{Duration, Instant}; use tempfile::TempDir; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpListener; use tokio::sync::{Mutex, mpsc}; use tokio_stream::wrappers::TcpListenerStream; @@ -2571,18 +2572,20 @@ async fn sandbox_create_env_rejects_invalid_key_name() { ); } -async fn run_cli_sandbox_create( - server: &TestServer, - name: &str, - extra_args: &[&str], -) -> std::process::Output { - let xdg_dir = tempfile::tempdir().unwrap(); +fn prepare_cli_xdg(server: &TestServer, xdg_dir: &TempDir) { let tls_dir = xdg_dir.path().join("openshell/gateways/openshell/mtls"); fs::create_dir_all(&tls_dir).unwrap(); for filename in ["ca.crt", "tls.crt", "tls.key"] { fs::copy(server.dir.path().join(filename), tls_dir.join(filename)).unwrap(); } +} +async fn run_cli_sandbox_create_with_xdg( + server: &TestServer, + xdg_dir: &TempDir, + name: &str, + extra_args: &[&str], +) -> std::process::Output { let mut cmd = tokio::process::Command::new(env!("CARGO_BIN_EXE_openshell")); for (key, _) in std::env::vars().filter(|(k, _)| k.starts_with("OPENSHELL_")) { cmd.env_remove(&key); @@ -2608,6 +2611,16 @@ async fn run_cli_sandbox_create( .unwrap() } +async fn run_cli_sandbox_create( + server: &TestServer, + name: &str, + extra_args: &[&str], +) -> std::process::Output { + let xdg_dir = tempfile::tempdir().unwrap(); + prepare_cli_xdg(server, &xdg_dir); + run_cli_sandbox_create_with_xdg(server, &xdg_dir, name, extra_args).await +} + async fn run_cli_sandbox_template_create( server: &TestServer, name: &str, @@ -2646,6 +2659,165 @@ async fn run_cli_sandbox_template_create( .unwrap() } +async fn run_rejected_oidc_refresh_server() -> String { + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); + let issuer = format!("http://{}", listener.local_addr().unwrap()); + let task_issuer = issuer.clone(); + + tokio::spawn(async move { + loop { + let Ok((mut stream, _)) = listener.accept().await else { + return; + }; + let issuer = task_issuer.clone(); + tokio::spawn(async move { + let mut request = vec![0; 8192]; + let Ok(read) = stream.read(&mut request).await else { + return; + }; + let request = String::from_utf8_lossy(&request[..read]); + let (status, body) = + if request.starts_with("GET /.well-known/openid-configuration ") { + ( + "200 OK", + serde_json::json!({ + "issuer": issuer, + "authorization_endpoint": format!("{issuer}/authorize"), + "token_endpoint": format!("{issuer}/token"), + }) + .to_string(), + ) + } else if request.starts_with("POST /token ") { + ( + "400 Bad Request", + serde_json::json!({ + "error": "invalid_grant", + "error_description": "Token is not active", + }) + .to_string(), + ) + } else { + ("404 Not Found", "{}".to_string()) + }; + let response = format!( + "HTTP/1.1 {status}\r\nContent-Type: application/json\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{body}", + body.len(), + ); + let _ = stream.write_all(response.as_bytes()).await; + }); + } + }); + + issuer +} + +fn write_oidc_test_credentials( + server: &TestServer, + xdg_dir: &TempDir, + issuer: &str, + expires_at: u64, +) { + let gateway_dir = xdg_dir.path().join("openshell/gateways/openshell"); + fs::write( + gateway_dir.join("metadata.json"), + serde_json::to_vec_pretty(&openshell_bootstrap::GatewayMetadata { + name: "openshell".to_string(), + gateway_endpoint: server.endpoint.clone(), + auth_mode: Some("oidc".to_string()), + oidc_issuer: Some(issuer.to_string()), + oidc_client_id: Some("openshell-cli".to_string()), + ..Default::default() + }) + .unwrap(), + ) + .unwrap(); + fs::write( + gateway_dir.join("oidc_token.json"), + serde_json::to_vec_pretty(&openshell_bootstrap::oidc_token::OidcTokenBundle { + access_token: "cached-access-token".to_string(), + refresh_token: Some("inactive-refresh-token".to_string()), + expires_at: Some(expires_at), + issuer: issuer.to_string(), + client_id: "openshell-cli".to_string(), + }) + .unwrap(), + ) + .unwrap(); +} + +/// Models the gateway's JWT-expiration leeway by using a test gateway that +/// still accepts the stale bearer. Before the CLI failed closed, the rejected +/// refresh was only logged and `CreateSandbox` reached this gateway anyway. +#[tokio::test] +async fn sandbox_create_fails_before_mutation_when_expired_oidc_refresh_is_rejected() { + let server = run_server().await; + let issuer = run_rejected_oidc_refresh_server().await; + let xdg_dir = tempfile::tempdir().unwrap(); + prepare_cli_xdg(&server, &xdg_dir); + + write_oidc_test_credentials(&server, &xdg_dir, &issuer, 0); + + let result = run_cli_sandbox_create_with_xdg( + &server, + &xdg_dir, + "must-not-be-created", + &["--output=json"], + ) + .await; + + assert!( + !result.status.success(), + "refresh failure must abort create" + ); + let stderr = String::from_utf8_lossy(&result.stderr); + assert!( + stderr.contains("invalid_grant"), + "unexpected error: {stderr}" + ); + assert!( + stderr.contains("openshell gateway login openshell"), + "error should explain how to re-authenticate: {stderr}" + ); + assert!( + create_requests(&server).await.is_empty(), + "CreateSandbox must not be called after OIDC refresh fails" + ); +} + +#[tokio::test] +async fn sandbox_create_continues_with_unexpired_cached_token_when_refresh_fails() { + let server = run_server().await; + let issuer = run_rejected_oidc_refresh_server().await; + let xdg_dir = tempfile::tempdir().unwrap(); + prepare_cli_xdg(&server, &xdg_dir); + let expires_at = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_secs() + + 20; + write_oidc_test_credentials(&server, &xdg_dir, &issuer, expires_at); + + let result = + run_cli_sandbox_create_with_xdg(&server, &xdg_dir, "uses-cached-token", &["--output=json"]) + .await; + + assert!( + result.status.success(), + "sandbox create should continue with an unexpired cached token:\n{}", + String::from_utf8_lossy(&result.stderr) + ); + let stderr = String::from_utf8_lossy(&result.stderr); + assert!( + stderr.contains("continuing with the cached token"), + "refresh fallback warning should be visible: {stderr}" + ); + assert_eq!( + create_requests(&server).await.len(), + 1, + "CreateSandbox should be reached with the cached token" + ); +} + #[tokio::test] async fn sandbox_create_json_stdout_is_parseable() { let server = run_server().await; diff --git a/docs/reference/gateway-auth.mdx b/docs/reference/gateway-auth.mdx index ebfd5c7cbc..dadde9927e 100644 --- a/docs/reference/gateway-auth.mdx +++ b/docs/reference/gateway-auth.mdx @@ -180,7 +180,7 @@ The connection flow: For a headless environment, set `OPENSHELL_NO_BROWSER=1` before registering or logging in to the gateway. When this variable is set and `OPENSHELL_OIDC_CLIENT_SECRET` is not configured, the CLI uses the Device Authorization Grant (RFC 8628) with S256 PKCE. This flow prompts the user to visit a verification URL on any device with a browser and enter a displayed code. The CLI polls the token endpoint until the user completes authorization. This requires the OIDC client to have the device authorization grant enabled on the identity provider. 1. The CLI loads the stored OIDC token bundle. -2. If the access token is expired and a refresh token is available, the CLI refreshes it with the OIDC scopes saved in the gateway metadata. +2. If the access token is expired or near expiry, the CLI refreshes it with the OIDC scopes saved in the gateway metadata. If refresh fails, the command stops before sending a protected request and directs you to run `openshell gateway login `. 3. The CLI connects to the gateway and attaches `authorization: Bearer ` metadata to each gRPC request. 4. The gateway validates the JWT signature, issuer, audience, expiration, subject, and key ID against the issuer's JWKS. 5. The gateway extracts roles and optional scopes from the configured claim paths. diff --git a/skills/openshell-cli/SKILL.md b/skills/openshell-cli/SKILL.md index c46f569789..e080fd4001 100644 --- a/skills/openshell-cli/SKILL.md +++ b/skills/openshell-cli/SKILL.md @@ -744,7 +744,7 @@ openshell gateway add https://gateway.example.com --name production openshell gateway remove local ``` -`https://` registrations default to edge authentication. Use `gateway login` and `gateway logout` to refresh or clear stored authentication. For an OIDC gateway, supply `--oidc-issuer` and, when needed, `--oidc-client-id`, `--oidc-audience`, and `--oidc-scopes`. For remote mTLS gateways, use `--remote USER@HOST` or an `ssh://` endpoint. +`https://` registrations default to edge authentication. Use `gateway login` and `gateway logout` to refresh or clear stored authentication. For an OIDC gateway, supply `--oidc-issuer` and, when needed, `--oidc-client-id`, `--oidc-audience`, and `--oidc-scopes`. If automatic OIDC refresh fails, protected commands stop before sending an RPC and direct the user to run `openshell gateway login `; `openshell status` still reports gateway reachability and authentication separately. For remote mTLS gateways, use `--remote USER@HOST` or an `ssh://` endpoint. For one-off automation, `--gateway-endpoint URL` connects directly without stored metadata. Limit `--gateway-insecure` to explicitly trusted development endpoints. From e1084e19db622fd1134454d3b589aab2022aaddf Mon Sep 17 00:00:00 2001 From: Shiju Date: Tue, 8 Sep 2026 17:02:29 +0000 Subject: [PATCH 2/3] fix(supervisor): preserve MCP versions in runtime config (#3199) * fix(supervisor): preserve MCP versions in runtime config Carry canonical MCP version allowlists through both policy-loading paths into the supervisor's typed L7 endpoint configuration. Reject malformed, ambiguous, or cross-protocol version data during policy activation so invalid configuration cannot remove MCP inspection from a selected route. Signed-off-by: Shiju * fix(supervisor): accept mixed-case MCP version protocols Validate materialized MCP version metadata through the parsed L7 protocol so supported mixed-case spellings remain valid. Cover YAML and protobuf ingress with pinned-default regression tests. Signed-off-by: Shiju --------- Signed-off-by: Shiju --- crates/openshell-policy/src/lib.rs | 25 +- .../src/l7/mod.rs | 129 ++++++++- .../src/l7/relay.rs | 4 + .../openshell-supervisor-network/src/opa.rs | 252 +++++++++++++++++- .../openshell-supervisor-network/src/proxy.rs | 3 + .../src/proxy/relay.rs | 1 + 6 files changed, 398 insertions(+), 16 deletions(-) diff --git a/crates/openshell-policy/src/lib.rs b/crates/openshell-policy/src/lib.rs index 5f3ec4e452..b2c15e4595 100644 --- a/crates/openshell-policy/src/lib.rs +++ b/crates/openshell-policy/src/lib.rs @@ -316,9 +316,9 @@ impl L7ConfigStanza { /// /// The stanza schema stays tied to this crate's canonical serde definitions, so /// adding a new supported field requires updating this conversion next to the -/// type that parses it. MCP revision fields are validated before the alias is -/// flattened so invalid authoring cannot disappear when version metadata is -/// omitted from the returned runtime-only fields. +/// type that parses it. MCP revision fields are validated and materialized +/// before the alias is flattened so both runtime ingress paths receive the +/// same canonical allowlist. pub fn l7_config_alias_runtime_fields( stanza: L7ConfigStanza, value: serde_json::Value, @@ -338,12 +338,15 @@ pub fn l7_config_alias_runtime_fields( .map_err(|error| miette::miette!("invalid mcp config: {error}"))?; validate_authored_mcp_versions(config.versions.as_deref(), "invalid mcp config")?; let McpConfigDef { - versions: _, + versions, max_body_bytes, strict_tool_names, allow_all_known_mcp_methods, } = config; + let mut versions = versions.unwrap_or_else(default_mcp_versions); + canonicalize_mcp_versions(&mut versions); let mut fields = Vec::new(); + fields.push(("mcp_versions", serde_json::json!(versions))); if max_body_bytes > 0 { fields.push(("json_rpc_max_body_bytes", serde_json::json!(max_body_bytes))); } @@ -2560,6 +2563,10 @@ network_policies: assert_eq!( fields, vec![ + ( + "mcp_versions", + serde_json::json!(["2025-03-26", "2025-06-18", "2025-11-25"]) + ), ("json_rpc_max_body_bytes", serde_json::json!(131_072)), ("mcp_strict_tool_names", serde_json::json!(false)), ("mcp_allow_all_known_mcp_methods", serde_json::json!(true)), @@ -2570,10 +2577,16 @@ network_policies: L7ConfigStanza::Mcp, serde_json::json!({"strict_tool_names": false}), ) - .expect("runtime alias parsing does not select a wire profile yet"); + .expect("runtime alias parsing supplies the pinned wire profile"); assert_eq!( runtime_only_fields, - vec![("mcp_strict_tool_names", serde_json::json!(false))] + vec![ + ( + "mcp_versions", + serde_json::json!([DEFAULT_MCP_PROTOCOL_VERSION.as_str()]) + ), + ("mcp_strict_tool_names", serde_json::json!(false)) + ] ); let err = l7_config_alias_runtime_fields( diff --git a/crates/openshell-supervisor-network/src/l7/mod.rs b/crates/openshell-supervisor-network/src/l7/mod.rs index 70a980ba2d..5e28a67a10 100644 --- a/crates/openshell-supervisor-network/src/l7/mod.rs +++ b/crates/openshell-supervisor-network/src/l7/mod.rs @@ -21,6 +21,7 @@ pub mod tls; pub(crate) mod token_grant_injection; pub(crate) mod websocket; +use openshell_core::mcp::McpProtocolVersion; pub use openshell_policy::L7Protocol; use openshell_policy::{ L7EndpointFields, validate_explicit_tcp_additional_fields, validate_l7_endpoint_semantics, @@ -119,6 +120,10 @@ pub struct L7EndpointConfig { /// MCP-only strict validation for tools/call params.name. Defaults to true /// for MCP endpoints and is ignored by other JSON-RPC-family protocols. pub mcp_strict_tool_names: bool, + /// Canonical MCP protocol revisions allowed by this endpoint. + /// + /// Non-MCP endpoints always carry an empty list. + pub mcp_versions: Vec, /// When true, percent-encoded `/` (`%2F`) is preserved in path segments /// rather than rejected at the parser. Needed by upstreams like GitLab /// that embed `%2F` in namespaced project paths. Defaults to false. @@ -172,7 +177,8 @@ pub struct L7RequestInfo { /// Parse an L7 endpoint config from a regorus Value (returned by Rego query). /// /// The value is expected to be the raw endpoint object from the Rego data, -/// containing fields: `protocol`, optionally `tls`, `enforcement`. +/// containing fields: `protocol`, optionally `tls`, `enforcement`, and the +/// canonical `mcp_versions` array for MCP endpoints. pub fn parse_l7_config(val: ®orus::Value) -> Option { let protocol_val = get_object_str(val, "protocol")?; let protocol = L7Protocol::parse(&protocol_val)?; @@ -231,6 +237,11 @@ pub fn parse_l7_config(val: ®orus::Value) -> Option { .unwrap_or(jsonrpc::DEFAULT_MAX_BODY_BYTES); let mcp_strict_tool_names = protocol == L7Protocol::Mcp && get_object_bool(val, "mcp_strict_tool_names").unwrap_or(true); + let mcp_versions = if protocol == L7Protocol::Mcp { + parse_canonical_mcp_versions(val)? + } else { + Vec::new() + }; let credential_signing = match get_object_str(val, "credential_signing").as_deref() { Some("sigv4") => CredentialSigning::SigV4, @@ -271,6 +282,7 @@ pub fn parse_l7_config(val: ®orus::Value) -> Option { graphql_max_body_bytes, json_rpc_max_body_bytes, mcp_strict_tool_names, + mcp_versions, allow_encoded_slash, websocket_credential_rewrite, request_body_credential_rewrite, @@ -402,6 +414,27 @@ fn get_object_str(val: ®orus::Value, key: &str) -> Option { } } +fn parse_canonical_mcp_versions(val: ®orus::Value) -> Option> { + let regorus::Value::Array(values) = get_object_value(val, "mcp_versions")? else { + return None; + }; + let versions = values + .iter() + .map(|value| match value { + regorus::Value::String(value) => value.parse::().ok(), + _ => None, + }) + .collect::>>()?; + + // Both policy ingress paths promise a non-empty, strictly ordered list. + // Rechecking that runtime contract prevents a dropped or corrupted + // projection from silently selecting a different wire profile. + if versions.is_empty() || !versions.windows(2).all(|pair| pair[0] < pair[1]) { + return None; + } + Some(versions) +} + fn endpoint_has_graphql_policy(val: ®orus::Value) -> bool { has_non_empty_object_field(val, "graphql_persisted_queries") || has_graphql_persisted_query_mode(val) @@ -1252,6 +1285,7 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec, Vec< "{loc}: JSON-RPC-specific endpoint fields are ignored unless protocol is json-rpc or mcp" )); } + validate_mcp_versions_field(&mut errors, &loc, ep, l7_protocol); let has_mcp_strict_tool_names = ep.get("mcp_strict_tool_names").is_some(); let has_mcp_allow_all_known_mcp_methods = ep.get("mcp_allow_all_known_mcp_methods").is_some(); @@ -1571,6 +1605,55 @@ pub fn validate_l7_policies(data_json: &serde_json::Value) -> (Vec, Vec< (errors, warnings) } +fn validate_mcp_versions_field( + errors: &mut Vec, + loc: &str, + endpoint: &serde_json::Value, + protocol: Option, +) { + let Some(value) = endpoint.get("mcp_versions") else { + return; + }; + if protocol != Some(L7Protocol::Mcp) { + errors.push(format!( + "{loc}: mcp.versions is only valid for protocol mcp" + )); + return; + } + let Some(values) = value.as_array() else { + errors.push(format!("{loc}: mcp.versions must be an array")); + return; + }; + if values.is_empty() { + errors.push(format!("{loc}: mcp.versions must not be empty")); + return; + } + + let mut versions = Vec::with_capacity(values.len()); + for value in values { + let Some(value) = value.as_str() else { + errors.push(format!("{loc}: mcp.versions entries must be strings")); + return; + }; + let Ok(version) = value.parse::() else { + errors.push(format!( + "{loc}: mcp.versions contains an unsupported protocol version" + )); + return; + }; + versions.push(version); + } + + // Runtime ingress has already normalized the allowlist. Requiring strict + // order here catches duplicates and bypasses that could otherwise fail + // later by removing L7 inspection from the selected route. + if !versions.windows(2).all(|pair| pair[0] < pair[1]) { + errors.push(format!( + "{loc}: mcp.versions must be unique and in canonical order" + )); + } +} + /// Map a supported L7 `access` preset to explicit rules for `protocol`. /// /// Returns `None` when `access` is not `read-only`, `read-write`, or `full`. @@ -1884,7 +1967,7 @@ mod tests { #[test] fn parse_l7_config_mcp_strict_tool_names_defaults_true() { let val = regorus::Value::from_json_str( - r#"{"protocol": "mcp", "host": "mcp.example.com", "port": 443}"#, + r#"{"protocol": "mcp", "host": "mcp.example.com", "port": 443, "mcp_versions": ["2025-11-25"]}"#, ) .unwrap(); let config = parse_l7_config(&val).unwrap(); @@ -1894,13 +1977,53 @@ mod tests { #[test] fn parse_l7_config_mcp_strict_tool_names_can_disable() { let val = regorus::Value::from_json_str( - r#"{"protocol": "mcp", "host": "mcp.example.com", "port": 443, "mcp_strict_tool_names": false}"#, + r#"{"protocol": "mcp", "host": "mcp.example.com", "port": 443, "mcp_strict_tool_names": false, "mcp_versions": ["2025-11-25"]}"#, ) .unwrap(); let config = parse_l7_config(&val).unwrap(); assert!(!config.mcp_strict_tool_names); } + #[test] + fn parse_l7_config_requires_canonical_mcp_versions() { + let explicit = regorus::Value::from_json_str( + r#"{"protocol": "mcp", "mcp_versions": ["2025-03-26", "2025-11-25"]}"#, + ) + .unwrap(); + assert_eq!( + parse_l7_config(&explicit).unwrap().mcp_versions, + vec![ + McpProtocolVersion::V2025_03_26, + McpProtocolVersion::V2025_11_25 + ] + ); + + for invalid in [ + r#"{"protocol": "mcp"}"#, + r#"{"protocol": "mcp", "mcp_versions": []}"#, + r#"{"protocol": "mcp", "mcp_versions": ["2026-01-01"]}"#, + r#"{"protocol": "mcp", "mcp_versions": [1]}"#, + r#"{"protocol": "mcp", "mcp_versions": ["2025-11-25", "2025-11-25"]}"#, + r#"{"protocol": "mcp", "mcp_versions": ["2025-11-25", "2025-03-26"]}"#, + ] { + let value = regorus::Value::from_json_str(invalid).unwrap(); + assert!( + parse_l7_config(&value).is_none(), + "non-canonical MCP runtime config must be rejected: {invalid}" + ); + } + } + + #[test] + fn parse_l7_config_keeps_mcp_versions_off_other_protocols() { + let value = regorus::Value::from_json_str( + r#"{"protocol": "json-rpc", "mcp_versions": ["2025-11-25"]}"#, + ) + .unwrap(); + + assert!(parse_l7_config(&value).unwrap().mcp_versions.is_empty()); + } + #[test] fn parse_l7_config_websocket_credential_rewrite_defaults_false() { let val = regorus::Value::from_json_str( diff --git a/crates/openshell-supervisor-network/src/l7/relay.rs b/crates/openshell-supervisor-network/src/l7/relay.rs index 9e4949b191..1a5e82f645 100644 --- a/crates/openshell-supervisor-network/src/l7/relay.rs +++ b/crates/openshell-supervisor-network/src/l7/relay.rs @@ -7357,6 +7357,7 @@ network_policies: graphql_max_body_bytes: 0, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash, websocket_credential_rewrite: false, request_body_credential_rewrite: false, @@ -7801,6 +7802,7 @@ network_policies: graphql_max_body_bytes: 0, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite: true, request_body_credential_rewrite: false, @@ -8003,6 +8005,7 @@ network_policies: graphql_max_body_bytes: 0, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite: true, request_body_credential_rewrite: false, @@ -8129,6 +8132,7 @@ network_policies: graphql_max_body_bytes: 0, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite: true, request_body_credential_rewrite: false, diff --git a/crates/openshell-supervisor-network/src/opa.rs b/crates/openshell-supervisor-network/src/opa.rs index 3303aa89b5..98632686e9 100644 --- a/crates/openshell-supervisor-network/src/opa.rs +++ b/crates/openshell-supervisor-network/src/opa.rs @@ -1507,6 +1507,28 @@ fn normalize_l7_config_aliases(data: &mut serde_json::Value) -> Vec { for stanza in L7ConfigStanza::ALL { normalize_l7_config_alias(&mut errors, ep_obj, &loc, stanza); } + + // The nested MCP stanza is optional, but the runtime projection is + // not. Materialize the pinned default at this YAML boundary so a + // missing alias cannot later look like corrupted runtime state. + if ep_obj + .get("protocol") + .and_then(serde_json::Value::as_str) + .is_some_and(|protocol| protocol.eq_ignore_ascii_case("mcp")) + && !ep_obj.contains_key("mcp_versions") + { + match openshell_policy::l7_config_alias_runtime_fields( + L7ConfigStanza::Mcp, + serde_json::json!({}), + ) { + Ok(fields) => { + for (field, value) in fields { + ep_obj.insert(field.to_string(), value); + } + } + Err(error) => errors.push(format!("{loc}.mcp: {error}")), + } + } } } @@ -1531,6 +1553,15 @@ fn normalize_l7_config_alias( Ok(fields) => { ep.remove(key); for (field, value) in fields { + if stanza == L7ConfigStanza::Mcp + && field == "mcp_versions" + && ep.contains_key(field) + { + errors.push(format!( + "{loc}: mcp.versions and mcp_versions cannot both be set" + )); + continue; + } ep.entry(field.to_string()).or_insert(value); } } @@ -2083,6 +2114,9 @@ fn proto_to_opa_data_json(proto: &ProtoSandboxPolicy, entrypoint_pid: u32) -> St ep["json_rpc_max_body_bytes"] = e.json_rpc_max_body_bytes.into(); } if let Some(mcp) = &e.mcp { + if e.protocol.eq_ignore_ascii_case("mcp") { + ep["mcp_versions"] = mcp.versions.clone().into(); + } if let Some(strict_tool_names) = mcp.strict_tool_names { ep["mcp_strict_tool_names"] = strict_tool_names.into(); } @@ -2307,7 +2341,10 @@ mod tests { }], ..Default::default() }], - ..Default::default() + binaries: vec![NetworkBinary { + path: "/usr/bin/curl".to_string(), + ..Default::default() + }], }, ); policy @@ -4956,6 +4993,7 @@ network_policies: protocol: mcp enforcement: enforce mcp: + versions: ["2025-11-25", "2025-03-26"] strict_tool_names: false rules: - allow: @@ -4979,6 +5017,151 @@ network_policies: let l7 = crate::l7::parse_l7_config(&config).expect("parse l7 config"); assert_eq!(l7.protocol, crate::l7::L7Protocol::Mcp); assert!(!l7.mcp_strict_tool_names); + assert_eq!( + l7.mcp_versions, + vec![ + openshell_core::mcp::McpProtocolVersion::V2025_03_26, + openshell_core::mcp::McpProtocolVersion::V2025_11_25, + ] + ); + } + + #[test] + fn yaml_load_accepts_mixed_case_mcp_protocol_with_default_versions() { + let data = r#" +network_policies: + mcp: + name: mcp + endpoints: + - host: mcp.example.com + port: 443 + protocol: MCP + rules: + - allow: + method: tools/list + binaries: + - { path: /usr/bin/curl } +"#; + let engine = OpaEngine::from_strings(TEST_POLICY, data).expect("engine from yaml"); + let input = NetworkInput { + host: "mcp.example.com".into(), + port: 443, + binary_path: PathBuf::from("/usr/bin/curl"), + binary_sha256: "unused".into(), + ancestors: vec![], + cmdline_paths: vec![], + }; + let config = engine + .query_endpoint_config(&input) + .expect("query endpoint config") + .expect("expected MCP endpoint config"); + let l7 = crate::l7::parse_l7_config(&config).expect("parse L7 endpoint config"); + + assert_eq!(l7.mcp_versions, vec![DEFAULT_MCP_PROTOCOL_VERSION]); + } + + #[test] + fn yaml_load_rejects_invalid_flat_mcp_versions_before_activation() { + for (case, versions) in [ + ("empty", "[]"), + ("non-string", "[1]"), + ("unsupported", "[\"2026-01-01\"]"), + ("duplicate", "[\"2025-11-25\", \"2025-11-25\"]"), + ("non-canonical", "[\"2025-11-25\", \"2025-03-26\"]"), + ] { + let data = format!( + r#" +network_policies: + mcp: + name: mcp + endpoints: + - host: mcp.example.com + port: 443 + protocol: mcp + mcp_versions: {versions} + rules: + - allow: + method: tools/list + binaries: + - {{ path: /usr/bin/curl }} +"# + ); + + let Err(error) = OpaEngine::from_strings(TEST_POLICY, &data) else { + panic!("invalid MCP runtime metadata must reject activation: {case}"); + }; + assert!( + error.to_string().contains("mcp.versions"), + "{case}: {error}" + ); + } + } + + #[test] + fn yaml_load_rejects_nested_and_flat_mcp_version_collision() { + let data = r#" +network_policies: + mcp: + name: mcp + endpoints: + - host: mcp.example.com + port: 443 + protocol: mcp + mcp_versions: ["2025-03-26"] + mcp: + versions: ["2025-11-25"] + rules: + - allow: + method: tools/list + binaries: + - { path: /usr/bin/curl } +"#; + + let Err(error) = OpaEngine::from_strings(TEST_POLICY, data) else { + panic!("ambiguous MCP revision sources must reject activation"); + }; + assert!( + error + .to_string() + .contains("mcp.versions and mcp_versions cannot both be set"), + "{error}" + ); + } + + #[test] + fn yaml_load_rejects_mcp_versions_on_non_mcp_protocols() { + for mcp_fields in [ + "mcp:\n versions: [\"2025-11-25\"]", + "mcp_versions: [\"2025-11-25\"]", + ] { + let data = format!( + r#" +network_policies: + json_rpc: + name: json_rpc + endpoints: + - host: rpc.example.com + port: 443 + protocol: json-rpc + {mcp_fields} + rules: + - allow: + method: ping + binaries: + - {{ path: /usr/bin/curl }} +"# + ); + + let Err(error) = OpaEngine::from_strings(TEST_POLICY, &data) else { + panic!("MCP revision policy must not apply to generic JSON-RPC"); + }; + assert!( + error + .to_string() + .contains("mcp.versions is only valid for protocol mcp"), + "{error}" + ); + } } #[test] @@ -5399,16 +5582,71 @@ network_policies: } #[test] - fn proto_load_accepts_defaultable_mcp_versions() { - for policy in [ - defaultable_mcp_proto(None), - defaultable_mcp_proto(Some(McpOptions::default())), - ] { - OpaEngine::from_proto(&policy) + fn proto_load_accepts_defaultable_mcp_versions_with_mixed_case_protocol() { + let mut implicit_defaults = defaultable_mcp_proto(None); + implicit_defaults + .network_policies + .get_mut("mcp") + .expect("defaultable MCP fixture contains the MCP policy") + .endpoints[0] + .protocol = "Mcp".to_string(); + let explicit_defaults = defaultable_mcp_proto(Some(McpOptions::default())); + + for policy in [implicit_defaults, explicit_defaults] { + let engine = OpaEngine::from_proto(&policy) .expect("supervisor ingress must materialize the pinned MCP revision"); + let input = NetworkInput { + host: "mcp.example.com".into(), + port: 443, + binary_path: PathBuf::from("/usr/bin/curl"), + binary_sha256: "unused".into(), + ancestors: vec![], + cmdline_paths: vec![], + }; + let config = engine + .query_endpoint_config(&input) + .expect("query endpoint config") + .expect("expected MCP endpoint config"); + let l7 = crate::l7::parse_l7_config(&config).expect("parse L7 endpoint config"); + assert_eq!( + l7.mcp_versions, + vec![DEFAULT_MCP_PROTOCOL_VERSION], + "protobuf ingress must preserve the materialized default through OPA" + ); } } + #[test] + fn proto_load_projects_canonical_mcp_versions_to_l7_config() { + let policy = defaultable_mcp_proto(Some(McpOptions { + versions: vec!["2025-11-25".to_string(), "2025-03-26".to_string()], + ..Default::default() + })); + let engine = OpaEngine::from_proto(&policy).expect("valid MCP policy"); + let input = NetworkInput { + host: "mcp.example.com".into(), + port: 443, + binary_path: PathBuf::from("/usr/bin/curl"), + binary_sha256: "unused".into(), + ancestors: vec![], + cmdline_paths: vec![], + }; + let config = engine + .query_endpoint_config(&input) + .expect("query endpoint config") + .expect("expected MCP endpoint config"); + let l7 = crate::l7::parse_l7_config(&config).expect("parse L7 endpoint config"); + + assert_eq!( + l7.mcp_versions, + vec![ + openshell_core::mcp::McpProtocolVersion::V2025_03_26, + openshell_core::mcp::McpProtocolVersion::V2025_11_25, + ], + "protobuf ingress must preserve the canonical allowlist through OPA" + ); + } + #[test] fn proto_load_rejects_unsupported_mcp_versions() { let policy = defaultable_mcp_proto(Some(McpOptions { diff --git a/crates/openshell-supervisor-network/src/proxy.rs b/crates/openshell-supervisor-network/src/proxy.rs index 177d640fd8..84df3801ce 100644 --- a/crates/openshell-supervisor-network/src/proxy.rs +++ b/crates/openshell-supervisor-network/src/proxy.rs @@ -7306,6 +7306,7 @@ network_policies: graphql_max_body_bytes: crate::l7::graphql::DEFAULT_MAX_BODY_BYTES, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite, request_body_credential_rewrite: false, @@ -8545,6 +8546,7 @@ network_policies: graphql_max_body_bytes: crate::l7::graphql::DEFAULT_MAX_BODY_BYTES, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite: false, request_body_credential_rewrite: false, @@ -8565,6 +8567,7 @@ network_policies: graphql_max_body_bytes: crate::l7::graphql::DEFAULT_MAX_BODY_BYTES, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite: false, request_body_credential_rewrite: false, diff --git a/crates/openshell-supervisor-network/src/proxy/relay.rs b/crates/openshell-supervisor-network/src/proxy/relay.rs index 9e00cfa254..d5d1828622 100644 --- a/crates/openshell-supervisor-network/src/proxy/relay.rs +++ b/crates/openshell-supervisor-network/src/proxy/relay.rs @@ -409,6 +409,7 @@ mod tests { graphql_max_body_bytes: crate::l7::graphql::DEFAULT_MAX_BODY_BYTES, json_rpc_max_body_bytes: crate::l7::jsonrpc::DEFAULT_MAX_BODY_BYTES, mcp_strict_tool_names: true, + mcp_versions: Vec::new(), allow_encoded_slash: false, websocket_credential_rewrite: false, request_body_credential_rewrite: false, From bb210ee9dc6823d3e0a25774c2ef5060d430fa79 Mon Sep 17 00:00:00 2001 From: "John T. Myers" <9696606+johntmyers@users.noreply.github.com> Date: Tue, 8 Sep 2026 19:14:26 +0000 Subject: [PATCH 3/3] docs: add code of conduct (#3223) Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com> --- CODE_OF_CONDUCT.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..4575d16002 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,5 @@ +# Code of Conduct + +We follow the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). + +Please contact [openshell-maintainers@ai-openshell.org](mailto:openshell-maintainers@ai-openshell.org) or the [CNCF Code of Conduct Committee](mailto:conduct@cncf.io) to report violations of the Code of Conduct.