register

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

README

varwof-register

Part of the Varwof AIC suite — flagship repos: aic-agent · aic-verifier · aic-exec

Capability Registry — standard capability definition, validation, and authz.json generation for fine-grained AI Agent permission control.

⚠️ Preview — Not for production use. APIs and features may change before official release.

License Go Reference

中文

What is varwof-register?

A registry of standard capability definitions for fine-grained AI Agent permission control. Capability specifications are carried by executable JSON files (capability.json), support PKCS#7 signatures, and can generate authz.json authorization policies (gen-authz tool).

Quick Start

cd register

# Capability data lives in the sibling capability module.
export CAPABILITY_DIR=../capability/data

# List all capabilities
go run ./cmd/gen-authz -list $CAPABILITY_DIR/varwof/core-v1/v1.json

# Generate authz.json
go run ./cmd/gen-authz -out /tmp/authz.json $CAPABILITY_DIR/varwof/core-v1/v1.json

# Validate / search capabilities
go run ./demo -data $CAPABILITY_DIR validate varwof/core-v1:cert:issue
go run ./demo -data $CAPABILITY_DIR search issue

Capability files are addressed as <vendor>/<product>-v<major>/v<major>.json, so the paths above carry the -v1 product suffix.

Installation

go get github.com/varwof/register@v0.10.0

Directory Structure

register/
├── semantics/        # CLC-v1 decision layer (grammar, entailment, decision)
├── schemeadmin/      # CLC-SCHEME-v1 administration (package, transition, confirm)
├── catalog/          # signed capability catalog plane (catalog, delta, discovery)
├── projection/       # foreign-evidence → CLC-REQUIREMENT-v1 projection (CLC-E)
├── ruleexec/         # execution layer (rules, conditions, flow, budgets, SQL)
├── schema.go / registry.go / validator.go / mincap.go
├── genauthz.go / gendocs.go / sign.go / loader.go / params_validate.go
├── cmd/              # tools and conformance runners (see the table below)
├── demo/             # capability demo (needs -data <capability data dir>)
├── demo/rule-exec/   # rule-exec e2e demo + rule.schema.json + TS mirror
├── docs/             # user docs
└── dev-docs/         # developer docs
cmd/ tools
Command Purpose
gen-authz generate authz.json from a capability scheme (-list prints the scheme)
gen-docs render capability documentation
gen-capability scaffold a new capability scheme
gen-backfill backfill derived fields into existing schemes
gen-rule sign a ruleexec rule against its signer grant
sign / verify PKCS#7 sign / verify a capability file
scheme-admin scheme administration: check/confirm a CLC-SCHEME-PACKAGE-v1, verify package/transition/delegation signatures, root rotation threshold, signed approvals, capability ids; --state-out persists an accepted state with signed tombstones
gen-catalog validate a catalog and write its deterministic JCS form (the bytes to sign)
sign-catalog detached PKCS#7 sign a catalog after binding producer to the signer's AIC
verify-catalog verify a signed catalog against policy/state and advance the accepted generation
apply-catalog-delta verify a signed delta against an exact base generation/digest, accepted state, trust roots and policy, then write the next catalog
record create and re-verify a Decision Record (-verify, -envelope)
size-report byte budget of the optional artifacts (record / envelope / challenge)
vectors-run CLC-A authorization corpus
evidence-vectors-run CLC-E evidence corpus
crosswalk-vectors-run carrier-binding crosswalk corpus
resolve-vectors-run §8.5 Resolve corpus
param-bounds-vectors-run §6.5 parameter bounds corpus
param-bounds-meet-vectors-run §6.6 BoundMeet corpus
constraint-union-vectors-run §7.1 ConstraintUnion corpus
contains-vectors-run §13 Contains containment corpus
contains-crosswalk-run CLC-D cross-vendor containment crosswalk corpus (incl. §13.8.1 obligation-3 out_of_scope check)
mode-lattice-vectors-run §13.4.5 AIC-JWT DA delegation-mode pre-check corpus (profile-owned)
reason-collapse-vectors-run §13.5 reason-code collapse policy corpus + production-layer cross-check
authorize-chain-vectors-run §13.11 AuthorizeWithChain corpus
semantics/fuzz_runner differential fuzz target (reads a JSONL case file)

Every runner reads its corpus from the environment and exits non-zero on any mismatch; see Conformance corpora.

Capability definitions themselves are not in this repository; they live in the separate varwof/capability module (data/<vendor>/<product>-v<major>/v<major>.json).

Provenance and licensing

semantics/ and the rest of this repository are written from published specifications and this project's own language text; no third-party code was copied. Where a specification's rule is normative here, it is cited by section and restated in this project's own words rather than reproduced, and the Internet-Drafts referred to are referenced as work in progress, not as normative sources. The conformance corpora live in varwof/capability (data/_vectors/clc-v1/).

CLC-v1 semantics (semantics/) and conformance runner

Two orthogonal axes, not a stack: the decision axis decides whether a call counts as doing something that was authorized, the execution axis decides whether to act now and what to record. CLC owns the decision axis; ruleexec/ owns the execution axis (see docs/capability-language-layers.md). Across both run the authorization face ("what may be done") and the evidence face ("what was done, and the evidence for it"). A draft such as ACA is a composition contract over these two axes, not a third layer.

semantics/ is the Go reference implementation of CLC-v1, in two groups:

Core semantics — required by the conformance classes:

