httpapi

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 38 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateBearer

func AuthenticateBearer(authenticator authn.Authenticator, next http.Handler) http.Handler

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 AuthenticateRequest(authenticator authn.RequestAuthenticator, next http.Handler) http.Handler

func DecodeRepositoryCursor

func DecodeRepositoryCursor(value string) (string, bool)

DecodeRepositoryCursor returns the full name a repository page cursor points past; an empty cursor is valid and means the first page.

func EncodeRepositoryCursor

func EncodeRepositoryCursor(name string) string

EncodeRepositoryCursor builds the opaque cursor that resumes after name.

func GraphStateMessage added in v0.10.0

func GraphStateMessage(err error) string

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 GuardSCIMV2(next http.Handler, authenticator authn.ProvisioningAuthenticator, service *scim.Service) http.Handler

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 PrincipalFromContext

func PrincipalFromContext(ctx context.Context) authn.Principal

func RegisterAccount

func RegisterAccount(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *account.Service, maxRequestBytes, maxResponseBytes int64)

func RegisterAdmin

func RegisterAdmin(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *admin.Service, maxItems int, maxRequestBytes, maxResponseBytes int64)

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 RegisterGitHubWebhook(mux *http.ServeMux, secret []byte, maxBytes int64, processor webhook.Processor)

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 RegisterSCIP(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *scipgraph.Service, maxRequestBytes, maxUploadBytes, maxResponseBytes int64)

func RegisterSearch

func RegisterSearch(mux *http.ServeMux, authenticator authn.RequestAuthenticator, service *search.Service, maxRequestBytes, maxResponseBytes int64)

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 RepositoryErrorMessage(err error) string

func RequestIDs

func RequestIDs(random io.Reader, next http.Handler) http.Handler

func SCIPErrorMessage

func SCIPErrorMessage(err error) string

func SupplyChainErrorMessage added in v0.6.0

func SupplyChainErrorMessage(err error) string

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 ReadyChecker interface {
	Health(context.Context) error
}

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.

Jump to

Keyboard shortcuts

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