Documentation
¶
Overview ¶
Package safety provides linter rules for detecting dangerous SQL operations that can cause irreversible data loss or security vulnerabilities.
Rules:
- L011: DELETE without WHERE clause
- L012: UPDATE without WHERE clause
- L013: DROP without IF EXISTS
- L014: TRUNCATE TABLE warning
- L015: SELECT INTO OUTFILE/DUMPFILE
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteWithoutWhereRule ¶
DeleteWithoutWhereRule (L011) flags DELETE statements that have no WHERE clause. Unfiltered DELETEs remove all rows from a table and are almost always a mistake.
func NewDeleteWithoutWhereRule ¶
func NewDeleteWithoutWhereRule() *DeleteWithoutWhereRule
NewDeleteWithoutWhereRule creates a new L011 rule instance.
type DropWithoutConditionRule ¶
DropWithoutConditionRule (L013) flags DROP TABLE/VIEW/INDEX without IF EXISTS. Without IF EXISTS, a DROP on a non-existent object raises a fatal error in most databases.
func NewDropWithoutConditionRule ¶
func NewDropWithoutConditionRule() *DropWithoutConditionRule
NewDropWithoutConditionRule creates a new L013 rule instance.
type SelectIntoOutfileRule ¶
SelectIntoOutfileRule (L015) flags SELECT ... INTO OUTFILE / INTO DUMPFILE patterns. These operations write data to the server filesystem — a significant security risk. This rule works at the text level since SELECT INTO OUTFILE is a MySQL extension that may not always produce a full AST node.
func NewSelectIntoOutfileRule ¶
func NewSelectIntoOutfileRule() *SelectIntoOutfileRule
NewSelectIntoOutfileRule creates a new L015 rule instance.
type TruncateTableRule ¶
TruncateTableRule (L014) warns when TRUNCATE TABLE is used. TRUNCATE is irreversible and bypasses row-level triggers — dangerous in application code.
func NewTruncateTableRule ¶
func NewTruncateTableRule() *TruncateTableRule
NewTruncateTableRule creates a new L014 rule instance.
type UpdateWithoutWhereRule ¶
UpdateWithoutWhereRule (L012) flags UPDATE statements that have no WHERE clause. Unfiltered UPDATEs modify all rows in a table and are almost always a mistake.
func NewUpdateWithoutWhereRule ¶
func NewUpdateWithoutWhereRule() *UpdateWithoutWhereRule
NewUpdateWithoutWhereRule creates a new L012 rule instance.