Documentation
¶
Overview ¶
Package credentialbroker defines metadata-only credential management and the private gateway resolution contract. Secret values are never management data.
Index ¶
- Constants
- Variables
- func LocalUpstream(raw string, expectedPort int) bool
- func NameValid(s string) bool
- func ProviderSupported(kind string) bool
- func StripHeaders(h http.Header)
- func ValidValue(value []byte) bool
- type Binding
- type Delivery
- type Provider
- type Registry
- type ResolutionRequest
- type Source
- type Value
Constants ¶
const ( Audience = "mcp-runtime-credential-broker" ResolvePath = "/api/v1/credential-resolutions" ManagementPath = "/api/v1/credentials" HeaderPrefix = "X-Mcp-Credential-" MaxValueBytes = 64 << 10 )
Variables ¶
var ( ErrDenied = errors.New("credential access denied") ErrConflict = errors.New("credential revision conflict") // ErrTokenRejected marks a definite workload-token rejection (not a transient // TokenReview/API failure). ErrTokenRejected = errors.New("workload token rejected") ErrNotFound = errors.New("credential metadata not found") )
var ErrProviderNotSupported = errors.New("credential provider is not yet supported; only the kubernetes provider is available")
ErrProviderNotSupported is returned for provider kinds that are recognised but not enabled. Only the Kubernetes Secret provider is supported today.
Functions ¶
func LocalUpstream ¶
LocalUpstream prevents credential-enabled gateways from delivering a secret to an arbitrary configured network destination. Plain HTTP is confined to the server process in the same Pod's loopback network namespace.
func ProviderSupported ¶
ProviderSupported reports whether a provider kind is enabled. It is the one gate for source validation and for the reader Registry. To enable another provider later: add its kind here, keep its reference validation in validateReference, and register its Provider (reader) in the platform API.
func StripHeaders ¶
func ValidValue ¶
Types ¶
type Binding ¶
type Binding struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Source string `json:"source"`
Server string `json:"server"`
ServerUID string `json:"server_uid"`
Tools []string `json:"tools"`
HumanID string `json:"human_id"`
AgentID string `json:"agent_id"`
TeamID string `json:"team_id"`
SessionID string `json:"session_id,omitempty"`
Header string `json:"header"`
Disabled bool `json:"disabled,omitempty"`
Revision int64 `json:"revision"`
}
Binding narrows a source to one immutable workload and explicit tools and subjects. HumanID and AgentID are mandatory; TeamID binds directory authority.
type Delivery ¶
Delivery is PRIVATE: only the server-authenticated resolution endpoint may serialize it. Values have no String method and must never be logged.
type Registry ¶
Registry maps a provider kind to the Provider (reader) the broker resolves source references through. Only supported kinds can be registered, and Reader never returns a reader for an unsupported kind.
type ResolutionRequest ¶
type Source ¶
type Source struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Provider string `json:"provider"`
Resource string `json:"resource"`
Key string `json:"key,omitempty"`
Version string `json:"version,omitempty"`
UserID string `json:"user_id,omitempty"`
TeamID string `json:"team_id,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Revision int64 `json:"revision"`
}
Source is an administrator-approved exact backing reference. No provider token, password, credential payload or arbitrary endpoint belongs here.