Skip to content

Add OIDC issuer and federation rule validation - #601

Open
rgarcia wants to merge 1 commit into
mainfrom
hypeship/oidc-federation-lib
Open

rgarcia wants to merge 1 commit into
mainfrom
hypeship/oidc-federation-lib

Conversation

@rgarcia

@rgarcia rgarcia commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

First of two stacked pull requests that let a workload trade an OIDC identity token for a short-lived Hypeman API token, so no long-lived token has to be stored with it. This one adds the trust model and the verifier. #602 adds the endpoint that uses them.

  • lib/oidcfederation: operator-configured issuers (who signs) and federation rules (which workload of an issuer is accepted, and which permissions it receives), plus a verifier for the identity tokens those issuers sign.
  • Presets for GitHub Actions, AWS, Google Cloud, Microsoft Entra, Kubernetes and custom OIDC issuers. A rule's matcher must be its issuer's preset, so a rule cannot trade a provider's mandatory identity checks for a generic matcher. GitHub rules, for example, must pin the numeric repository and owner IDs, a workflow, and a ref or environment.
  • Config: an optional oidc block, or OIDC in the environment as one JSON document that replaces it. Unknown keys inside the block are rejected, and an invalid block stops the server from starting, like an empty jwt_verification_secrets entry does today.

Behavior

Nothing consumes the rules yet. The only change on its own is that a server with an invalid oidc block refuses to start; without the block nothing changes.

Verifier

  • The token's iss must equal the configured issuer URL before any key is fetched. Key locations come from configuration only.
  • Keys come from discovery, an explicit URL or inline JWKs. They are fetched over HTTPS from public addresses only, without redirects or an ambient proxy, cached for five minutes, with bounded forced refreshes on an unknown kid. Keys published for another purpose (encryption) are skipped.
  • Asymmetric algorithms only, and RS256 only for GitHub, Google and Entra. Exactly one aud, required exp and iat, a maximum incoming lifetime, and a token ID for single-use issuers.
  • go-jose/v4 becomes a direct dependency at v4.1.5, which rejects a low-order Ed25519 key that v4.1.4 accepts.

Notes for review

  • Rule permissions must be listed explicitly; * is rejected, so a federated token can never read as a full-access token.
  • There is no match.repository: a repository name is pinned with a /repository claim condition, next to the mandatory numeric IDs.
  • Design notes for the whole stack: https://gist.github.com/rgarcia/d06b17f03b818f3d4dae431b5efcab9d

Testing

  • go test ./lib/oidcfederation/ ./cmd/api/config/ (unit tests for every preset, the verifier and key cache, key fetching, and config loading from YAML and the environment).
  • go vet and gofmt clean on the touched packages.
  • The full make test suite was not run locally (it needs KVM and the hypervisor binaries); CI runs it.

Reviewed with sol-loop: 3 rounds with openai-codex/gpt-6.2-sol on extra-high reasoning. Sol verdict: approved.

Add lib/oidcfederation: operator-configured OIDC issuers and federation
rules, a verifier for the identity tokens they sign, and per-provider
matchers for GitHub Actions, AWS, Google Cloud, Microsoft Entra,
Kubernetes and custom OIDC issuers.

The server reads an optional oidc config block (or an OIDC JSON
environment override), rejects unknown keys inside it, and fails to
start when it is invalid. Nothing consumes the rules yet.
@rgarcia
rgarcia added this pull request to stack #603 November 23, 2026 18:52
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub.com/​go-jose/​go-jose/​v4@​v4.1.59885100100100

View full report

@sjmiller609 sjmiller609 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering about a design decision to issue hypeman tokens, versus direct auth.

what if we use #601 to verify the workload’s OIDC token directly and apply the rule’s permissions on each request? /oauth/token makes clients depend on Hypeman issuing a token, so it needs a secret that can issue credentials. In theory we could be using private / public keys so Hypeman could authenticate keys without the secret, and the design of issuing the Hypeman key complicates moving away from shared jwt_secret to a model where hosts hold only public keys and can verify API tokens but can’t mint them.

WDYT

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants