storeaudit

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package storeaudit keeps secrets out of the durable stores' bytes. It holds the audit of every stored kind (why its stored form carries no credential), the scan for token-shaped strings, and a real-shaped object of every kind, which the file store's and the object store's tests write and then scan: a kind that reaches the disk or the bucket without an audit line fails them, and so does a token marker anywhere in what they wrote.

Design: design/workstreams/dispatcher-runtime/LLD/store.md §File store ("What never reaches the disk"), and §Object store when present.

Index

Constants

This section is empty.

Variables

View Source
var Epoch = time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC)

Epoch is the fixtures' time.

View Source
var KindAudit = map[string]string{
	v1alpha1.KindEvent:               "normalised provider events: ids, refs, actors, facts and the untrusted raw payload; webhook payloads carry no credentials",
	v1alpha1.KindWorkItem:            "links, rule state, counters and decisions; no credentials",
	v1alpha1.KindTask:                "spec and status; spec.credentials describes the git token to mint (repo, permissions, TTL) and llm is always agent-local: the tokens themselves are minted per lease and never stored",
	v1alpha1.KindRun:                 "attempt, agent, progress events and the Result; the agent reports no credentials",
	v1alpha1.KindAgent:               "pool, owner login, capabilities and lending; the agent's token is the AgentToken kind, hashed",
	v1alpha1.KindEffect:              "the provider write asked and its result (URL or error); the identity is a name, its credentials stay in the provider adapter",
	v1alpha1.KindBudgetCounter:       "run, token and USD counts",
	v1alpha1.KindApproval:            "the question, approvers group and decisions (logins)",
	auth.KindSession:                 "named by the SHA-256 of the session id (never the cookie value), holds the GitHub login and no GitHub token",
	auth.KindUsedLoginState:          "named by the SHA-256 of a finished login's OAuth state id (never the state), holds the state's expiry",
	scheduler.KindLease:              "who holds which task until when and the usage deltas; git credentials are minted per lease and never stored, only their expiry",
	scheduler.KindAgentToken:         "the agent token as a sha256: hash of its secret part, never the token",
	scheduler.KindEnrollment:         "the pool, owner, host name and expiry an admin fixed, and the enrollment token as a sha256: hash, never the token",
	scheduler.KindAgentRefresh:       "the agent's refresh token as a sha256: hash, never the token, and the enrollment it came from",
	controllers.KindDelivery:         "the raw webhook as received, minus Authorization, Cookie and Proxy-Authorization (github ingress droppedHeaders); body and headers are dropped once handled. X-Hub-Signature-256 is an HMAC of the body, not the secret",
	controllers.KindEventStatus:      "an event id, a work item name and a time",
	controllers.KindDebounce:         "a rule's held actions (dispatch, set, notify...): catalog values and event facts, no credentials",
	controllers.KindTaskPrompt:       "the rendered prompt: catalog templates and untrusted provider text; no credential is templated into prompts",
	controllers.KindKillSwitch:       "a pause scope, target, actor and time",
	controllers.KindLinkObservations: "a work item's links (provider/ref) and the SHA-256 digests of their last observations; no provider text",
	objectstore.KindStoreLock:        "a lock's name, the holding store's instance id, a random per-hold id and an expiry; no credential",
	objectstore.KindTranscriptBlob:   "a transcript blob's run name, random blob id, size and put time; the blob itself is agent output, kept beside the log",
}

KindAudit is every kind the stores hold, with why its stored form carries no secret. A kind that reaches the disk or a bucket without an entry here fails the tests: add one (after checking), or keep the secret out of the store.

View Source
var TokenMarkers = []string{"ghs_", "gho_", "ghp_", "github_pat_", "sk-ant-", "-----BEGIN", "x-access-token:"}

TokenMarkers are the prefixes of the credentials the dispatcher handles.

Functions

func Delivery

func Delivery(id string) *controllers.Delivery

Delivery returns a real-shaped Delivery, as the GitHub ingress stores it.

func FindTokens

func FindTokens(data []byte) []string

FindTokens returns the token markers in data: in the raw bytes, in every JSON string (unescaped) and in every JSON string that is base64 (the encoding of []byte fields such as a Delivery's body), whether data is one JSON document or one per line.

func Fixtures

func Fixtures() []store.Object

Fixtures returns one real-shaped object of every kind the dispatcher stores, except the object store's own (StoreLock and TranscriptBlob), which it writes itself: a Lock and a PutTranscript make them.

func InternalKinds

func InternalKinds() map[string]store.Object

InternalKinds are the internal kinds the dispatcher stores, with their Go types: the same table as serve's (cmd/factory internalKinds, which a test keeps equal to this one).

func Lease

func Lease(name string) *scheduler.Lease

Lease returns a real-shaped Lease.

func ObjectStoreFixtures

func ObjectStoreFixtures() []store.Object

ObjectStoreFixtures returns a real-shaped object of each of the object store's own kinds, for a store that doesn't make them itself (the file store holds them only as registered kinds).

func Run

func Run(name string) *v1alpha1.Run

Run returns a real-shaped Run.

func Task

func Task(id, workItem string, phase v1alpha1.TaskPhase) *v1alpha1.Task

Task returns a real-shaped Task.

Types

This section is empty.

Jump to

Keyboard shortcuts

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