security

package
v0.0.0-...-0a7bcea Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 5 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

This section is empty.

Types

type QueryValidator

type QueryValidator struct {
	// contains filtered or unexported fields
}

QueryValidator validates SQL queries using a deterministic 4-stage state machine

func NewQueryValidator

func NewQueryValidator() *QueryValidator

NewQueryValidator creates a new query validator

func (*QueryValidator) InspectQuery

func (qv *QueryValidator) InspectQuery(rawQuery string) ValidationResult

InspectQuery runs the explicit validation state machine and returns a structured ValidationResult

func (*QueryValidator) ValidateQuery

func (qv *QueryValidator) ValidateQuery(query string) error

ValidateQuery checks if the query passes all stages of the validation state machine

type ValidationResult

type ValidationResult struct {
	IsValid              bool            `json:"is_valid"`
	Stage                ValidationStage `json:"stage"`
	NormalizedSQL        string          `json:"normalized_sql,omitempty"`
	StatementType        string          `json:"statement_type,omitempty"`
	ErrorReason          string          `json:"error_reason,omitempty"`
	AgentRemediationHint string          `json:"agent_remediation_hint,omitempty"`
}

ValidationResult provides rich diagnostics for Users (UX), Developers (DX), and AI Agents (AX)

type ValidationStage

type ValidationStage string

ValidationStage represents the explicit state of the SQL validation pipeline

const (
	StageSanitize        ValidationStage = "SANITIZE_NORMALIZE"
	StageRestrictedCheck ValidationStage = "RESTRICTED_IDENTIFIER_CHECK"
	StageASTVerify       ValidationStage = "AST_READONLY_VERIFY"
	StageValidated       ValidationStage = "VALIDATED"
	StageRejected        ValidationStage = "REJECTED"
)

Jump to

Keyboard shortcuts

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