http

package
v0.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 103 Imported by: ? 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

View Source
const GitHubAppEndpointPath = "/api/webhooks/github/pull-requests"

GitHubAppEndpointPath remains the shared GitHub App endpoint when Proof pull-request intake lands.

View Source
const GitHubProofWebhookPath = "/api/webhooks/github/pull-requests"
View Source
const GitLabProofWebhookPath = "/api/webhooks/gitlab/merge-requests/:routeKey"

Variables

This section is empty.

Functions

func MapServiceError

func MapServiceError(err error) error

MapServiceError converts a service-layer error into an appropriate API error. It extracts the kind, code, and message from the xerror.Error in the error chain and takes public detail from that error or its causes. Non-xerror errors are logged and mapped to 500.

func NewBackendSecurityMiddlewareForApp

func NewBackendSecurityMiddlewareForApp(
	sessionStore *session.Store,
	logger *slog.Logger,
	abuseLimiter httpsecurity.AbuseLimiter,
	authAttempts int,
	authWindow time.Duration,
	expensiveClientAttempts int,
	expensiveTenantAttempts int,
	credentialAttempts int,
	expensiveWindow time.Duration,
) fiber.Handler

func NewBearerAuthMiddleware

func NewBearerAuthMiddleware(
	apiKeysService interface {
		Authenticate(ctx context.Context, token string) (*model.APIKeyPrincipal, error)
	},
	patsService interface {
		Authenticate(ctx context.Context, token string) (*model.UserPrincipal, error)
	},
) fiber.Handler

func NewMCPDelegatedOperationAuth

func NewMCPDelegatedOperationAuth(tokens *mcpauthsvc.TokenService) (func(fiber.Ctx, fiber.Handler) error, error)

NewMCPDelegatedOperationAuth adapts an OAuth grant to the shared Core operation handlers. Use it only at the operation boundary, after route parameters are available.

func NewMCPOAuthConsentHandler

func NewMCPOAuthConsentHandler(tokens *mcpauthsvc.TokenService, store *session.Store,
	render func(c fiber.Ctx, prompt model.MCPConsentPrompt, action, csrf string) error,
	renderContinuation func(c fiber.Ctx, callback string) error,
) (fiber.Handler, error)

NewMCPOAuthConsentHandler requires the issuer and browser login to share an origin.

func NewOpenAPIRequestValidator

func NewOpenAPIRequestValidator(schema *openapi3.T) (fiber.Handler, error)

NewOpenAPIRequestValidator validates requests before generated handlers bind them.

func NewSessionAuthenticationMiddleware

func NewSessionAuthenticationMiddleware(users userssvc.UsersService, store *session.Store) fiber.Handler

NewSessionAuthenticationMiddleware checks shared credential state on every request.

func PublicOpenAPIDocument

func PublicOpenAPIDocument(schema *openapi3.T) ([]byte, error)

PublicOpenAPIDocument omits internal paths and types without changing server validation.

func RegisterGitHubAppWebhookRoute

func RegisterGitHubAppWebhookRoute(app *fiber.App, lifecycle githubAppLifecycleAcceptor, secret []byte, logger *slog.Logger) error

func RegisterGitHubProofWebhookRoute

func RegisterGitHubProofWebhookRoute(app *fiber.App, acceptor ProofWebhookAcceptor, lifecycle githubAppLifecycleAcceptor, secret []byte, logger *slog.Logger) error

func RegisterGitLabProofWebhookRoute

func RegisterGitLabProofWebhookRoute(app *fiber.App, resolver GitLabProofWebhookResolver, acceptor ProofWebhookAcceptor, logger *slog.Logger) error

func RegisterMCPMachineAdministrationRoutes

func RegisterMCPMachineAdministrationRoutes(app *fiber.App, cfg MCPMachineAdministrationConfig) error

RegisterMCPMachineAdministrationRoutes mounts same-origin browser management routes under the issuer.

func RegisterMCPOAuthRoutes

func RegisterMCPOAuthRoutes(app *fiber.App, cfg MCPOAuthRoutesConfig) error

RegisterMCPOAuthRoutes mounts the issuer protocol separately from the product API. Authorize owns browser authentication and consent. Runtime composition must place the configured public origins behind trusted HTTPS ingress.

func RegisterMCPUserGrantRoutes

func RegisterMCPUserGrantRoutes(app *fiber.App, tokens *mcpauthsvc.TokenService, store *session.Store) error

RegisterMCPUserGrantRoutes exposes a user's own grants for the active browser scope.

func RegisterOpenAPIRoute

func RegisterOpenAPIRoute(app *fiber.App, document []byte)

