Skip to content

Commit 54e427a

Browse files
committed
chore(stack): propagate shared SPIFFE crate extraction
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
2 parents 0625004 + 0bf7e46 commit 54e427a

23 files changed

Lines changed: 150 additions & 23 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Do not rely on this file for a full inventory. The detailed public and contribut
4343
| `crates/openshell-gateway/` | Gateway binary composition | Links selected first-party compute drivers into the backend-agnostic server registry |
4444
| `crates/openshell-sdk/` | Shared client SDK | Async Rust gateway client (gRPC transport, TLS, OIDC refresh, edge tunnel); consumed by CLI, TUI, and `@openshell/sdk` |
4545
| `crates/openshell-providers/` | Provider management | Credential provider backends |
46+
| `crates/openshell-spiffe/` | SPIFFE identity types | Dependency-light SPIFFE ID mapping, claim parsing, and the sandbox identity provider interface |
4647
| `crates/openshell-spire/` | SPIRE adapter | Gateway-owned SPIRE Delegated Identity client that issues and verifies stable sandbox JWT-SVIDs |
4748
| `crates/openshell-tui/` | Terminal UI | Ratatui-based dashboard for monitoring |
4849
| `crates/openshell-driver-kubernetes-secrets/` | Kubernetes Secrets credential driver | In-process `CredentialDriver` backend for OpenShell-managed K8s Secret storage |

‎Cargo.lock‎

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-core/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ openshell-crypto = { workspace = true, features = ["tls-tonic"] }
1515
async-trait = "0.1"
1616
openshell-extension-core = { path = "../openshell-extension-core" }
1717
openshell-policy-schema = { path = "../openshell-policy-schema" }
18+
openshell-spiffe = { path = "../openshell-spiffe" }
1819
glob = { workspace = true }
1920
prost = { workspace = true }
2021
prost-types = { workspace = true }

