MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / isSystemTable

Method isSystemTable

pkg/sql/security/scanner.go:898–916  ·  view source on GitHub ↗

isSystemTable checks if a table name refers to a system table using precise matching. Uses prefix matching and exact name matching to avoid false positives.

(tableName string)

Source from the content-addressed store, hash-verified

896// isSystemTable checks if a table name refers to a system table using precise matching.
897// Uses prefix matching and exact name matching to avoid false positives.
898func (s *Scanner) isSystemTable(tableName string) bool {
899 tableLower := strings.ToLower(tableName)
900
901 // Check exact matches first
902 for _, name := range systemTableNames {
903 if tableLower == name {
904 return true
905 }
906 }
907
908 // Check prefix matches (e.g., "information_schema.tables", "pg_class")
909 for _, prefix := range systemTablePrefixes {
910 if strings.HasPrefix(tableLower, prefix) {
911 return true
912 }
913 }
914
915 return false
916}
917
918// scanFunctionCall checks for dangerous function usage.
919func (s *Scanner) scanFunctionCall(fn *ast.FunctionCall, result *ScanResult) {

Callers 2

checkUnionInjectionMethod · 0.95
TestIsSystemTableFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestIsSystemTableFunction · 0.76