RegisterOpenAPIRoute publishes the already-validated API document at a stable unauthenticated endpoint for programmatic consumers and API docs.

func RegisterProbeRoutes

func RegisterProbeRoutes(app *fiber.App, cfg ProbeRoutesConfig)

RegisterProbeRoutes registers unauthenticated backend liveness and readiness endpoints.

func RequireMappedOperation

func RequireMappedOperation(c fiber.Ctx, next fiber.Handler) error

RequireMappedOperation rejects a new Core handler until it has an authority mapping.

Types

type GitLabProofWebhookResolver

type GitLabProofWebhookResolver interface {
	Resolve(context.Context, string) (gitlabproofwebhooksvc.ResolvedWebhook, error)
}

type MCPMachineAdministrationConfig

type MCPMachineAdministrationConfig struct {
	Tokens        *mcpauthsvc.TokenService
	Audit         workerproducer.EventProducer
	Sessions      *session.Store
	Policy        authorization.Service
	Admission     admissionsvc.Service
	AbuseLimiter  httpsecurity.AbuseLimiter
	RequestLimit  int
	RequestWindow time.Duration
}

type MCPOAuthRoutesConfig

type MCPOAuthRoutesConfig struct {
	Tokens        *mcpauthsvc.TokenService
	Authorize     fiber.Handler
	AbuseLimiter  httpsecurity.AbuseLimiter
	RequestLimit  int
	RequestWindow time.Duration
}

type ProbeDatabase

type ProbeDatabase interface {
	Ping(context.Context) error
}

ProbeDatabase is the database dependency boundary used by readiness probes.

type ProbeLifecycle

type ProbeLifecycle interface {
	IsDraining() bool
}

ProbeLifecycle is the process drain-state boundary used by readiness probes.

type ProbeMigrationPreflight

type ProbeMigrationPreflight interface {
	Check(context.Context) error
}

ProbeMigrationPreflight is the migration-state dependency boundary used by readiness probes.

type ProbeRoutesConfig

type ProbeRoutesConfig struct {
	Database   ProbeDatabase
	Migrations ProbeMigrationPreflight
	Lifecycle  ProbeLifecycle
}

ProbeRoutesConfig contains dependencies needed by the backend probe routes.

type ProofWebhookAcceptor

type ProofWebhookAcceptor interface {
	Accept(context.Context, gitprovider.VerifiedChangeEvent) (queue.QueuedJob, error)
}

type RequestAuthorization

type RequestAuthorization interface {
	CurrentUser(fiber.Ctx) (reqctx.UserPrincipal, bool)
	Can(fiber.Ctx, model.Action, model.Resource) error
	CanOrg(fiber.Ctx, slug.Slug, model.Action, model.Resource) error
}

RequestAuthorization exposes the request-scoped authentication and authorization boundary needed by an optional HTTP extension without exposing server state.

type Server

type Server = server

Server implements the shared HTTP handlers.

func NewServer

func NewServer(
	usersService userssvc.UsersService,
	accountClosureService *accountclosuresvc.Service,
	oidcService oidc.Service,
	sessionStore *session.Store,
	authorizationService authorization.Service,
	orgService orgsvc.Service,
	admissionService admissionsvc.Service,
	projectsService projectssvc.Service,
	repositorySetupService projectRepositorySetupService,
	pipelineCreationsService pipelineCreationService,
	odcsContractsService odcscontractsvc.Service,
	compiledPlansService compiledPlanService,
	odcsArtifactImporter *odcscontractsvc.ArtifactImporter,
	environmentsService environmentssvc.Service,
	membersService memberssvc.Service,
	rolesService rolessvc.Service,
	apiKeysService apikeyssvc.Service,
	patsService patssvc.Service,
	credentialsService credentialssvc.Service,
	datasourcesService datasourcessvc.Service,
	dataSourceRefsService datasourcerefssvc.Service,
	queriesService queriessvc.Service,
	eventsService eventssvc.Service,
	githubAppService *githubappsvc.Service,
	notificationsService notificationsvc.Service,
	retentionService retentionsvc.Service,
	pipelinesService pipelinesvc.Service,
	proofReceiptService proofreceiptsvc.Service,
	proofConfigurationService *proofconfigsvc.Service,
	proofObservationService *proofreceiptsvc.LiveCompiler,
	pipelineTriggersService pipelinetriggersvc.Service,
	pipelineWebhookService *pipelinewebhooksvc.Service,
	runRecencyService runRecencyService,
	frontendURL string,
	googleRedirectURI string,
	selfServiceRegistrationEnabled bool,
	externalOnboardingEnabled bool,
	memberAdmission memberAdmissionService,
) *Server

Jump to

Keyboard shortcuts

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