Function Purpose
ValidateCapabilityID §3 grammar (v1: literal + trailing * only)
Entails(grant, op) authorization binding (§6)
Intersect(grants...) effective grant set (§7)
ConstraintUnion(chain...) derived constraint projection of a chain (§7.1)
Authorize(grant, op) decision function (§9)
Combine(alg, decisions...) conflict resolution across sources (default deny-overrides)
Discharge(decision, understood) consumer-side obligation rule (§8.4 + XACML §2.13/§7.2.1)
EvaluateEvidenceConstraint evidence-side value grammar and three-valued evaluation (§8.2/§10)
Requirement / EvaluateRequirement the relying party's sufficiency bar (CLC-REQUIREMENT-v1)
ComputeActionID / Match instance identity and binding (§4.2/§6.4)
CanonicalJSON JCS canonicalization for digests

Delegation containment (CLC-D) — the chain face, §13:

Function Purpose
Contains(parent, child) the containment relation over (identifier, parameters) (§13.4–§13.5)
AuthorizeWithChain(chain, op) fused chain check: per-hop Contains, then Authorize(Intersect(chain)) (§13.11)

Input boundaries — what a params object must satisfy before any layer runs. Callers that skip these get no §9.3 protection:

Function Purpose
ValidateRawParams(raw) the raw-text entry (§6.2, §9.3 layer 2): size/depth, duplicate keys, number shape, malformed Unicode
ValidateGrantParams / ValidateOperationParams the decoded-object entry (§6.2 step 6) on a map[string]any
ValidateParamBounds(bounds, params) one-representation binding rule for param_bounds (§6.5)
ValidateConstraint(c) constraint grammar and known types (§8.1)

Both parameter entry points apply the same §6.2 caps and the same invalid_params_number denial, so an integer outside the I-JSON interoperable range (magnitude above 2^53−1) is refused rather than rounded, at either entry.

Optional profile — carried, not required: a deployment that only decides online pays none of this. Everything here is off unless a caller turns it on:

Function Purpose
Record / RecordWith Decision Record: frozen inputs + verdict, independently re-computable
RecordWithContext / VerifyAsOf RATS §10 freshness input (explicit clock / nonce / epoch)
SourceChain / StandingOn the authorization sources a decision rested on (byte-backed edges)
Envelope / PAE DSSE + in-toto transport for a record (cmd/record -envelope)
BuildChallengeFromDecision the machine-readable "what is still missing" (CLC-CHALLENGE-v1)
DecisionRecord.Verify() re-run the language over a record and check digest, verdict and residual obligations

Failures are fail-closed and carry stable reason codes (§9.4); when several conditions fail, the normative ordering (§9.3) selects the single reported code.

This implementation declares the revision named by the Go constant semantics.CLCRevision — the single source of truth for it — and applies the compatible reading of §12.1: an input whose declared major equals ours and whose declared minor is ≤ ours is evaluated normally; a higher minor fails closed with unsupported_language_revision. It is never silently downgraded.

Conformance corpora

Every corpus is published in varwof/capability under data/_vectors/, and every runner asserts verdict and normative reason and exits non-zero on any mismatch. Point a runner at a corpus with the environment variable it reads:

export CLC_VECTORS=../capability/data/_vectors/clc-v1/vectors.json
go run ./cmd/vectors-run/
Corpus Cases Runner Environment variable
clc-v1/vectors.json 154 cmd/vectors-run CLC_VECTORS
clc-v1/evidence-vectors.json 32 cmd/evidence-vectors-run CLC_EVIDENCE_VECTORS
clc-v1/crosswalk-vectors.json 13 cmd/crosswalk-vectors-run CLC_CROSSWALK_VECTORS
clc-v1/param-bounds-vectors.json 49 cmd/param-bounds-vectors-run CLC_PARAM_BOUNDS_VECTORS
clc-v1/param-bounds-meet-vectors.json 27 cmd/param-bounds-meet-vectors-run CLC_PARAM_BOUNDS_MEET_VECTORS
clc-v1/constraint-union-vectors.json 12 cmd/constraint-union-vectors-run CLC_CONSTRAINT_UNION_VECTORS
clc-v1/resolve-vectors.json 26 cmd/resolve-vectors-run CLC_RESOLVE_VECTORS
clc-d/containment-vectors.json 64 cmd/contains-vectors-run CLC_D_VECTORS
clc-d/containment-crosswalk-vectors.json 45 cmd/contains-crosswalk-run CLC_D_CROSSWALK_VECTORS
clc-d/reason-collapse-vectors.json 3 cmd/reason-collapse-vectors-run CLC_D_REASON_COLLAPSE_VECTORS
clc-d/profile-owned/aic-jwt-da-mode-lattice-vectors.json 5 cmd/mode-lattice-vectors-run CLC_D_MODE_VECTORS
clc-d/authorize-chain-vectors.json 15 cmd/authorize-chain-vectors-run CLC_AUTHORIZE_CHAIN_VECTORS

The CLC-A set also carries the §7.1 UTF-8 collation (2) and §6.5 type-sensitive equality (11) cases, plus the property corpora (1184 P11 cases, 500 meet-invariant cases, 784 containment-closure cases) — those run from go test ./semantics/ rather than a standalone runner.

These corpora are portable: the same files are consumed by the other same-author implementations, so a divergence is visible from both sides —

