Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
feefafb
docs(rfc): propose workspace secrets for shared refresh material
mrunalp Nov 18, 2026
7b61683
feat(server): add workspace secret resource
mrunalp Nov 18, 2026
6970aa8
feat(server): reference workspace secrets from provider refresh
mrunalp Nov 18, 2026
9ecdfe6
feat(server): add RevealSecret for control-plane callers
mrunalp Nov 18, 2026
44e7598
feat(cli): add workspace secret commands
mrunalp Nov 18, 2026
b809211
docs: document workspace secrets
mrunalp Nov 18, 2026
bee4038
fix(server): close workspace secret races found in review
mrunalp Nov 18, 2026
739e763
docs: clarify workspace secret rollback
mrunalp Nov 18, 2026
9146f99
fix(server): address second workspace secret review
mrunalp Nov 18, 2026
3bcfa18
docs: describe unfinished secret deletions
mrunalp Nov 18, 2026
159e797
docs(rfc): assign RFC 0024 to workspace secrets
mrunalp Nov 18, 2026
1345de7
feat(server): restrict RevealSecret to mTLS operators
mrunalp Nov 18, 2026
a64f437
docs: describe operator-only secret reveal
mrunalp Nov 18, 2026
bf430a3
feat(server): make refresh use optional for workspace secrets
mrunalp Nov 18, 2026
1c4728c
docs: describe reveal-only workspace secrets
mrunalp Nov 18, 2026
28010c7
fix(cli): store secret value files verbatim
mrunalp Nov 18, 2026
7097649
docs: keep reveal-only secret readers working on rollback
mrunalp Nov 18, 2026
b68c1ce
fix(server): make workspace secret creation crash-safe
mrunalp Nov 18, 2026
4dc1320
fix(credential-issuer): accept IPv6 loopback when minting
mrunalp Nov 18, 2026
ff06727
docs: restore a loadable configuration on downgrade
mrunalp Nov 18, 2026
b11be88
fix(server): close remaining workspace secret creation races
mrunalp Nov 18, 2026
9080a2c
docs(rfc): describe claim-first cleanup of pending creates
mrunalp Nov 18, 2026
1e6801f
Merge remote-tracking branch 'origin/main' into feat/5563-workspace-s…
mrunalp Nov 18, 2026
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 crates/openshell-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pub mod common;
pub mod gateway;
pub mod provider;
pub mod provider_readiness;
pub mod secret;
97 changes: 89 additions & 8 deletions crates/openshell-cli/src/commands/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ use openshell_core::proto::{
DeleteProviderProfileRequest, DeleteProviderRefreshRequest, DeleteProviderRequest,
DetachSandboxProviderRequest, GetProviderProfileRequest, GetProviderRefreshStatusRequest,
GetProviderRequest, GetSandboxRequest, ImportProviderProfilesRequest,
LintProviderProfilesRequest, ListProviderProfilesRequest, ListProvidersRequest,
ListSandboxProvidersRequest, Provider, ProviderCredentialRefreshRecoveryAction,
ProviderCredentialRefreshStatus, ProviderCredentialRefreshStrategy,
ProviderCredentialTokenGrantType, ProviderMutationKind, ProviderProfile,
ProviderProfileDiagnostic, ProviderProfileImportItem, RotateProviderCredentialRequest,
UpdateProviderProfilesRequest, UpdateProviderRequest,
InlineProviderRefreshSecretsRequest, LintProviderProfilesRequest, ListProviderProfilesRequest,
ListProvidersRequest, ListSandboxProvidersRequest, Provider,
ProviderCredentialRefreshRecoveryAction, ProviderCredentialRefreshStatus,
ProviderCredentialRefreshStrategy, ProviderCredentialTokenGrantType, ProviderMutationKind,
ProviderProfile, ProviderProfileDiagnostic, ProviderProfileImportItem,
RotateProviderCredentialRequest, UpdateProviderProfilesRequest, UpdateProviderRequest,
};
use openshell_core::rpc_error::{ERROR_DOMAIN, decode_details};
use openshell_core::{ObjectId, ObjectName, ObjectWorkspace};
Expand Down Expand Up @@ -1291,6 +1291,7 @@ pub async fn provider_create_with_options(options: ProviderCreateOptions<'_>) ->
workspace_scope: Some(openshell_core::proto::workspace_selector(
(workspace).to_string(),
)),
material_secrets: HashMap::new(),
})
.await
{
Expand Down Expand Up @@ -1943,7 +1944,7 @@ pub async fn provider_refresh_status(

fn refresh_status_header() -> String {
format!(
"{:<24} {:<28} {:<28} {:<24} {:<18} {:<20} {:<20} {:<20} {:<44} {}",
"{:<24} {:<28} {:<28} {:<24} {:<18} {:<20} {:<20} {:<20} {:<44} {:<32} {}",
"PROVIDER".bold(),
"CREDENTIAL_KEY".bold(),
"STRATEGY".bold(),
Expand All @@ -1953,6 +1954,7 @@ fn refresh_status_header() -> String {
"NEXT_REFRESH".bold(),
"LAST_REFRESH".bold(),
"FAILURE_CODE".bold(),
"MATERIAL_SECRETS".bold(),
"LAST_ERROR".bold(),
)
}
Expand All @@ -1964,6 +1966,7 @@ pub struct ProviderRefreshConfigInput<'a> {
pub material: &'a [String],
pub secret_material_env: &'a [String],
pub secret_material_keys: &'a [String],
pub material_secrets: &'a [String],
pub credential_expires_at_ms: Option<i64>,
}

Expand All @@ -1989,6 +1992,20 @@ pub async fn provider_refresh_config(
}
material.insert(key, value);
}
// Workspace-secret references are secret material too. Listing them in
// secret_material_keys makes gateways that predate workspace secrets reject
// the request instead of ignoring the references.
let material_secrets = parse_key_value_pairs(input.material_secrets, "--material-secret")?;
for key in material_secrets.keys() {
if material.contains_key(key) {
return Err(miette!(
"duplicate material key '{key}': supplied via both inline material and --material-secret"
));
}
if !secret_material_keys.contains(key) {
secret_material_keys.push(key.clone());
}
}
let mut client = grpc_client(server, tls).await?;
let status = client
.configure_provider_refresh(ConfigureProviderRefreshRequest {
Expand All @@ -1998,6 +2015,7 @@ pub async fn provider_refresh_config(
strategy: strategy as i32,
material,
secret_material_keys,
material_secrets,
expiration_time: input
.credential_expires_at_ms
.map(openshell_core::time::timestamp_from_millis)
Expand Down Expand Up @@ -2062,6 +2080,37 @@ pub async fn provider_rotate(
Ok(())
}

pub async fn provider_refresh_inline_secrets(
server: &str,
name: &str,
credential_key: &str,
workspace: &str,
tls: &TlsOptions,
) -> Result<()> {
let mut client = grpc_client(server, tls).await?;
let status = client
.inline_provider_refresh_secrets(InlineProviderRefreshSecretsRequest {
workspace_scope: Some(openshell_core::proto::workspace_selector(
workspace.to_string(),
)),
provider: name.to_string(),
credential_key: credential_key.to_string(),
request_id: String::new(),
})
.await
.into_diagnostic()?
.into_inner()
.status
.ok_or_else(|| miette!("provider refresh status missing from response"))?;
println!(
"{} Copied workspace secrets into provider-owned material for {} {}",
"✓".green().bold(),
status.provider,
status.credential_key
);
Ok(())
}

pub async fn provider_refresh_delete(
server: &str,
name: &str,
Expand Down Expand Up @@ -2121,7 +2170,7 @@ fn refresh_status_row(status: &ProviderCredentialRefreshStatus) -> String {
let recovery_action = ProviderCredentialRefreshRecoveryAction::try_from(status.recovery_action)
.unwrap_or(ProviderCredentialRefreshRecoveryAction::Unspecified);
format!(
"{:<24} {:<28} {:<28} {:<24} {:<18} {:<20} {:<20} {:<20} {:<44} {}",
"{:<24} {:<28} {:<28} {:<24} {:<18} {:<20} {:<20} {:<20} {:<44} {:<32} {}",
status.provider,
status.credential_key,
provider_refresh_strategy_name(strategy),
Expand All @@ -2134,10 +2183,25 @@ fn refresh_status_row(status: &ProviderCredentialRefreshStatus) -> String {
),
format_optional_epoch_ms(proto_timestamp_ms(status.last_refresh_time.as_ref())),
status.failure_code,
material_secrets_field(&status.material_secrets),
truncate_status_field(&status.last_error, 72),
)
}

/// Material keys supplied by workspace secrets, as `key=secret`, sorted. These
/// are the credentials to convert with `provider refresh inline-secrets`.
fn material_secrets_field(material_secrets: &HashMap<String, String>) -> String {
if material_secrets.is_empty() {
return "-".to_string();
}
let mut bindings: Vec<_> = material_secrets
.iter()
.map(|(key, secret)| format!("{key}={secret}"))
.collect();
bindings.sort();
bindings.join(",")
}

pub fn provider_refresh_recovery_action_name(
action: ProviderCredentialRefreshRecoveryAction,
) -> &'static str {
Expand Down Expand Up @@ -3461,6 +3525,7 @@ binaries: [/usr/bin/curl]
assert!(header.contains("RECOVERY"));
assert!(header.contains("FAILURE_CODE"));
assert!(header.contains("LAST_ERROR"));
assert!(header.contains("MATERIAL_SECRETS"));

let row = refresh_status_row(&ProviderCredentialRefreshStatus {
provider: "my-graph".to_string(),
Expand All @@ -3477,6 +3542,7 @@ binaries: [/usr/bin/curl]
failure_code: "oauth_rotated_refresh_token_handle_missing".to_string(),
provider_error_subtype: "invalid_rapt".to_string(),
last_error_time: openshell_core::time::timestamp_from_millis(1_767_225_000_000).ok(),
material_secrets: HashMap::new(),
});

assert!(row.contains("my-graph"));
Expand All @@ -3488,6 +3554,21 @@ binaries: [/usr/bin/curl]
assert!(row.contains("2026-01-01 00:00:00"));
assert!(!row.contains("292278994"));
assert!(row.contains("..."));
assert!(row.contains(" - "), "no secret references render as '-'");
}

#[test]
fn refresh_status_row_lists_workspace_secret_bindings() {
let row = refresh_status_row(&ProviderCredentialRefreshStatus {
provider: "alice-mcp".to_string(),
credential_key: "MCP_ACCESS_TOKEN".to_string(),
material_secrets: HashMap::from([
("private_key".to_string(), "signing-key".to_string()),
("client_secret".to_string(), "acme-oauth-client".to_string()),
]),
..Default::default()
});
assert!(row.contains("client_secret=acme-oauth-client,private_key=signing-key"));
}

#[test]
Expand Down
Loading
Loading