Documentation
¶
Index ¶
- func AuthenticateBearer(authenticator authn.Authenticator, next http.Handler) http.Handler
- func AuthenticateBearerWithChallenge(authenticator authn.Authenticator, challenge BearerChallenge, ...) http.Handler
- func AuthenticateRequest(authenticator authn.RequestAuthenticator, next http.Handler) http.Handler
- func DecodeRepositoryCursor(value string) (string, bool)
- func EncodeRepositoryCursor(name string) string
- func GraphStateMessage(err error) string
- func GuardSCIMV2(next http.Handler, authenticator authn.ProvisioningAuthenticator, ...) http.Handler
- func PageRepositoriesAfter(repositories []api.RepositorySummary, after string) []api.RepositorySummary
- func PrincipalFromContext(ctx context.Context) authn.Principal
- func RegisterAccount(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterAdmin(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterAuth(mux *http.ServeMux, tokenLogin, breakGlass, fileReads bool, ...)
- func RegisterFileReads(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterGitHubWebhook(mux *http.ServeMux, secret []byte, maxBytes int64, processor webhook.Processor)
- func RegisterGraphIngestion(mux *http.ServeMux, authenticator authn.Authenticator, ...)
- func RegisterGraphQueries(mux *http.ServeMux, authenticator authn.Authenticator, ...)
- func RegisterLocalAuth(mux *http.ServeMux, publicOrigin string, ...)
- func RegisterRepositories(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterRepositoryInventory(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSCIP(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSearch(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSupplyChain(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSupplyChainImports(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSupplyChainPortfolio(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSupplyChainReview(mux *http.ServeMux, authenticator authn.RequestAuthenticator, ...)
- func RegisterSystem(mux *http.ServeMux, checker ReadyChecker, metrics http.Handler)
- func RepositoryErrorMessage(err error) string
- func RequestIDs(random io.Reader, next http.Handler) http.Handler
- func SCIPErrorMessage(err error) string
- func SupplyChainErrorMessage(err error) string
- type BearerChallenge
- type DerivedExport
- type ReadyChecker
- type UploadGrants
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateBearer ¶
func AuthenticateBearerWithChallenge ¶
func AuthenticateBearerWithChallenge(authenticator authn.Authenticator, challenge BearerChallenge, next http.Handler) http.Handler
AuthenticateBearerWithChallenge is AuthenticateBearer with an optional OAuth discovery challenge on every 401 (RFC 9728 §5.1), so MCP clients learn where to obtain a token.
func AuthenticateRequest ¶
func DecodeRepositoryCursor ¶
DecodeRepositoryCursor returns the full name a repository page cursor points past; an empty cursor is valid and means the first page.
func EncodeRepositoryCursor ¶
EncodeRepositoryCursor builds the opaque cursor that resumes after name.
func GraphStateMessage ¶ added in v0.10.0
GraphStateMessage explains a graph readiness failure and what resolves it. Messages are composed here from the sentinel and, for a missing generation, the indexed commit GraphNest itself resolved; error text is never echoed.
func GuardSCIMV2 ¶
func PageRepositoriesAfter ¶
func PageRepositoriesAfter(repositories []api.RepositorySummary, after string) []api.RepositorySummary
PageRepositoriesAfter orders the authorized repositories by full name and drops those at or before the cursor. The authorized set is already bounded by the principal's grants, so paging in memory costs nothing extra.
func RegisterAccount ¶
func RegisterAdmin ¶
func RegisterAuth ¶
func RegisterAuth(mux *http.ServeMux, tokenLogin, breakGlass, fileReads bool, providers []sso.Provider, authenticator authn.RequestAuthenticator, sessions sessionRevoker, metrics *observability.Metrics)
func RegisterFileReads ¶
func RegisterFileReads(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *repository.Service, maxRequestBytes int64, maxResponseBytes int64)
func RegisterGitHubWebhook ¶
func RegisterGraphIngestion ¶
func RegisterGraphIngestion(mux *http.ServeMux, authenticator authn.Authenticator, service *graphingest.Service, grants *UploadGrants, maxUploadBytes, maxResponseBytes int64)
RegisterGraphIngestion mounts graph uploads, status, and the administrator-only publication-grant route.
POST /v1/graph/uploads?repository_id=101&commit=<sha> (v1, administrators) POST /v1/graph/uploads?repository_id=101&commit=<sha>&expected_generation=7[&replace_producer=true] (v2)
func RegisterGraphQueries ¶
func RegisterGraphQueries(mux *http.ServeMux, authenticator authn.Authenticator, service *graphservice.Service, maxRequestBytes, maxResponseBytes int64)
func RegisterLocalAuth ¶
func RegisterLocalAuth(mux *http.ServeMux, publicOrigin string, authenticator *authn.LocalAuthenticator, credentials passwordCredentialSetter)
func RegisterRepositories ¶
func RegisterRepositories(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *repository.Service, maxRequestBytes int64, maxResults int, maxResponseBytes int64)
func RegisterRepositoryInventory ¶
func RegisterRepositoryInventory(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *repository.Service, maxResults int, maxResponseBytes int64)
func RegisterSCIP ¶
func RegisterSearch ¶
func RegisterSupplyChain ¶ added in v0.6.0
func RegisterSupplyChain(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *supplychain.Service, maxResults int, maxResponseBytes int64)
RegisterSupplyChain mounts the Dependencies & Licenses inventory routes. Every route authenticates the request, then the service authorizes the repository with the live principal before touching inventory rows.
func RegisterSupplyChainImports ¶ added in v0.6.0
func RegisterSupplyChainImports(mux *http.ServeMux, authenticator authn.RequestAuthenticator, importer *supplychain.Importer, grants *UploadGrants, maxUploadBytes, maxResponseBytes int64)
RegisterSupplyChainImports mounts the standards-based import route and the administrator-only upload-grant route.
POST /v1/supply-chain/imports?repository_id=101&subject=source&label=ort[&subject_revision=<sha>] Content-Type: application/spdx+json | application/vnd.cyclonedx+json | application/json
func RegisterSupplyChainPortfolio ¶ added in v0.6.0
func RegisterSupplyChainPortfolio(mux *http.ServeMux, authenticator authn.RequestAuthenticator, portfolio *supplychain.Portfolio, maxResults int, maxResponseBytes int64, derived ...*DerivedExport)
func RegisterSupplyChainReview ¶ added in v0.6.0
func RegisterSupplyChainReview(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *review.Service, maxRequestBytes, maxResponseBytes int64)
RegisterSupplyChainReview mounts the review queue, conclusions, decisions, history, grants, policies, and audit routes.
func RegisterSystem ¶
func RegisterSystem(mux *http.ServeMux, checker ReadyChecker, metrics http.Handler)
func RepositoryErrorMessage ¶
func SCIPErrorMessage ¶
func SupplyChainErrorMessage ¶ added in v0.6.0
SupplyChainErrorMessage returns the safe message for MCP error results.
Types ¶
type BearerChallenge ¶
type BearerChallenge func(writer http.ResponseWriter, invalidToken bool)
BearerChallenge decorates a 401 with a WWW-Authenticate header. invalidToken is true when a credential was presented and rejected, false when none was.
type DerivedExport ¶ added in v0.6.0
type DerivedExport struct {
Service *supplychain.Service
PublicOrigin string
}
RegisterSupplyChainPortfolio mounts the cross-repository inventory routes. Authorization scope is resolved from the live principal on every request before any aggregate is computed. DerivedExport is the optional derived SPDX exporter mounted next to the CSV export under /v1/supply-chain/exports/{id}/derived.spdx.json.
type ReadyChecker ¶
type UploadGrants ¶ added in v0.6.0
type UploadGrants struct {
Set func(ctx context.Context, repositoryID int64, subject, grantedBy string, allow bool) error
Resolve func(ctx context.Context, principal authn.Principal, githubID int64) (int64, error)
}
UploadGrants manages repository-scoped import permissions. Resolve maps an authorized GitHub repository ID to the internal row for the principal.