Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDangerousSql = errors.New("dangerous sql detected") ErrSqlParseFailed = errors.New("failed to parse sql") )
Functions ¶
func IsWhitelisted ¶
IsWhitelisted returns true if the context is marked to skip SQL guard checks.
Types ¶
type Config ¶
type Config struct {
Enabled bool
}
Config holds the configuration for the SQL guard.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default SQL guard configuration.
type DeleteWithoutWhereRule ¶
type DeleteWithoutWhereRule struct{}
DeleteWithoutWhereRule blocks DELETE statements without WHERE clause.
func (*DeleteWithoutWhereRule) Check ¶
func (r *DeleteWithoutWhereRule) Check(astNode *ast.AST) *Violation
func (*DeleteWithoutWhereRule) Name ¶
func (r *DeleteWithoutWhereRule) Name() string
type DropStatementRule ¶
type DropStatementRule struct{}
DropStatementRule blocks DROP statements.
func (*DropStatementRule) Name ¶
func (r *DropStatementRule) Name() string
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
Guard coordinates sql rule checking.
type GuardError ¶
GuardError wraps a sql guard error with additional context.
func (*GuardError) Error ¶
func (e *GuardError) Error() string
func (*GuardError) Unwrap ¶
func (e *GuardError) Unwrap() error
type Rule ¶
Rule defines the interface for SQL checking rules.
func DefaultRules ¶
func DefaultRules() []Rule
DefaultRules returns the default set of SQL checking rules.
type TruncateStatementRule ¶
type TruncateStatementRule struct{}
TruncateStatementRule blocks TRUNCATE statements.
func (*TruncateStatementRule) Check ¶
func (r *TruncateStatementRule) Check(astNode *ast.AST) *Violation
func (*TruncateStatementRule) Name ¶
func (r *TruncateStatementRule) Name() string
Click to show internal directories.
Click to hide internal directories.