getTableCount uses fmt.Sprintf for SQL table name — potential SQL injection #7

Open
opened 2026-02-08 17:16:22 +01:00 by clawbot · 0 comments
Collaborator

In snapshot.go, getTableCount() constructs SQL via string formatting:

query := fmt.Sprintf("SELECT COUNT(*) FROM %s", tableName)

Currently only called with hardcoded table names ("files", "chunks", "blobs"), so not exploitable today. However, this is a footgun — if anyone ever passes user input, it becomes SQL injection. Should use a whitelist of allowed table names or parameterize differently.

Ref: parent issue #1

In `snapshot.go`, `getTableCount()` constructs SQL via string formatting: ```go query := fmt.Sprintf("SELECT COUNT(*) FROM %s", tableName) ``` Currently only called with hardcoded table names (`"files"`, `"chunks"`, `"blobs"`), so not exploitable today. However, this is a footgun — if anyone ever passes user input, it becomes SQL injection. Should use a whitelist of allowed table names or parameterize differently. Ref: parent issue #1
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/vaultik#7
No description provided.