workload

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func ValidateBinding(issuer, subject string) error

ValidateBinding enforces Anthropic-style WIF safety rules at bind time.

func ValidateBindingWithClaims

func ValidateBindingWithClaims(issuer, subject string, claims map[string][]string) error

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

type Checker struct {
	Store store.Store
	// contains filtered or unexported fields
}

func New

func New(s store.Store) *Checker

func (*Checker) Agent

func (c *Checker) Agent(ctx context.Context, rawToken string) (protocol.Principal, error)

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL