Repository navigation
Conversation
971313b to
1b83bbf
Compare
|
This adds a useful flow. To leave room for further configurability in future PRs, could we make There are independent choices here: the grant type, the subject credential, the client authentication mechanism, and the credential used to authenticate. The scalar client_assertion implicitly couples the last two to the sandbox JWT-SVID. An object would leave room for other credential sources and mechanism-specific settings without restructuring the config later. We only need to support the combinations implemented here initially, including |
1b83bbf to
f1acec3
Compare
Thanks @grs. client_authentication is now an object, |
|
Thanks @paezba! One minor suggestion inline, but looks good to me! |
| } | ||
| } | ||
|
|
||
| // An unknown wire mechanism falls back to unspecified; the supervisor and |
There was a problem hiding this comment.
minor nit: it would perhaps be better to reject unknown mechanisms as otherwise a typo leads to an unexpected mechanism.
There was a problem hiding this comment.
Thanks @grs, good point about typos. I think we're already covered: an unknown mechanism in YAML fails when the profile loads, and the supervisor and gateway refuse to run a grant with a mechanism they don't recognise.
The fallback you flagged only runs when an already-validated profile is converted back from its stored form. Making that conversion fallible would ripple through a lot of unrelated code, and the other enums there behave the same way today, so it felt too big for this PR.
If you'd still like an extra guard, I can reject unknown mechanisms in the server's profile-import validation. That's a small, contained change. Happy to add it if you want it.
There was a problem hiding this comment.
Sorry for duplicated comment! Had some issues with github for a moment there. If profile validation already rejects it, that is fine.
There was a problem hiding this comment.
Yes, seems like GH was having issues. So we leave as it is then. Thanks!
Got an unnoticed error on submitting the comment. Minor nit: it would perhaps be better to reject unknown mechanisms on importing a profile as otherwise a typo leads to an unexpected mechanism. (token_grant_client_authentication_from_proto currently maps them to Unspecified so runtime rejection won't cath it) |
f1acec3 to
eaceecb
Compare
Add subject_token.source jwt_svid and client_authentication (client_assertion | none) to provider token grants so the sandbox JWT-SVID can be sent directly as the RFC 8693 subject_token, for example to Google STS for Workload Identity Federation. Invalid combinations are rejected at profile load. Dedicated supervisors perform the exchange without a gateway call; gateway-brokered grants for shared supervisors use the stable sandbox JWT-SVID. Grant flow resolution is shared in openshell-core. Add gce_metadata_token so the sandbox GCE metadata emulator serves a placeholder access token that the token grant replaces, letting unmodified Google SDKs using Application Default Credentials work. Closes ai-openshell#5897 Signed-off-by: paezba <64277512+paezba@users.noreply.github.com>
eaceecb to
79a1025
Compare
Summary
Let a provider token grant send the sandbox JWT-SVID directly as the RFC 8693
subject_token, optionally without client authentication. This enables keyless Google Cloud access through Workload Identity Federation. A GCE metadata emulator placeholder lets unmodified Google SDKs using Application Default Credentials use the grant.Related Issue
Closes #5897
Changes
subject_token.source: jwt_svidand aclient_authenticationobject (mechanism: client_assertion | none, optionalcredential: {source: jwt_svid}) to token grants (ProviderCredentialTokenGrantClientAuthentication, field 11). Omitting it keeps today'sclient_assertionbehavior.nonerequirestoken_exchangewith ajwt_svidsubject and cannot be combined withclient_assertion_type. Ajwt_svidsubject must not name a storedcredential, and unknown sources or authentication values are rejected.jwt_svid_audience) attoken_endpointwithout a gateway call. They send noclient_assertionwhenclient_authentication.mechanism: none.FailedPrecondition. Grant-flow resolution moved toopenshell-core::oauth::TokenGrantFlowso the supervisor and gateway share it.gce_metadata_token(field 13): the sandbox GCE metadata emulator serves a non-secret placeholder access token for the credential. The token grant replaces it on the credential's endpoints; requests elsewhere that carry the placeholder are refused.docs/how-it-works/providers/profiles.mdx, theopenshell-serverandopenshell-supervisor-networkREADMEs, andexamples/spiffe-gcp-sts-demo.storage_proto.rsfor the new proto fields.Release Notes
Provider token grants can exchange the sandbox SPIFFE JWT-SVID directly at an STS such as Google's (
subject_token.source: jwt_svid,client_authentication.mechanism: none). Withgce_metadata_token: true, Google SDKs using Application Default Credentials reach Google Cloud APIs from a sandbox without a stored key.Testing
Checks appropriate to the affected code and behavior pass
Unit tests added/updated (if applicable)
E2E tests added/updated (if applicable)
cargo fmt --checkandcargo clippy -D warningsonopenshell-core,openshell-providers,openshell-server, andopenshell-supervisor-networkcargo test -p openshell-core -p openshell-providerscargo test -p openshell-server --tests --binscargo test -p openshell-supervisor-network --lib: the token grant tests pass. 8proxy::testsfailures on macOS also fail onmainunchanged.mise run markdown:lint,proto:lint,buf breakingagainstmain,license:check,docs:nav,docs:build:strictNot run: a live Google STS / SPIRE end-to-end call with an unmodified Google SDK. A local run of
e2e:kubernetes:shared-supervisor-spiffeon Colima couldn't reach the host-side test fixtures, so it didn't get as far as token grants.Checklist