feat(server): add credential storage drivers for Provider v2#2454
Draft
varshaprasad96 wants to merge 16 commits into
Draft
feat(server): add credential storage drivers for Provider v2#2454varshaprasad96 wants to merge 16 commits into
varshaprasad96 wants to merge 16 commits into
Conversation
Add CredentialDriver gRPC service in openshell.credentials.v1 with Store, Delete, Resolve, List, and GetCapabilities RPCs. Add CredentialHandle message and credential_handles field to Provider. Add credential_drivers and default_credential_driver to Config. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
AES-256-GCM envelope encryption with per-credential DEK wrapped by a KEK loaded from file or env var. Stores encrypted credential envelopes in the gateway database via a DbCredstoreObjectStore trait abstraction. Handle format: v1:<64-char-hex-id>. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Kubernetes Secrets driver: standalone UDS binary, deterministic SHA-256 secret naming, managed-by labels, create-or-patch semantics. Vault driver: standalone UDS binary, KV v1/v2 support, Kubernetes JWT and token_file auth, path traversal prevention. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Add CredentialRuntime with driver registry, UDS transport management, and ServerDbCredstoreObjectStore adapter. Wire into ServerState and cli.rs config. Add credential_drivers and credential_storage config fields. Add credential_handles field to all Provider struct literals. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Add credential handle validation, storage, and resolution to provider create/update/delete/resolve flows. Reject user-supplied handles, offload inline credentials to configured storage drivers, clean up handles on failure, and resolve handles for provider environment. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
…fresh Add _with_credentials variants for inference bundle resolution and route upsert. Thread credential runtime through provider refresh to store refreshed tokens via credential driver when configured. Add resolve_provider_credentials helper for handle-to-value resolution. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Add Helm values, templates, and validation for credential storage drivers. Includes K8s Secrets RBAC role/rolebinding, retained KEK secret for default DB credstore, gateway config TOML rendering, CI values overlays, skaffold profiles, and Helm unit tests. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Add credential_drivers.rs e2e test covering K8s Secrets and Vault backends. Add CI workflow job, e2e script support for credential driver suites, OpenBao fixture deployment, and mise task. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Document credential driver configuration in gateway-config.mdx, credential handle lifecycle in providers-v2.mdx, and architecture notes. Update AGENTS.md, CI.md, and TESTING.md references. Refs: NVIDIA#1931 Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Apply rustfmt formatting across server and e2e crates. Add clippy allow for too_many_arguments on upsert_inference_route. Fix CAS provider tests that failed because cloned providers now carry credential_handles from the test-static driver — clear handles before update requests and check both credentials and credential_handles in concurrent update assertions. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Add YAML comment to credential-secrets-role.yaml explaining why resourceNames cannot be used and recommending a dedicated namespace. Add security note to gateway-config.mdx for the Kubernetes Secrets driver. Support user-supplied defaultKeyEncryptionKey in values.yaml for helm template / GitOps workflows where randBytes is not available. Priority: existing Secret (lookup) > user-supplied value > random. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
… context Add handle_count, per-handle (key, driver, handle) tuples, and the provider name to the warning emitted when pre-stored credentials cannot be cleaned up after a failed provider update. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
… resolve Add validate_handle_namespace check after resolve_handle in store, delete, and resolve paths. Returns permission_denied when a handle targets a namespace other than the configured one and allow_reference_namespace is false. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Add RwLock-based double-checked locking to avoid re-authenticating on every credential RPC. TTL is derived from the Vault lease_duration response with a 30-second safety buffer. TokenFile auth caches with a fixed 30-second TTL to pick up file rotations. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Replace sequential for-loops in store_provider_credentials and delete_provider_credential_handles with futures::future::join_all for concurrent dispatch. Replaced-handle deletion is batched after all stores succeed. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
… on CAS failure Store minted additional_credentials (e.g. AWS STS session tokens) through the credential driver when one is active, instead of writing them inline. On CAS failure, best-effort cleanup deletes all stored handles with a structured orphan warning. Co-authored-by: Taylor Mutch <taylormutch@gmail.com> Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
varshaprasad96
requested review from
a team,
derekwaynecarr,
maxamillion and
mrunalp
as code owners
July 24, 2026 04:32
varshaprasad96
marked this pull request as draft
July 24, 2026 04:33
Contributor
Author
Collaborator
|
Is this a dupe of #2437? Can we just pick one? |
Contributor
Author
Yes, we are reviewing the changes in both, and will pick up. It was journey of huge rebase in 2 different ways. Which is why this is in draft. Will proceed with only one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add pluggable credential storage drivers so provider secrets are stored in external backends instead of inline in the gateway database. This implements the credential storage driver system described in issue #1931.
Three backends are supported:
OpaqueSecrets in a configurable namespace with ownership validationKey design decisions
credential_handles(driver + handle reference) instead of inline secrets. API responses redact both inline and handle-based credentials.Provider.credentials(inline) andProvider.credential_handles(driver-managed) coexist for backward compatibility. Existing inline credentials remain readable; new operations use handles when a driver is configured.Improvements over PR #1986
This implementation is based on PR #1986 by @TaylorMutch with the following improvements:
store_provider_credentialsanddelete_provider_credential_handlesusefutures::future::join_allinstead of sequential loopslease_duration, avoiding re-authentication on every RPCallow_reference_namespaceis now actually enforced at runtime in store/delete/resolve paths (was parsed but never checked)apply_minted_credentialroutesadditional_credentials(e.g. AWS STS session tokens) through the driver instead of writing them inline as plaintextapply_minted_credentialinstead of being orphanedhandle_count, per-handle(key, driver, handle)tuples, and provider namedefaultKeyEncryptionKeyHelm value forhelm templateworkflows wherelookup/randBytesare unavailableRelated Issue
Closes #1931
Changes
New crates
crates/openshell-driver-db-credstore/— Default encrypted DB credential store (AES-256-GCM)crates/openshell-driver-kubernetes-secrets/— Kubernetes Secrets credential drivercrates/openshell-driver-vault/— Vault credential driverServer
crates/openshell-server/src/credentials.rs— Credential runtime, driver registry, parallel RPC dispatchcrates/openshell-server/src/grpc/provider.rs— CAS-aware credential handle lifecycle in create/update/deletecrates/openshell-server/src/provider_refresh.rs— Route refreshed credentials through driver with CAS cleanupcrates/openshell-server/src/inference.rs— Resolve credential handles for inference routescrates/openshell-server/src/grpc/validation.rs— Credential handle field validationHelm
Docs
docs/reference/gateway-config.mdx— Full credential drivers reference sectiondocs/sandboxes/providers-v2.mdx— User-facing credential storage documentationarchitecture/gateway.md— Architecture documentationE2E
e2e/rust/tests/credential_drivers.rs— End-to-end tests for K8s Secrets and Vault backendstest:e2e-kuberneteslabelTesting
mise run pre-commit— lint, format, clippy all passmise run test— all unit tests pass (including new credential driver tests)mise run helm:test— Helm unit tests pass (9 credential driver test cases)test:e2e-kubernetes— E2E tests for K8s Secrets and Vault backends (CI)Checklist
Co-authored-by: Taylor Mutch taylormutch@gmail.com