‎crates/openshell-core/src/config.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl SpiffeDelegationConfig {
238238
{
239239
return Err("spiffe_delegation requires a canonical absolute admin socket path in a dedicated directory and a non-root socket group".into());
240240
}
241-
crate::spiffe::SandboxSpiffeIdPrefix::parse(&self.spiffe_id_prefix)?
241+
openshell_spiffe::SandboxSpiffeIdPrefix::parse(&self.spiffe_id_prefix)?
242242
.sandbox_spiffe_id(gateway_id, "sandbox")?;
243243
Ok(())
244244
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ pub mod sandbox_session;
6060
pub mod secrets;
6161
pub mod settings;
6262
pub mod shell;
63-
pub mod spiffe;
6463
pub mod telemetry;
6564
pub mod time;
6665
pub mod token_grant_failure;

‎crates/openshell-server/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ openshell-otel = { path = "../openshell-otel" }
2424
openshell-policy = { path = "../openshell-policy" }
2525
openshell-prover = { path = "../openshell-prover" }
2626
openshell-providers = { path = "../openshell-providers" }
27+
openshell-spiffe = { path = "../openshell-spiffe" }
2728
openshell-spire = { path = "../openshell-spire" }
2829
openshell-supervisor-middleware = { path = "../openshell-supervisor-middleware" }
2930
openshell-supervisor-control = { path = "../openshell-supervisor-control" }

‎crates/openshell-server/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ authorized. A fresh token is cached only after that check. Startup validates
111111
the delegation settings, and gateway state construction builds the
112112
[`openshell-spire`](../openshell-spire/README.md) adapter once and returns a
113113
configuration error when they are invalid. The broker depends only on
114-
`openshell_core::spiffe::SandboxIdentityProvider`, which returns a JWT-SVID
114+
[`openshell-spiffe`](../openshell-spiffe/README.md)'s `SandboxIdentityProvider`
115+
with `TokenGrantFailure` as its error, which returns a JWT-SVID
115116
verified for the requested gateway, sandbox, and audience; each cache miss
116117
fetches a new SVID and the agent's current JWT bundle. SPIRE still trusts the
117118
gateway as a delegate for its agent's available registration scope.

‎crates/openshell-server/src/grpc/provider.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,15 +2557,15 @@ use openshell_core::proto::{
25572557
ProviderResponse, RotateProviderCredentialRequest, RotateProviderCredentialResponse,
25582558
UpdateProviderProfilesRequest, UpdateProviderProfilesResponse, UpdateProviderRequest,
25592559
};
2560-
use openshell_core::spiffe::{
2561-
SpiffeJwtClaims, parse_unverified_jwt_svid_claims, trust_domain as spiffe_trust_domain,
2562-
workload_api_endpoint,
2563-
};
25642560
use openshell_providers::{
25652561
CredentialRefreshProfile, ProfileValidationDiagnostic, ProviderTypeProfile,
25662562
normalize_profile_id, strategy_output_env_key, strategy_output_spec, strategy_primary_env_key,
25672563
validate_profile_set,
25682564
};
2565+
use openshell_spiffe::{
2566+
SpiffeJwtClaims, parse_unverified_jwt_svid_claims, trust_domain as spiffe_trust_domain,
2567+
workload_api_endpoint,
2568+
};
25692569
use std::sync::{Arc, LazyLock, RwLock};
25702570
use tonic::{Request, Response};
25712571

@@ -5910,7 +5910,7 @@ mod tests {
59105910
let claims = SpiffeJwtClaims {
59115911
iss: SECRET.to_string(),
59125912
sub: SECRET.to_string(),
5913-
aud: openshell_core::spiffe::AudienceClaim::One(SECRET.to_string()),
5913+
aud: openshell_spiffe::AudienceClaim::One(SECRET.to_string()),
59145914
exp: 0,
59155915
};
59165916
let gateway =

‎crates/openshell-server/src/grpc/provider/access_token.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use openshell_core::proto::{
1919
GetSandboxProviderAccessTokenRequest, GetSandboxProviderAccessTokenResponse,
2020
ProviderCredentialTokenGrant,
2121
};
22-
use openshell_core::spiffe::SandboxIdentityProvider;
2322
use openshell_core::token_grant_failure::BROKERED_TOKEN_GATEWAY_DEADLINE;
23+
use openshell_spiffe::SandboxIdentityProvider;
2424
use std::time::Duration;
2525

2626
static ACCESS_TOKENS: LazyLock<IntermediateTokenCache> = LazyLock::new(IntermediateTokenCache::new);
@@ -354,7 +354,7 @@ async fn acquire(
354354
state: &ServerState,
355355
bearer: &str,
356356
session: &AuthenticatedSandboxSession,
357-
identity: &dyn SandboxIdentityProvider,
357+
identity: &dyn SandboxIdentityProvider<Error = TokenGrantFailure>,
358358
gateway_id: &str,
359359
grant: &ProviderCredentialTokenGrant,
360360
subject: Option<&Subject>,

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ mod ws_tunnel;
6262

6363
use openshell_core::net::set_tcp_nodelay_best_effort;
6464
use openshell_core::telemetry::TelemetryComputeDriver;
65+
use openshell_core::token_grant_failure::TokenGrantFailure;
6566
use openshell_core::{Config, Error, ObjectLabels, Result};
6667
use openshell_extension_core::{
6768
BearerTokenSlot, ExtensionAudience, ExtensionCallerKind, ExtensionKind, MAX_EXTENSION_TOKEN_TTL,
6869
};
70+
use openshell_spiffe::SandboxIdentityProvider;
6971
use openshell_supervisor_middleware::MiddlewareRegistry;
7072
use std::collections::{BTreeMap, HashMap};
7173
use std::io::ErrorKind;
@@ -431,7 +433,8 @@ pub struct ServerState {
431433

432434
/// Source of sandbox JWT-SVIDs for brokered provider tokens, built once
433435
/// from the SPIRE delegation settings. `None` when disabled.
434-
pub(crate) sandbox_identity: Option<Arc<dyn openshell_core::spiffe::SandboxIdentityProvider>>,
436+
pub(crate) sandbox_identity:
437+
Option<Arc<dyn SandboxIdentityProvider<Error = TokenGrantFailure>>>,
435438

436439
/// OIDC admin role name for workspace-level authorization.
437440
/// Empty when OIDC is not configured — `authorize_workspace()` treats

0 commit comments

Comments
 (0)