feat(providers): add credential refresh foundation#1349
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
043004c to
1b9aea7
Compare
|
🌿 Preview your docs: https://nvidia-preview-pr-1349.docs.buildwithfern.com/openshell |
49554d0 to
67e675d
Compare
|
Label |
|
(From Codex) Finding 1/3: New refresh write RPCs need provider admin authorization. The new RPCs in Please add refresh status as |
|
(From Codex) Finding 2/3: Refresh-bootstrap providers can bypass credential-key collision checks before the first token is minted. The uniqueness check only considers currently materialized Please treat configured refresh |
|
(From Codex) Finding 3/3: CLI refresh bootstrap eligibility does not match the server rule. The CLI helper in That makes delegated refresh-token profiles fail too early in the CLI and mixed static/refresh profiles fail only after the request reaches the server. Please mirror the server predicate in the CLI. |
TaylorMutch
left a comment
There was a problem hiding this comment.
Approving; follow ons after this core PR land seem good to me
|
+1 what @TaylorMutch said |
ba2aff0 to
79eae79
Compare
Summary
Adds the first provider credential refresh implementation slice for #1306. This PR wires refresh metadata through profiles, providers, gateway APIs, provider environment resolution, and sandbox placeholder resolution, and now includes gateway-owned token minting for OAuth2 refresh-token, OAuth2 client-credentials, and Google service-account JWT credentials.
Related Issue
Refs #1306
Changes
openshell provider refresh status NAME [--credential-key KEY]openshell provider refresh configure NAME --credential-key KEY --strategy STRATEGY --material KEY=VALUE --secret-material-key KEY --credential-expires-at TIMESTAMP_MSopenshell provider refresh rotate NAME --credential-key KEYopenshell provider refresh delete NAME --credential-key KEYopenshell provider update NAME --credential-expires-at KEY=TIMESTAMP_MSobjectstable usingscope = provider_id.provider refresh rotatepath that mint short-lived access tokens and write the current token back to the provider record.token_url/token_uri, and profile-required refresh material is validated at configure time.max_lifetime_secondsas a cap on minted token lifetime even when the provider token endpoint returns a longerexpires_in.outlookandgoogle-drive.UX Changes
Static credential flows continue to work. Users can still create providers with injected current credentials and optionally annotate expiration timestamps:
Refresh-backed providers can now be created before a current access token exists when the profile's required credentials are gateway-mintable. Profiles that still require a static credential continue to require that credential at create time.
OAuth2 refresh-token providers can be configured with refresh material and then rotated immediately:
OAuth2 client-credentials providers use the same flow:
Google Drive service-account refresh follows the same provider lifecycle:
Refresh status now exposes operational state without printing secrets:
Empty status output now distinguishes whole-provider checks from single-credential checks:
openshell provider refresh delete NAME --credential-key KEYremoves the refresh state. It clearscredential_expires_at_msonly when that expiry was owned by the refresh state; manually set expiry fromopenshell provider update --credential-expires-atis preserved.When
providers_v2_enabled=true, these profiles also contribute provider policy layers and profile-backed credential injection for attached/created sandboxes:Current Behavior
provider refresh configureaccepts gateway-mintable strategies only:oauth2_refresh_token,oauth2_client_credentials, andgoogle_service_account_jwt.openshell provider update, notprovider refresh configure.provider refresh rotateperforms an immediate gateway-managed refresh for supported strategies.openshell provider update.Testing
RUSTC_WRAPPER= cargo test -p openshell-server -p openshell-cli -p openshell-providers -p openshell-sandbox --no-runRUSTC_WRAPPER= cargo test -p openshell-server provider_refresh -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-providers -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-server provider_validation_errors -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-cli provider_create_allows_empty_credentials_for_gateway_refresh_profiles -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-cli provider_refresh_cli_run_functions_wire_requests -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-cli --lib -j1 refresh_status_table_includes_operational_fields -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-server --lib -j1 configure_provider_refresh_stores_scoped_status_and_provider_expiry -- --nocaptureRUSTC_WRAPPER= cargo test -p openshell-server -j1 delete_provider_refresh_preserves_manually_updated_expiry -- --nocaptureRUSTC_WRAPPER= cargo clippy -p openshell-server --all-targets -- -D warningsRUSTC_WRAPPER= cargo clippy -p openshell-cli --lib --tests -j1 -- -D warningsRUSTC_WRAPPER= cargo test -p openshell-cli http_health_check_supports_plain_http_endpoints -- --nocapturemise run pre-commitChecklist