Repository navigation
Conversation
…kens The proxy accepts any access token the issuer signed, whichever client it was minted through. Identity providers attach their login policy to the client (who may sign in, MFA, allowed networks), so a token obtained via another, weaker client of the same IDP - or one created through dynamic client registration - bypasses the policy configured for OpenCloud. PROXY_OIDC_AUDIENCES does not close this: a client can usually request any audience. PROXY_OIDC_ALLOWED_CLIENT_IDS (oidc.allowed_client_ids) lists the clients whose tokens are accepted. The client is read from client_id (RFC 9068) or, if absent, azp (OpenID Connect). Matching is exact; missing, empty, malformed or unlisted clients are rejected during JWT verification. Like audiences, the list is empty by default, requires the jwt verification method and is validated at startup. Fixes opencloud-eu#3171 Signed-off-by: Tobias Gurtzick <magic@wizardtales.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 27 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
Description
This adds an optional allow list of OIDC client ids for access tokens:
PROXY_OIDC_ALLOWED_CLIENT_IDS, oroidc.allowed_client_idsinproxy.yaml.When the list is configured, the proxy reads the client an access token was issued to from
client_id(RFC 9068). If that claim is absent, it usesazp(OpenID Connect, e.g. Keycloak). The value must match one entry exactly and case-sensitively. Tokens with a missing, empty, malformed or unlisted client are rejected during JWT verification, and the claims of a rejected token are not returned.It follows the structure of #3466:
access_token_verify_method: jwt.NewOIDCClient.Related Issue
Motivation and Context
Today the proxy accepts any access token the issuer signed, whichever client it was minted through.
Identity providers attach their login policy to the client: who may sign in, MFA, allowed networks. A token obtained through another, weaker client of the same IDP therefore bypasses the policy configured for OpenCloud. The same goes for a client created through dynamic client registration.
PROXY_OIDC_AUDIENCES(#3466) does not close this gap. A client can usually request any audience, so a token from a foreign client carriesaud: opencloudjust as well.client_idandazpare assigned by the IDP.The allow list is opt-in, so deployments that rely on dynamic client registration keep working unchanged.
How Has This Been Tested?
go.mod, vendored dependencies.go test -mod=vendor -race -count=1 ./pkg/oidc/... ./services/proxy/...passes.pkg/oidc/client_id_test.go:client_idandazp, any listed client, andclient_idtaking precedence overazp.azptogether with an allowedaud, case and exact-match handling, no wildcard, and missing, null, empty, number and array values.TestParseOIDCAllowedClientIDsin the proxy config parser covers YAML, ENV, ENV precedence, an empty ENV, trimming, blank entries and the incompatible verification method.Types of changes
Checklist