http

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 96 Imported by: 0

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 to build the response. 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 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 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.

Types

type GitLabProofWebhookResolver

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

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