Documentation
¶
Index ¶
- Constants
- type AuthMiddleware
- type AuthOption
- type Authenticator
- type CipherDetectRequest
- type CipherDetectResponse
- type CipherOperationRequest
- type CipherOperationResponse
- type CipherPipelineRequest
- type CipherPipelineResponse
- type CipherSmartDecodeRequest
- type CipherSmartDecodeResponse
- type Claims
- type Config
- type Manager
- func (m *Manager) Enqueue(plugin string) (*Scan, error)
- func (m *Manager) Get(id string) (*Scan, bool)
- func (m *Manager) ListPlugins() ([]local.Plugin, error)
- func (m *Manager) Result(id string) (*ScanResult, string, string, error)
- func (m *Manager) Start(ctx context.Context)
- func (m *Manager) Stop()
- type ManagerConfig
- type OASTAPI
- type OIDCConfig
- type RecipeExportResponse
- type RecipeListResponse
- type RecipeSaveRequest
- type RewriteAPI
- type Scan
- type ScanResult
- type Server
- type TokenOptions
Constants ¶
const DefaultMaxRequestSize int64 = 10 * 1024 * 1024
DefaultMaxRequestSize is the default maximum request body size (10 MB).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMiddleware ¶
AuthMiddleware is a function that wraps an HTTP handler with authentication
type AuthOption ¶
type AuthOption func(*authConfig) error
AuthOption mutates authenticator configuration.
func WithOIDC ¶
func WithOIDC(cfg OIDCConfig) AuthOption
WithOIDC enables OIDC token validation for the authenticator.
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator issues and validates JWT tokens for the API.
func NewAuthenticator ¶
func NewAuthenticator(secret []byte, issuer string, defaultTTL time.Duration, opts ...AuthOption) (*Authenticator, error)
NewAuthenticator constructs an authenticator using the provided secret and issuer.
func (*Authenticator) Mint ¶
func (a *Authenticator) Mint(subject, audience string, ttl time.Duration) (string, time.Time, error)
Mint generates a signed JWT for the provided subject and audience.
func (*Authenticator) MintWithOptions ¶
func (a *Authenticator) MintWithOptions(subject string, opts TokenOptions) (string, time.Time, error)
MintWithOptions generates a signed JWT using the provided options.
type CipherDetectRequest ¶
type CipherDetectRequest struct {
Input string `json:"input"`
}
CipherDetectRequest represents a request to auto-detect encoding
type CipherDetectResponse ¶
type CipherDetectResponse struct {
Detections []cipher.DetectionResult `json:"detections"`
}
CipherDetectResponse represents the detection result
type CipherOperationRequest ¶
type CipherOperationRequest struct {
Operation string `json:"operation"`
Input string `json:"input"`
Config map[string]interface{} `json:"config,omitempty"`
}
CipherOperationRequest represents a request to execute a cipher operation
type CipherOperationResponse ¶
type CipherOperationResponse struct {
Output string `json:"output"`
Error string `json:"error,omitempty"`
}
CipherOperationResponse represents the result of a cipher operation
type CipherPipelineRequest ¶
type CipherPipelineRequest struct {
Input string `json:"input"`
Operations []cipher.OperationConfig `json:"operations"`
}
CipherPipelineRequest represents a request to execute a pipeline of operations
type CipherPipelineResponse ¶
type CipherPipelineResponse struct {
Output string `json:"output"`
Error string `json:"error,omitempty"`
}
CipherPipelineResponse represents the result of a pipeline execution
type CipherSmartDecodeRequest ¶
type CipherSmartDecodeRequest struct {
Input string `json:"input"`
}
CipherSmartDecodeRequest represents a request for smart auto-decode
type CipherSmartDecodeResponse ¶
type CipherSmartDecodeResponse struct {
Output string `json:"output"`
Pipeline []string `json:"pipeline"`
Confidence float64 `json:"confidence"`
Error string `json:"error,omitempty"`
}
CipherSmartDecodeResponse represents the smart decode result
type Claims ¶
type Claims struct {
Issuer string `json:"iss"`
Subject string `json:"sub"`
Audience string `json:"aud"`
IssuedAt int64 `json:"iat"`
ExpiresAt int64 `json:"exp"`
ID string `json:"jti"`
WorkspaceID string `json:"workspace_id,omitempty"`
Role string `json:"role,omitempty"`
}
Claims represents the JWT payload used for API authentication.
type Config ¶
type Config struct {
Addr string
StaticToken string
JWTSecret []byte
JWTIssuer string
DefaultTokenTTL time.Duration
PluginsDir string
AllowlistPath string
RepoRoot string
ServerAddr string
AuthToken string
SigningKeyPath string
FindingsBus *findings.Bus
Logger *logging.AuditLogger
ScanTimeout time.Duration
OIDCIssuer string
OIDCJWKSURL string
OIDCAudiences []string
WorkspaceStore *team.Store
RecipesDir string
RewriteEngine *rewrite.Engine
MaxRequestSize int64 // Maximum request body size in bytes (0 = use default)
}
Config configures the REST API server.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates plugin executions and captures findings for API responses.
func NewManager ¶
func NewManager(cfg ManagerConfig, bus *findings.Bus, logger *logging.AuditLogger) *Manager
NewManager constructs a scan manager.
func (*Manager) ListPlugins ¶
ListPlugins returns the currently installed plugins.
type ManagerConfig ¶
type ManagerConfig struct {
PluginsDir string
AllowlistPath string
RepoRoot string
ServerAddr string
AuthToken string
SigningKeyPath string
ScanTimeout time.Duration
}
ManagerConfig configures scan execution.
type OASTAPI ¶
type OASTAPI struct {
// contains filtered or unexported fields
}
OASTAPI handles OAST-related API endpoints.
func NewOASTAPI ¶
NewOASTAPI creates a new OAST API handler.
type OIDCConfig ¶
type OIDCConfig struct {
Issuer string
JWKSURL string
Audiences []string
SyncInterval time.Duration
HTTPClient *http.Client
}
OIDCConfig configures verification against an OpenID Connect provider.
type RecipeExportResponse ¶
RecipeExportResponse represents an exported recipe
type RecipeListResponse ¶
RecipeListResponse represents the list of recipes
type RecipeSaveRequest ¶
type RecipeSaveRequest struct {
Name string `json:"name"`
Description string `json:"description"`
Tags []string `json:"tags,omitempty"`
Operations []cipher.OperationConfig `json:"operations"`
}
RecipeSaveRequest represents a request to save a recipe
type RewriteAPI ¶
type RewriteAPI struct {
// contains filtered or unexported fields
}
RewriteAPI handles HTTP endpoints for the Rewrite engine
func NewRewriteAPI ¶
func NewRewriteAPI(engine *rewrite.Engine, logger *slog.Logger) *RewriteAPI
NewRewriteAPI creates a new Rewrite API handler
func (*RewriteAPI) RegisterRoutes ¶
func (api *RewriteAPI) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers all Rewrite API routes with the provided mux
func (*RewriteAPI) SetAuthMiddleware ¶
func (api *RewriteAPI) SetAuthMiddleware(middleware AuthMiddleware)
SetAuthMiddleware sets the authentication middleware for the API
type Scan ¶
type Scan struct {
ID string `json:"id"`
Plugin string `json:"plugin"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Error string `json:"error,omitempty"`
Logs string `json:"logs,omitempty"`
Findings []findings.Finding `json:"findings,omitempty"`
Signature string `json:"signature,omitempty"`
Digest string `json:"digest,omitempty"`
}
Scan describes the lifecycle of a single plugin invocation.
type ScanResult ¶
type ScanResult struct {
ScanID string `json:"scan_id"`
Plugin string `json:"plugin"`
GeneratedAt time.Time `json:"generated_at"`
Findings []findings.Finding `json:"findings"`
}
ScanResult bundles the signed results returned by the API.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server exposes REST endpoints for triggering scans and retrieving results.
func (*Server) GetMaxRequestSize ¶
GetMaxRequestSize returns the configured maximum request body size.