middlewares

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddProfileEndpoints

func AddProfileEndpoints(e *echo.Echo)

AddProfileEndpoints adds several routes from package `net/http/pprof` to *echo.Echo object.

func ArtifactMiddleware

func ArtifactMiddleware(repository shared.ArtifactRepository) func(next echo.HandlerFunc) echo.HandlerFunc

func AssetAccessControl added in v1.11.0

func AssetAccessControl(obj shared.Object, act shared.Action) shared.MiddlewareFunc

AssetAccessControl assumes ResourceFetchMiddleware has already resolved the asset (and org/project) into the context - it never fetches anything itself, it only checks the pre-resolved entity against the session/actor scope. It has no captured dependency, so it's a plain shared.RBACMiddleware value, not a factory that needs constructing.

func AssetNameMiddleware

func AssetNameMiddleware() shared.MiddlewareFunc

this middleware is used to set the project slug parameter based on an X-Asset-ID header. it is useful for reusing the projectAccessControl middleware and rely on the rbac to determine if the user has access to an specific asset

func AssetVersionMiddleware

func AssetVersionMiddleware(repository shared.AssetVersionRepository) func(next echo.HandlerFunc) echo.HandlerFunc

func BlockHandler

func BlockHandler() echo.HandlerFunc

BlockHandler will pass the call from /debug/pprof/block to pprof.

func CmdlineHandler

func CmdlineHandler() echo.HandlerFunc

CmdlineHandler will pass the call from /debug/pprof/cmdline to pprof.

func CsafMiddleware

func CsafMiddleware(orgLevel bool, orgRepository shared.OrganizationRepository, projectRepository shared.ProjectRepository, assetRepository shared.AssetRepository, assetVersionRepository shared.AssetVersionRepository, artifactRepository shared.ArtifactRepository) echo.MiddlewareFunc

func DisallowPublicRequests added in v1.4.2

func DisallowPublicRequests(next echo.HandlerFunc) echo.HandlerFunc

func EventMiddleware

func EventMiddleware(repository shared.VulnEventRepository) func(next echo.HandlerFunc) echo.HandlerFunc

func ExternalEntityProviderOrgSyncMiddleware

func ExternalEntityProviderOrgSyncMiddleware(externalEntityProviderService shared.ExternalEntityProviderService) shared.MiddlewareFunc

ExternalEntityProviderOrgSyncMiddleware returns a middleware that triggers a background org sync for external entity providers. It rate-limits per session owner so the sync runs at most once every 15 minutes.

func ExternalEntityProviderRefreshMiddleware

func ExternalEntityProviderRefreshMiddleware(externalEntityProviderService shared.ExternalEntityProviderService) shared.MiddlewareFunc

ExternalEntityProviderRefreshMiddleware returns a middleware that refreshes external-entity-provider projects for orgs that are external entities. It rate-limits per org+user combination to once every 15 minutes.

func GoroutineHandler

func GoroutineHandler() echo.HandlerFunc

GoroutineHandler will pass the call from /debug/pprof/goroutine to pprof.

func GoroutineSafeContext

func GoroutineSafeContext(c shared.Context) shared.Context

func HeapHandler

func HeapHandler() echo.HandlerFunc

HeapHandler will pass the call from /debug/pprof/heap to pprof.

func IndexHandler

func IndexHandler() echo.HandlerFunc

IndexHandler will pass the call from /debug/pprof to pprof.

func InstanceAdminMiddleware added in v1.6.1

func InstanceAdminMiddleware(pat shared.PersonalAccessTokenService) echo.MiddlewareFunc

func InstanceSettings added in v1.4.0

func InstanceSettings(configService shared.ConfigService, disabled func(shared.InstanceSettings) bool) echo.MiddlewareFunc

func MultiOrganizationMiddlewareRBAC

func MultiOrganizationMiddlewareRBAC() shared.MiddlewareFunc

MultiOrganizationMiddlewareRBAC assumes ResourceFetchMiddleware has already resolved the org, the domain RBAC and the actor scope into the context - it never fetches anything itself, it only checks organization membership.

func MutexHandler

func MutexHandler() echo.HandlerFunc

MutexHandler will pass the call from /debug/pprof/mutex to pprof.

func NeededScope

func NeededScope(NeededScopes []string) shared.MiddlewareFunc

func OrganizationAccessControlMiddleware

func OrganizationAccessControlMiddleware(obj shared.Object, act shared.Action) echo.MiddlewareFunc

func ProfileHandler

func ProfileHandler() echo.HandlerFunc

ProfileHandler will pass the call from /debug/pprof/profile to pprof.

func ProjectAccessControl added in v1.11.0

func ProjectAccessControl(obj shared.Object, act shared.Action) shared.MiddlewareFunc

ProjectAccessControl assumes ResourceFetchMiddleware has already resolved the project (and org) into the context - it never fetches anything itself, it only checks the pre-resolved entity against the session/actor scope. It has no captured dependency, so it's a plain shared.RBACMiddleware value, not a factory that needs constructing.

func ProviderIDMiddleware added in v1.8.0

func ProviderIDMiddleware(gitlabIntegrations map[string]*gitlabint.GitlabOauth2Config) shared.MiddlewareFunc

ProviderIDMiddleware extracts the :providerID URL param, normalizes it, stores it in the context, and rejects IDs that collide with a configured GitLab integration.

func ResourceFetchMiddleware added in v1.11.0

func ResourceFetchMiddleware(rbacProvider shared.RBACProvider, organizationService shared.OrgService, projectRepository shared.ProjectRepository, assetRepository shared.AssetRepository) echo.MiddlewareFunc

ResourceFetchMiddleware is the single place that resolves every entity a request needs, once each: the organization (always, by URL slug), the project/asset (when the matched route carries :projectSlug/:assetSlug, by URL slug - the authoritative resolution), and the session's own scoped entity (by owner ID, when the session is a project- or asset-scoped access token), reusing the path-resolved entity when it's the very same row. No other middleware or AccessControl method fetches anything itself.

func ScanMiddleware

func ScanMiddleware(assetVersionRepository shared.AssetVersionRepository) func(next echo.HandlerFunc) echo.HandlerFunc

func Server

func Server() *echo.Echo

func SessionMiddleware

func SessionMiddleware(oryAPIClient shared.PublicClient, configService shared.ConfigService, verifier shared.Verifier) echo.MiddlewareFunc

func ShareMiddleware

func ShareMiddleware(orgRepository shared.OrganizationRepository, projectRepository shared.ProjectRepository, assetRepository shared.AssetRepository, assetVersionRepository shared.AssetVersionRepository, artifactRepository shared.ArtifactRepository) echo.MiddlewareFunc

func SymbolHandler

func SymbolHandler() echo.HandlerFunc

SymbolHandler will pass the call from /debug/pprof/symbol to pprof.

func ThreadCreateHandler

func ThreadCreateHandler() echo.HandlerFunc

ThreadCreateHandler will pass the call from /debug/pprof/threadcreate to pprof.

func TraceHandler

func TraceHandler() echo.HandlerFunc

TraceHandler will pass the call from /debug/pprof/trace to pprof.

func WrapGroup

func WrapGroup(prefix string, g *echo.Group)

WrapGroup adds several routes from package `net/http/pprof` to *echo.Group object.

Types

This section is empty.

Jump to

Keyboard shortcuts

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