Documentation
¶
Overview ¶
Package workload verifies an external OIDC ID token and maps it to an existing agent. Same idea as Entra workload federation: trust an issuer, do not issue tokens, do not become an IdP.
Verification is github.com/coreos/go-oidc/v3. We do not parse signatures.
Index ¶
Constants ¶
const DefaultAudience = "veil"
DefaultAudience is the expected OIDC aud claim when a preset is used and no explicit --audience is provided.
Variables ¶
This section is empty.
Functions ¶
func ResolvePreset ¶
func ResolvePreset(opts PresetOpts) (issuer, subject, audience string, err error)
ResolvePreset expands a named OIDC federation preset (github-actions, vercel, fly, better-auth, clerk, workos) or validates raw (issuer, subject, audience).
func ValidateBinding ¶
ValidateBinding enforces Anthropic-style WIF safety rules at bind time.
func ValidateBindingWithClaims ¶
ValidateBindingWithClaims enforces WIF safety rules for (issuer, subject, claims):
- issuer must be https:// (or http:// on loopback for local dev/tests), with no userinfo, query, or fragment, and must not target private, link-local, multicast, or cloud-metadata (169.254.0.0/16) IP literals.
- subject may be an exact claim, a trailing-* prefix pattern whose prefix is >= 4 chars and ends on a delimiter (':', '/', '-', '.'), or bare "*" ONLY when claims includes an identity-scoping key (owner_id, project_id, namespace_id, email, oid, or repositoryUuid).
Types ¶
type Checker ¶
func (*Checker) Agent ¶
Agent verifies rawToken and returns the bound agent. Unknown issuers are rejected before any discovery request.
func (*Checker) VerifyIssuer ¶
func (c *Checker) VerifyIssuer(ctx context.Context, issuer string) VerifyResult
VerifyIssuer dry-runs an OIDC issuer URL: validates static SSRF/scheme rules and performs the live /.well-known/openid-configuration discovery round-trip through oidchttp.Context, reusing Checker.provider's singleflight cache.
type PresetOpts ¶
type PresetOpts struct {
Preset string
Issuer string
Subject string
Audience string
Repo string // github-actions: owner/repo
Ref string // github-actions: git ref (default refs/heads/main)
Org string // fly / vercel: org or team slug
App string // fly / vercel: app or project name
Env string // vercel: production, preview, development, or * (default production)
}
PresetOpts carries the inputs for ResolvePreset. Explicit Issuer/Subject/ Audience win when set; presets fill the canonical issuer URL and subject claim format for common workload & auth identity providers.
type VerifyCode ¶
type VerifyCode string
VerifyCode is a structured diagnostic code for OIDC issuer dry-runs and policy checks (matching @oidc/verify and Anthropic WIF Connect Workload).
const ( CodeOK VerifyCode = "ok" CodeInvalidIssuer VerifyCode = "invalid-issuer" CodeDiscoveryFailed VerifyCode = "discovery-failed" )
type VerifyResult ¶
type VerifyResult struct {
Code VerifyCode `json:"code"`
Issuer string `json:"issuer"`
Message string `json:"message"`
}