Skip to content

Conversation

@3rabiii
Copy link
Contributor

@3rabiii 3rabiii commented Feb 9, 2026

Description

Addresses the High Severity security vulnerability identified in gtfsdb/debugging.go.

The original implementation of TableCounts constructed SQL queries using string interpolation (fmt.Sprintf), which is flagged as a potential SQL Injection vector despite the map-based check.

Changes:

  • Security Fix: Replaced dynamic string formatting with a strict switch-case allowlist. This ensures the executed SQL queries are constant strings, eliminating any risk of injection.
  • Refactoring: Removed the redundant allowedTables map.
  • Testing: Added gtfsdb/debugging_test.go with a new unit test TestTableCounts to verify:
    • Correct counting of whitelisted tables.
    • Proper ignoring of unknown/non-whitelisted tables.

Verification

Screenshot From 2026-02-09 22-46-29

@aaronbrethorst
fixes : #367

@3rabiii 3rabiii force-pushed the fix/sql-injection-table-counts branch from ee18b29 to f5f8229 Compare February 9, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Potential SQL Injection in TableCounts

1 participant