{
  "name": "Go Sinks",
  "description": "Taint sinks for Go standard library and web frameworks",
  "sinks": [
    {
      "method": "Query",
      "class": "DB",
      "type": "sql_injection",
      "cwe": "CWE-89",
      "severity": "critical",
      "arg_positions": [0]
    },
    {
      "method": "QueryRow",
      "class": "DB",
      "type": "sql_injection",
      "cwe": "CWE-89",
      "severity": "critical",
      "arg_positions": [0]
    },
    {
      "method": "Exec",
      "class": "DB",
      "type": "sql_injection",
      "cwe": "CWE-89",
      "severity": "critical",
      "arg_positions": [0]
    },
    {
      "method": "Query",
      "class": "Tx",
      "type": "sql_injection",
      "cwe": "CWE-89",
      "severity": "critical",
      "arg_positions": [0]
    },
    {
      "method": "Command",
      "class": "exec",
      "type": "command_injection",
      "cwe": "CWE-78",
      "severity": "critical",
      "arg_positions": [0]
    },
    {
      "method": "CommandContext",
      "class": "exec",
      "type": "command_injection",
      "cwe": "CWE-78",
      "severity": "critical",
      "arg_positions": [1]
    },
    {
      "method": "Open",
      "class": "os",
      "type": "path_traversal",
      "cwe": "CWE-22",
      "severity": "high",
      "arg_positions": [0]
    },
    {
      "method": "ReadFile",
      "class": "os",
      "type": "path_traversal",
      "cwe": "CWE-22",
      "severity": "high",
      "arg_positions": [0]
    },
    {
      "method": "WriteFile",
      "class": "os",
      "type": "path_traversal",
      "cwe": "CWE-22",
      "severity": "high",
      "arg_positions": [0]
    },
    {
      "method": "Fprintf",
      "class": "fmt",
      "type": "xss",
      "cwe": "CWE-79",
      "severity": "high",
      "arg_positions": [1]
    },
    {
      "method": "Write",
      "class": "ResponseWriter",
      "type": "xss",
      "cwe": "CWE-79",
      "severity": "high",
      "arg_positions": [0]
    },
    {
      "method": "Execute",
      "class": "Template",
      "type": "xss",
      "cwe": "CWE-79",
      "severity": "high",
      "arg_positions": [1],
      "note": "text/template renders user data without HTML escaping. html/template auto-escapes (handled by html-escape sanitizer)."
    },
    {
      "method": "ExecuteTemplate",
      "class": "Template",
      "type": "xss",
      "cwe": "CWE-79",
      "severity": "high",
      "arg_positions": [2],
      "note": "text/template.ExecuteTemplate renders named template with user data — no auto-escape."
    },
    {
      "method": "Get",
      "class": "http",
      "type": "ssrf",
      "cwe": "CWE-918",
      "severity": "high",
      "arg_positions": [0]
    },
    {
      "method": "Post",
      "class": "http",
      "type": "ssrf",
      "cwe": "CWE-918",
      "severity": "high",
      "arg_positions": [0]
    },
    {
      "method": "Unmarshal",
      "class": "json",
      "type": "deserialization",
      "cwe": "CWE-502",
      "severity": "medium",
      "arg_positions": [0]
    }
  ],
  "sanitizers": [
    {
      "method": "Prepare",
      "class": "DB",
      "removes": ["sql_injection"],
      "note": "Prepared statements prevent SQL injection"
    },
    {
      "method": "Clean",
      "class": "filepath",
      "removes": ["path_traversal", "external_taint_escape"],
      "note": "filepath.Clean normalizes path, preventing traversal"
    },
    {
      "method": "EscapeString",
      "class": "html",
      "removes": ["xss", "external_taint_escape", "log_injection", "open_redirect"],
      "note": "html.EscapeString escapes HTML entities — safe for HTML output and structured logs"
    },
    {
      "method": "HTMLEscapeString",
      "class": "template",
      "removes": ["xss", "external_taint_escape", "log_injection", "open_redirect"],
      "note": "template.HTMLEscapeString escapes HTML"
    },
    {
      "method": "Atoi",
      "class": "strconv",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"],
      "note": "Numeric cast — output cannot carry string injection"
    },
    {
      "method": "ParseInt",
      "class": "strconv",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"]
    },
    {
      "method": "ParseFloat",
      "class": "strconv",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"]
    },
    {
      "method": "ParseUint",
      "class": "strconv",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"]
    },
    {
      "method": "ParseBool",
      "class": "strconv",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"]
    },
    {
      "method": "Parse",
      "class": "uuid",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"],
      "note": "uuid.Parse() — throws on non-UUID input"
    },
    {
      "method": "MustParse",
      "class": "uuid",
      "removes": ["sql_injection", "command_injection", "path_traversal", "code_injection"]
    },
    {
      "method": "Base",
      "class": "filepath",
      "removes": ["path_traversal", "external_taint_escape"],
      "note": "filepath.Base returns final element only — strips traversal segments"
    },
    {
      "method": "EvalSymlinks",
      "class": "filepath",
      "removes": ["path_traversal", "external_taint_escape"],
      "note": "filepath.EvalSymlinks resolves symlinks to absolute path"
    },
    {
      "method": "Clean",
      "class": "path",
      "removes": ["path_traversal", "external_taint_escape"],
      "note": "path.Clean (slash-only) normalizes ../ segments"
    },
    {
      "method": "Base",
      "class": "path",
      "removes": ["path_traversal", "external_taint_escape"],
      "note": "path.Base returns final slash-element only"
    }
  ]
}