Implementation Language Entry
varwof/register Go this module, cmd/*-run
varwof/aic-capability-demo Python vectors-run.py, property_test.py
varwof/aic-capability-demo/ts TypeScript ts/*-run.ts (Node, zero dependencies)

CI (.github/workflows/clc-conformance.yml) clones varwof/capability and runs gofmt / go vet / go test plus every runner on each push and PR.

Input boundaries

Both parameter entry points apply the same §6.2 caps and the same invalid_params_number denial, so an integer outside the I-JSON interoperable range (magnitude above 2^53 − 1) is refused rather than rounded, at either entry. The bound reaches the max_rows constraint operand as well — §8.1 does not exempt it from layer-7 closure — and an over-bound ceiling is refused with invalid_constraint, the §8.1 reason code.

Byte budget of the optional artifacts is reproducible (record / envelope / challenge sizes, and the constraint strings that drive certificate size):

go run ./cmd/size-report/
Decision Records (semantics/record.go)

Record freezes what was decided — the canonical inputs, the CLC revision, the verdict, the reason and the residual obligations — behind a SHA-256 digest of the inputs, so a holder of the record alone can re-run the same revision and get the same answer. Verify does exactly that, and fails closed with record_input_digest_mismatch, record_verdict_mismatch, record_operation_count or record_unsupported_revision on anything that does not reproduce.

go run ./cmd/record input.json          # {"grants":[...],"operation":{...}} -> record
go run ./cmd/record -verify record.json # re-run the language over a record

Note: CanonicalJSON implements RFC 8785 (JCS) — object members ordered by UTF-16 code units, §3.2.2.2 string escaping, ECMAScript Number::toString — so clc-action: identifiers and Decision Record digests agree with any other JCS implementation. (Before rev CLC-1.6 it was json.Marshal, whose HTML escaping made &/</> digests non-JCS.) Constraint evaluation results and authorization source chains are not part of a record yet — see dev-docs/README.md.

Execution layer (ruleexec/)

ruleexec runs signed rules: op | if | seq control flow over runtime context conditions, a fixed budget (steps / depth / nesting) and fully parameterized SQL generation. The execution language deliberately contains no loops, no retries, no time-in and no contains — those belong to the caller/job orchestrator or to authorization constraints.

Ecosystem

graph TB
    subgraph varwof["varwof Ecosystem"]
        core["core"]
        gw["gateway"]
        cap["capability<br/>JSON Data"]
        reg["register<br/>Capability Registry"]
    end
    reg -->|loads| cap
    core -->|validates against| reg
    gw -->|validates against| reg
    reg -.->|generates| core

register is the capability specification layer of the varwof ecosystem, connecting capability (data) with core/gateway (runtime validation). This project is a member of the Open Invention Network.

Repository What it is
varwof/capability the capability data, the CLC-v1 specification text and every conformance corpus this module reads (中文)
varwof/aic-capability-demo the Python and TypeScript ports that consume the same corpora (中文)
Homepage https://varwof.com
Community https://varwof.org
IETF Draft draft-wei-aic-identity-cert
License Apache-2.0
Member Open Invention Network

Documentation

Overview

Byte-precise params_schema_digest backfill for capability data files.

The capability JSON files under vendor/product/v*.json carry a JSON Schema in each capability's params_schema field. To detect drift (someone editing the schema out of band), gen-backfill inserts a params_schema_digest right after every params_schema, leaving every other byte untouched.

Package register provides scheme registration and authorization generation for the varwof project.

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.10.0"

Version is the package version, set via -ldflags -X github.com/varwof/register.Version=x.y.z.

Functions

func BackfillParamsSchemaDigests added in v0.2.0

func BackfillParamsSchemaDigests(data []byte) ([]byte, error)

BackfillParamsSchemaDigests inserts a params_schema_digest field directly after each capability's params_schema field in a capability JSON document, preserving all other bytes exactly (key order, whitespace, omitempty zero-values).

The digest is SHA-256 (hex-encoded) of the canonical (compacted) JSON of the params_schema value, so any semantic change to the schema is detected as drift while whitespace-only edits are not.

A params_schema that already has a params_schema_digest declared immediately after it is verified for drift instead of modified: a stale digest returns an error. Documents without any params_schema are returned unchanged.

func Deduplicate

func Deduplicate(caps []string) []string

Deduplicate removes duplicate capabilities from a list.

func FilterByScheme

func FilterByScheme(caps []string, schemeID string) []string

FilterByScheme returns only capabilities belonging to a specific scheme.

func FormatCapability

func FormatCapability(schemeID, capID string) string

FormatCapability formats a capability as "vendor/product:capability_id".

func FormatSchemeID

func FormatSchemeID(vendor, product string) string

FormatSchemeID formats vendor and product into "vendor/product".

func GenAuthzToFile

func GenAuthzToFile(cfg GenAuthzConfig, outputPath string) error

GenAuthzToFile generates and writes the authz.json file.

func GenDocs

func GenDocs(def *SchemeDefinition) (string, error)

GenDocs generates a markdown permission documentation from a capability.json scheme. The documentation targets both human readers and AI models: fully describing each capability's semantics, parameter constraints, wildcard rules, role and grants mappings, serving as the authoritative reference for AI to generate minimal privilege capability sets.

Output markdown structure:

  • Product overview + capability catalog table
  • Detailed capability semantics (summary/usage/when_not/examples/parameters/related)
  • Wildcard and matching rules
  • Role and grants mapping
  • Least privilege principle guidelines

func GenDocsToFile

func GenDocsToFile(def *SchemeDefinition, outputPath string) error

GenDocsToFile generates markdown permission documentation and writes it to a file.

func GetSignerCert

func GetSignerCert(p7sPath string) (*x509.Certificate, error)

GetSignerCert extracts the signer certificate from a .p7s file.

func HasSignature

func HasSignature(capPath string) bool

HasSignature checks if a .p7s file exists for the given capability file.

func ListCapabilities

func ListCapabilities(def *SchemeDefinition) []string

ListCapabilities returns all capability IDs for a scheme, sorted.

func LoadAllSchemes

func LoadAllSchemes(root string) (map[string]*SchemeDefinition, error)

LoadAllSchemes loads all capability JSON files under a directory tree. Expected structure: root/vendor/product/v*.json

func LoadCertFile

func LoadCertFile(path string) ([]*x509.Certificate, error)

LoadCertFile reads all certificates in a certificate chain from a PEM file.

func LoadEmbedded

func LoadEmbedded() (map[string]*SchemeDefinition, error)

LoadEmbedded is removed: capability data now lives in the separate capability module and is loaded from a directory on disk. Use LoadFromDir or LoadFromBoth with a path into the capability data tree.

func LoadFromBoth

func LoadFromBoth(diskDir string) (map[string]*SchemeDefinition, error)

LoadFromBoth requires a non-empty disk directory. Embedded schemes are gone; disk is the only source. An empty dir returns an error.

func LoadFromDir

func LoadFromDir(root string) (map[string]*SchemeDefinition, error)

LoadFromDir loads all capability JSON files from a directory tree on disk. Expected structure: root/vendor/product/v*.json

func LoadFromFS

func LoadFromFS(fsys fs.FS) (map[string]*SchemeDefinition, error)

LoadFromFS loads all capability JSON files from an embedded filesystem.

func LoadTrustRoots

func LoadTrustRoots(path string) ([]*x509.Certificate, error)

LoadTrustRoots loads PEM certificates from a file or directory.

func MatchCapability

func MatchCapability(id, pattern string) bool

MatchCapability reports whether a capability ID is covered by a grant pattern using the CLC-v1 §9.3 segment grammar (audit 2026-09-16, R17): an exact match, or a trailing `*` segment that spans one or more further segments. `**`, `?`, bare `*`, and mid-segment globs are not part of the grammar and never match — the old filepath.Match behavior blessed near-everything.

func ParseCapability

func ParseCapability(s string) (schemeID, capID string, ok bool)

ParseCapability parses "vendor/product:capability_id" into scheme and capID. capability_id may itself contain colons (e.g., "query:users").

func ParseSchemeID

func ParseSchemeID(schemeID string) (vendor, product string, ok bool)

ParseSchemeID parses "vendor/product" into vendor and product.

func SignCapability

func SignCapability(certPath, keyPath, capPath, outputPath string) error

SignCapability signs a capability JSON file using PKCS#7 detached signature. certPath: PEM certificate chain (signer cert + intermediates) keyPath: PEM private key capPath: path to capability.json outputPath: path to write .p7s file (defaults to capPath + ".p7s")

func ValidateSchemeID

func ValidateSchemeID(schemeID string) error

ValidateSchemeID checks if scheme_id follows the naming convention. Public: vendor/product (e.g., oracle/mysql, varwof/core) Private: x-vendor/product (e.g., x-acme/order)

func ValidateSchemeParams added in v0.2.0

func ValidateSchemeParams(scheme, capability string, raw json.RawMessage) error

ValidateSchemeParams validates a capability's parameters against the CONTRACT OF THE SCHEME that defines them. Scheme-specific structural rules live here, with the scheme, and are NOT re-implemented by consumers such as the rule execution engine (see ruleexec and docs/capability-language-layers.md).

Generic capability semantics (nulls, explicit empty bounds, subset rules) are defined once by CLC-v1 and validated via github.com/varwof/register/semantics.

func VerifyCapabilityPKCS7

func VerifyCapabilityPKCS7(capPath string, trustRoots []*x509.Certificate) error

VerifyCapabilityPKCS7 verifies a capability JSON against its .p7s signature. trustRoots: PEM root/intermediate certificates for chain verification.

func VerifyCapabilityPKCS7Cert added in v0.2.0

func VerifyCapabilityPKCS7Cert(capPath string, trustRoots []*x509.Certificate) (*x509.Certificate, error)

VerifyCapabilityPKCS7Cert verifies a capability JSON against its .p7s signature and returns the SIGNER certificate. Verification always requires at least one trust root: signing without roots is refused because the signer certificate is recovered from the blob itself and is therefore attacker-pickable. Callers that must bind the published content to the signer's own authority (e.g. ruleexec, which requires the rule capability to be covered by the signer's AIC grant) use this variant.

func WriteScheme

func WriteScheme(def *SchemeDefinition, path string) error

WriteScheme serializes a scheme definition as JSON and writes it to a file (for gen-authz tests/rewrites).

Types

type AuthzDocument

type AuthzDocument struct {
	Version              string                    `json:"version"`
	Roles                map[string]AuthzRoleDef   `json:"roles"`
	OUMapping            map[string]string         `json:"ou_mapping"`
	GatewayNamespaces    map[string]GatewayNSDef   `json:"gateway_namespaces,omitempty"`
	CapabilityParameters map[string]map[string]any `json:"capability_parameters,omitempty"`
}

AuthzDocument is the complete authz.json document generated by gen-authz. The top-level structure is compatible with core/auth.Policy; capability_parameters is an extension field (core's encoding/json deserialization ignores unknown fields).

func GenAuthz

func GenAuthz(cfg GenAuthzConfig) (*AuthzDocument, error)

GenAuthz generates an authz.json document from capability.json schemes.

Mapping rules:

  • Roles from the primary scheme (first) become authz.json roles (grants preserved as-is)
  • Each role's OUs are expanded into ou_mapping (OU → role name)
  • Role names with namespace prefixes (e.g. gateway:admin) are aggregated into gateway_namespaces
  • Capability parameter defaults from all schemes are aggregated into capability_parameters

type AuthzRoleDef

type AuthzRoleDef struct {
	DisplayName string   `json:"display_name"`
	Profiles    []string `json:"profiles"`
	Grants      []string `json:"grants"`
	Scope       []string `json:"scope,omitempty"`
}

AuthzRoleDef is a role entry for generating authz.json (compatible with core Policy.RoleDef).

type CapabilityClaim

type CapabilityClaim struct {
	SchemeID      string         `json:"scheme_id"`  // vendor/product
	Capability    string         `json:"capability"` // capability_id (may contain wildcards)
	Parameters    map[string]any `json:"parameters,omitempty"`
	Rationale     string         `json:"rationale,omitempty"`      // Authorization rationale from AI
	SchemeVersion string         `json:"scheme_version,omitempty"` // pinned scheme version (P1-4)
}

CapabilityClaim is a single AI-generated capability claim (pending validation/minimal privilege detection).

func ParseCapabilityClaims

func ParseCapabilityClaims(data []byte) ([]CapabilityClaim, error)

ParseCapabilityClaims parses a list of capability claims from JSON data. Expected structure: [{"scheme_id":"varwof/core-v1","capability":"cert:issue",...}]

type CapabilityEntry

type CapabilityEntry struct {
	ID          string                  `json:"id"`
	Description string                  `json:"description"`
	Parameters  map[string]ParameterDef `json:"parameters,omitempty"`
	// ParamsSchema carries a JSON Schema document for structured,
	// nested capability parameters (e.g. database tables/columns/
	// row_filter). Additive: schemes using only the flat ParameterDef
	// model leave it unset.
	ParamsSchema json.RawMessage `json:"params_schema,omitempty"`
	// AI-friendly semantic description fields (used by gen-docs to generate markdown permission docs).
	// These fields help LLMs understand the exact purpose of each capability,
	// enabling them to generate minimal privilege capability sets per task.
	Summary  string   `json:"summary,omitempty"`  // One-line summary (defaults to Description)
	Usage    string   `json:"usage,omitempty"`    // When this capability is needed (typical scenarios)
	WhenNot  string   `json:"when_not,omitempty"` // When this capability should NOT be granted (avoid over-provisioning)
	Examples []string `json:"examples,omitempty"` // Typical usage examples
	Related  []string `json:"related,omitempty"`  // Related capability IDs (collaboration/alternative relationships)
}

CapabilityEntry defines a single capability within a scheme.

type ClaimResult

type ClaimResult struct {
	Claim CapabilityClaim
	Valid bool
	Error string // Reason when Valid=false
}

ClaimResult is the validation result for a single claim.

type FieldError added in v0.10.0

type FieldError struct {
	Path string
	Code string
	// contains filtered or unexported fields
}

FieldError is a structured parameter refusal: the offending path and a stable code, with the human message kept for compatibility (audit R-8).

func (*FieldError) Error added in v0.10.0

func (e *FieldError) Error() string

type GatewayNSDef

type GatewayNSDef struct {
	DisplayName string   `json:"display_name"`
	Prefix      string   `json:"prefix"`
	Grants      []string `json:"grants"`
}

GatewayNSDef is a gateway namespace entry for generating authz.json.

type GenAuthzConfig

type GenAuthzConfig struct {
	// SchemePaths is the list of capability.json file paths to merge.
	// The primary scheme (providing roles) must be the first; other schemes only contribute capability catalogs.
	SchemePaths []string
	// When VerifySignature is true, enforce signature verification if .p7s exists; fail on error.
	// Files without .p7s only error when VerifyRequired is true.
	VerifySignature bool
	// When VerifyRequired is true, capability files missing .p7s signature fail immediately.
	VerifyRequired bool
	// TrustRootsPEM is the trust root certificates for signature verification (PEM file paths).
	TrustRootsPEM []string
	// Version is the generated authz.json version field (default "v2").
	Version string
	// NamespacePrefix is appended to role names to generate gateway namespace prefix role grants,
	// e.g. "gateway" → gateway_namespaces["gateway:"].
	// By default, extracts the "gateway:xxx" prefix from all Roles in the primary scheme.
	NamespacePrefix string
}

GenAuthzConfig is the input configuration for GenAuthz.

type MinSetReport

type MinSetReport struct {
	// ValidClaims are valid and non-redundant claims.
	ValidClaims []CapabilityClaim
	// InvalidClaims are invalid claims (illegal capability/illegal parameters/unknown scheme).
	InvalidClaims []ClaimResult
	// RedundantClaims are claims covered by a wildcard or duplicated (recommended to remove).
	RedundantClaims []ClaimResult
	// MissingGranted are capabilities that are claimed but not covered by any role grant
	// (the AI-generated set references a capability not authorized for this identity).
	MissingGranted []string
	// AllowedPatterns are the grants actually held by the identity (wildcards expanded).
	AllowedPatterns []string
	// IsMinimal is true when the set is already minimal privilege.
	IsMinimal bool
}

MinSetReport is the complete report for minimal privilege validation.

type ParameterDef

type ParameterDef struct {
	Type        string      `json:"type"`
	Description string      `json:"description,omitempty"`
	Default     interface{} `json:"default,omitempty"`
	Min         interface{} `json:"min,omitempty"`
	Max         interface{} `json:"max,omitempty"`
	Enum        []string    `json:"enum,omitempty"`
	Required    bool        `json:"required,omitempty"`
}

ParameterDef defines a parameter for a capability.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all loaded scheme definitions.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty registry.

func NewRegistryFromBoth

func NewRegistryFromBoth(diskDir string) (*Registry, error)

NewRegistryFromBoth requires a non-empty disk directory and creates a registry pre-loaded from it.

func NewRegistryFromDisk

func NewRegistryFromDisk(dir string) (*Registry, error)

NewRegistryFromDisk creates a registry pre-loaded with schemes from a directory into the capability data tree.

func NewRegistryWithEmbedded

func NewRegistryWithEmbedded() (*Registry, error)

NewRegistryWithEmbedded is removed. Use NewRegistryFromDisk instead.

func (*Registry) CheckIntersection

func (r *Registry) CheckIntersection(setA, setB []string) (common []string)

CheckIntersection returns capabilities present in both sets.

func (*Registry) CheckMinimalCapabilitySet

func (r *Registry) CheckMinimalCapabilitySet(claims []CapabilityClaim, grantedPatterns []string) *MinSetReport

CheckMinimalCapabilitySet performs minimal privilege validation:

  1. Validate each claim's legality (scheme/capability/parameters)
  2. Detect redundancy: covered by another wildcard claim, or completely duplicated
  3. Detect over-privilege: claimed capabilities not within the identity's granted authorization scope
  4. Determine whether minimal privilege has been achieved

grantedPatterns are the grants actually held by the identity (e.g. role grants, may contain wildcards). Pass nil to skip over-privilege checking (only check legality and redundancy).

func (*Registry) CheckSubset

func (r *Registry) CheckSubset(declared, allowed []string) (denied []string)

CheckSubset checks if declared capabilities are a subset of allowed capabilities. Returns denied capabilities that are not in the allowed set.

func (*Registry) Get

func (r *Registry) Get(schemeID string) (*SchemeDefinition, bool)

Get returns a scheme definition by scheme_id.

func (*Registry) Has

func (r *Registry) Has(schemeID string) bool

Has checks if a scheme_id is registered.

func (*Registry) HasCapability

func (r *Registry) HasCapability(schemeID, capID string) bool

HasCapability checks if a specific capability is registered.

func (*Registry) Register

func (r *Registry) Register(def *SchemeDefinition) error

Register adds a scheme definition. It fails if scheme_id is already registered — a silently overwritten duplicate masks a data problem (audit 2026-09-16, R18).

func (*Registry) RoleGrantCovered

func (r *Registry) RoleGrantCovered(schemeID, grant string) bool

RoleGrantCovered checks if a single grant is covered by the scheme's capabilities (wildcard expanded).

func (*Registry) SchemeIDs

func (r *Registry) SchemeIDs() []string

SchemeIDs returns all registered scheme_ids, sorted.

func (*Registry) Summary

func (r *Registry) Summary() string

Summary returns a human-readable summary of all registered schemes.

func (*Registry) ValidateCapabilities

func (r *Registry) ValidateCapabilities(caps []string) *ValidationResult

ValidateCapabilities validates a list of "scheme:cap_id" strings against the registry.

func (*Registry) ValidateCapability

func (r *Registry) ValidateCapability(formatted string) (*SchemeDefinition, *CapabilityEntry, error)

ValidateCapability checks if "scheme:cap_id" is valid and returns the entry.

func (*Registry) ValidateClaims

func (r *Registry) ValidateClaims(claims []CapabilityClaim) []ClaimResult

ValidateClaims validates capability claims: scheme exists, capability is legal (supports wildcards). Returns the result for each claim. Does not include minimal privilege detection.

func (*Registry) ValidateParams added in v0.2.0

func (r *Registry) ValidateParams(scheme, capability string, params map[string]any) error

ValidateParams validates capability parameters against the scheme that defines them. It is the ONE parameter contract, used by both paths:

  • the claims path (ValidateClaims -> signing an AIC), and
  • the rule path (ruleexec.Rule.Validate -> publishing/loading a rule).

A capability that declares `params_schema` is validated against that data-driven schema (which is where `required` lives); otherwise the flat `parameters` contract is applied. Scheme-specific structural rules that the schema cannot express are still checked by ValidateSchemeParams.

func (*Registry) ValidateRoles

func (r *Registry) ValidateRoles(schemeID string) ([]string, error)

ValidateRoles validates that all role grants in a scheme are covered by capabilities. Returns uncovered grants (wildcards expanded against capabilities for validation). Use case: ensure role grants are all legal capabilities before gen-authz generates authz.json.

type RoleDef

type RoleDef struct {
	DisplayName string   `json:"display_name,omitempty"`
	Profiles    []string `json:"profiles,omitempty"`
	Grants      []string `json:"grants"`
	// OUs is the list of certificate OrganizationalUnits this role can be bound to.
	// When generating authz.json, written into ou_mapping; if left empty, no OU mapping entry is generated.
	OUs []string `json:"ous,omitempty"`
}

RoleDef defines a role within a product (used to generate authz.json). grants is a list of capability_id values (e.g. "ca:list", "cert:*"), supports wildcards (* / a:b:*); during expansion validation, all must fall within Capabilities.

type SchemaError added in v0.10.0

type SchemaError struct {
	Code string
	Path string
	// contains filtered or unexported fields
}

SchemaError carries a stable code for a JSON-schema refusal while keeping the human message unchanged (audit R-8, second path).

func (*SchemaError) Error added in v0.10.0

func (e *SchemaError) Error() string

type SchemeDefinition

type SchemeDefinition struct {
	SchemeID     string            `json:"scheme_id"`
	Name         string            `json:"name"`
	Version      string            `json:"version"`
	Description  string            `json:"description"`
	Vendor       string            `json:"vendor"`
	Product      string            `json:"product"`
	Author       string            `json:"author,omitempty"`
	License      string            `json:"license,omitempty"`
	Homepage     string            `json:"homepage,omitempty"`
	Capabilities []CapabilityEntry `json:"capabilities"`
	// Roles defines roles within this product (grants reference capability_id from this scheme).
	// Used by gen-authz tool when generating authz.json; can be empty (pure capability catalog products).
	Roles map[string]RoleDef `json:"roles,omitempty"`
}

SchemeDefinition defines all capabilities for a product.

func LoadScheme

func LoadScheme(path string) (*SchemeDefinition, error)

LoadScheme reads a capability JSON file and returns the definition.

func (*SchemeDefinition) ValidateSchemeRoles

func (def *SchemeDefinition) ValidateSchemeRoles() ([]error, []string)

ValidateSchemeRoles validates the consistency of role definitions within a scheme:

  • Role names are non-empty
  • Role grants are non-empty
  • Non-wildcard grants must be covered by capabilities (strict error)
  • Wildcard grants not covered locally are treated as cross-scheme namespace authorization (e.g. core role referencing gateway:*), returning a warning

Returns (errors, warnings).

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError describes a single validation failure.

func (ValidationError) Error

func (e ValidationError) Error() string

type ValidationResult

type ValidationResult struct {
	Valid    bool
	Errors   []ValidationError
	Warnings []string
	Checked  int
}

ValidationResult holds the outcome of validating a set of capabilities.

Directories

Path Synopsis
Package catalog implements the signed capability catalog plane described in analysis/2026-10-22-authority-bounded-capability-publication-architecture.md §4.5–§4.7 and §5.
Package catalog implements the signed capability catalog plane described in analysis/2026-10-22-authority-bounded-capability-publication-architecture.md §4.5–§4.7 and §5.
cmd
apply-catalog-delta command
Command apply-catalog-delta verifies a signed delta against an exact base generation and writes the next immutable catalog.
Command apply-catalog-delta verifies a signed delta against an exact base generation and writes the next immutable catalog.
asor-projection-probe command
Command asor-projection-probe projects an ASOR delegation chain (draft-asor-wimse-agent-delegation-chain-02) onto CLC grants and runs the chain authorization.
Command asor-projection-probe projects an ASOR delegation chain (draft-asor-wimse-agent-delegation-chain-02) onto CLC grants and runs the chain authorization.
authorize-chain-vectors-run command
Command authorize-chain-vectors-run reads the CLC-D §13.11 AuthorizeWithChain vectors (rev CLC-1.13) and runs them against the semantics package.
Command authorize-chain-vectors-run reads the CLC-D §13.11 AuthorizeWithChain vectors (rev CLC-1.13) and runs them against the semantics package.
constraint-union-vectors-run command
Command constraint-union-vectors-run reads the CLC-v1 §7.1 ConstraintUnion vectors (rev CLC-1.12) and runs them against the semantics package.
Command constraint-union-vectors-run reads the CLC-v1 §7.1 ConstraintUnion vectors (rev CLC-1.12) and runs them against the semantics package.
contains-crosswalk-run command
Command contains-crosswalk-run runs the CLC-D containment cross-walk corpus: a native representation from another ecosystem is mapped into a CLC grant by a pinned profile on each side, and semantics.Contains decides the (parent, child) pair.
Command contains-crosswalk-run runs the CLC-D containment cross-walk corpus: a native representation from another ecosystem is mapped into a CLC grant by a pinned profile on each side, and semantics.Contains decides the (parent, child) pair.
contains-vectors-run command
Command contains-vectors-run reads CLC-D containment vectors (draft-wei-clc-ext-00 §7) and runs them against semantics.Contains.
Command contains-vectors-run reads CLC-D containment vectors (draft-wei-clc-ext-00 §7) and runs them against semantics.Contains.
crosswalk-vectors-run command
Command crosswalk-vectors-run runs the cross-walk corpus: native capability representations from other ecosystems mapped into CLC grants by a pinned profile, decided by the same CLC core.
Command crosswalk-vectors-run runs the cross-walk corpus: native capability representations from other ecosystems mapped into CLC grants by a pinned profile, decided by the same CLC core.
emilia-projection-probe command
Command emilia-projection-probe maps EMILIA's evidence-side objects into the CLC evidence projection and evaluates them, so the mapping is tested rather than asserted.
Command emilia-projection-probe maps EMILIA's evidence-side objects into the CLC evidence projection and evaluates them, so the mapping is tested rather than asserted.
evidence-vectors-run command
Command evidence-vectors-run runs the CLC-E evidence-side conformance corpus (capability/data/_vectors/clc-v1/evidence-vectors.json) and exits non-zero on any mismatch, mirroring cmd/vectors-run for the authorization side.
Command evidence-vectors-run runs the CLC-E evidence-side conformance corpus (capability/data/_vectors/clc-v1/evidence-vectors.json) and exits non-zero on any mismatch, mirroring cmd/vectors-run for the authorization side.
extension-parity-run command
extension-parity-run emits the Go result for the shared three-language canonical parity fixture.
extension-parity-run emits the Go result for the shared three-language canonical parity fixture.
gen-authz command
gen-backfill command
gen-backfill fills params_schema_digest into capability data files.
gen-backfill fills params_schema_digest into capability data files.
gen-capability command
gen-catalog command
Command gen-catalog validates one capability catalog and writes its deterministic JCS form.
Command gen-catalog validates one capability catalog and writes its deterministic JCS form.
gen-docs command
gen-rule command
Command gen-rule turns a validated capability claims file (the minimal set produced by gen-capability and consumed by `aic issue --from-claims`) into rule files for the execution layer.
Command gen-rule turns a validated capability claims file (the minimal set produced by gen-capability and consumed by `aic issue --from-claims`) into rule files for the execution layer.
gilda-projection-probe command
Command gilda-projection-probe projects an audit record from draft-gilda-wimse-agent-audit-record-02 onto the CLC result vocabulary.
Command gilda-projection-probe projects an audit record from draft-gilda-wimse-agent-audit-record-02 onto the CLC result vocabulary.
mode-lattice-vectors-run command
Command mode-lattice-vectors-run runs the AIC-JWT DA delegation-mode pre-check corpus (core §13.4.5).
Command mode-lattice-vectors-run runs the AIC-JWT DA delegation-mode pre-check corpus (core §13.4.5).
oasnt-projection-probe command
Command oasnt-projection-probe projects an OASNT approval token (draft-thallapelly-oasnt-02) onto the CLC evidence projection.
Command oasnt-projection-probe projects an OASNT approval token (draft-thallapelly-oasnt-02) onto the CLC evidence projection.
param-bounds-meet-vectors-run command
Command param-bounds-meet-vectors-run reads the CLC-v1 §6.6 BoundMeet vectors (rev CLC-1.14) and runs them against the semantics package.
Command param-bounds-meet-vectors-run reads the CLC-v1 §6.6 BoundMeet vectors (rev CLC-1.14) and runs them against the semantics package.
param-bounds-vectors-run command
Command param-bounds-vectors-run reads the CLC-v1 §6.5 extended parameter bound vectors (rev CLC-1.10) and runs them against the semantics package.
Command param-bounds-vectors-run reads the CLC-v1 §6.5 extended parameter bound vectors (rev CLC-1.10) and runs them against the semantics package.
rar-projection-probe command
Command rar-projection-probe projects OAuth Rich Authorization Requests (RFC 9396 authorization_details) onto CLC grants and evaluates operations.
Command rar-projection-probe projects OAuth Rich Authorization Requests (RFC 9396 authorization_details) onto CLC grants and evaluates operations.
reason-collapse-vectors-run command
Command reason-collapse-vectors-run validates the CLC-D reason-code collapse policy vectors (capability-language-core-v1 §13.5) and then cross-checks them against the relation-level corpora: every code the policy declares non-collapsible MUST still be surfaced by the containment and cross-walk corpora, so "stays distinguishable" is observable by a third party, not just asserted in prose (CL 13.10.6).
Command reason-collapse-vectors-run validates the CLC-D reason-code collapse policy vectors (capability-language-core-v1 §13.5) and then cross-checks them against the relation-level corpora: every code the policy declares non-collapsible MUST still be surfaced by the containment and cross-walk corpora, so "stays distinguishable" is observable by a third party, not just asserted in prose (CL 13.10.6).
record command
Command record turns a CLC decision into a Decision Record, and checks one back.
Command record turns a CLC decision into a Decision Record, and checks one back.
resolve-vectors-run command
Command resolve-vectors-run reads the CLC-v1 §8.5 Resolve vectors (rev CLC-1.11) and runs them against the semantics package.
Command resolve-vectors-run reads the CLC-v1 §8.5 Resolve vectors (rev CLC-1.11) and runs them against the semantics package.
scheme-admin command
Command scheme-admin is the deployer-side confirmation path for varwof/scheme-admin-v1.
Command scheme-admin is the deployer-side confirmation path for varwof/scheme-admin-v1.
sign command
sign-catalog command
Command sign-catalog produces the detached PKCS#7 signature for one catalog file.
Command sign-catalog produces the detached PKCS#7 signature for one catalog file.
size-report command
Command size-report prints the byte budget of the evidence artifacts this module produces, so a change to a record, envelope or challenge shape can be compared against the numbers recorded in the wire-size budget note that accompanies the language revision (capability `docs/`), so the figures stay reviewable next to the specification they belong to.
Command size-report prints the byte budget of the evidence artifacts this module produces, so a change to a record, envelope or challenge shape can be compared against the numbers recorded in the wire-size budget note that accompanies the language revision (capability `docs/`), so the figures stay reviewable next to the specification they belong to.
vectors-run command
Command vectors-run reads CLC-v1 test vectors and runs them against the semantics package.
Command vectors-run reads CLC-v1 test vectors and runs them against the semantics package.
verify command
verify-catalog command
Command verify-catalog is the deployer admission path for a capability catalog.
Command verify-catalog is the deployer admission path for a capability catalog.
rule-exec command
internal
crosswalkvectors
反向映射:CLC 裁决 → AEB crossing 所需的成员("我们这边能供什么")。
反向映射:CLC 裁决 → AEB crossing 所需的成员("我们这边能供什么")。
evidencevectors
Package evidencevectors loads and runs the CLC-E evidence-side conformance corpus.
Package evidencevectors loads and runs the CLC-E evidence-side conformance corpus.
jsonstrict
Package jsonstrict provides the duplicate-member check that RFC 8785 (JCS) requires and encoding/json does not enforce.
Package jsonstrict provides the duplicate-member check that RFC 8785 (JCS) requires and encoding/json does not enforce.
schemedecl
Package schemedecl implements the CLC-1.19 scheme declaration pilot: the `quantity` domain and the declaration validation it depends on.
Package schemedecl implements the CLC-1.19 scheme declaration pilot: the `quantity` domain and the declaration validation it depends on.
symmetryvectors
Package symmetryvectors runs the authorization/evidence symmetry corpus: each vector carries both sides of one action — the grant and operation the authorization relation decides, and the action observed after execution — so the pair is asserted together rather than in two unrelated suites.
Package symmetryvectors runs the authorization/evidence symmetry corpus: each vector carries both sides of one action — the grant and operation the authorization relation decides, and the action observed after execution — so the pair is asserted together rather than in two unrelated suites.
Package ocmp evaluates an Offline Capability Manifest against the profile's normative rules R2–R7 (docs/offline-capability-manifest-profile-v0.md §3).
Package ocmp evaluates an Offline Capability Manifest against the profile's normative rules R2–R7 (docs/offline-capability-manifest-profile-v0.md §3).
Projection API — the language-level entry point for evidence produced in a foreign (non-CLC) format.
Projection API — the language-level entry point for evidence produced in a foreign (non-CLC) format.
Package schemeadmin implements the authority-bounded scheme publication surface described in analysis/2026-10-22-authority-bounded-capability-publication-architecture.md.
Package schemeadmin implements the authority-bounded scheme publication surface described in analysis/2026-10-22-authority-bounded-capability-publication-architecture.md.
Declared parameter domains (CLC-1.19 §6.7).
Declared parameter domains (CLC-1.19 §6.7).
fuzz_runner command

Jump to

Keyboard shortcuts

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