Documentation
¶
Overview ¶
Package oidc lets a CI job trade an OIDC token for a short-lived gateway key (#4531, xazaj on X: GitHub Actions' token in place of a key kept in the repository's secrets). The user writes a rule: which issuer, which audience, which claims (repository, ref, environment…), and which of their gateway keys the key is issued under; a token that is signed by that issuer and matches every claim gets a key, held to everything that gateway key is held to and living no longer than the rule says.
No rule, no exchange: none is made by default.
Index ¶
Constants ¶
const DefaultTTL = time.Hour
DefaultTTL is how long a key lives when the rule says nothing.
const GitHub = "https://token.actions.githubusercontent.com"
GitHub is GitHub Actions' issuer, a rule's when it names none.
Variables ¶
var Client = &http.Client{Timeout: 10 * time.Second}
Client fetches the issuers' keys; a variable for the tests, which serve them from an httptest TLS server and never reach the network.
var Now = time.Now
Now is the clock tokens are judged by.
Functions ¶
Types ¶
type Rule ¶
type Rule struct {
ID string `json:"id"`
// Key is the id of the gateway key the keys are issued under; it must
// be let issue keys (magpie gateway-key issuer <id> on).
Key string `json:"key"`
Issuer string `json:"issuer"`
// Audience is the token's aud the rule takes: by default
// "magpie-<id>", so a token asked for one rule opens no other.
Audience string `json:"audience"`
// Claims each name a claim and the value it must have: exact, or a
// glob as path.Match reads it ("refs/heads/release/*").
Claims map[string]string `json:"claims"`
// TTL is the longest a key it issues lives, in seconds.
TTL int64 `json:"ttl"`
}
Rule is one way in.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package oidctest serves an OIDC issuer on an httptest TLS server for the tests of package oidc and the gateway: its discovery document, its keys and the tokens it signs, never reaching the network.
|
Package oidctest serves an OIDC issuer on an httptest TLS server for the tests of package oidc and the gateway: its discovery document, its keys and the tokens it signs, never reaching the network. |