Skip to content

Fix SQL injection in maybe_delete_stats() (#21) - #27

Open
GreggFranklin wants to merge 1 commit into
groundhoggwp:masterfrom
GreggFranklin:fix-issue-21
Open

Fix SQL injection in maybe_delete_stats() (#21)#27
GreggFranklin wants to merge 1 commit into
groundhoggwp:masterfrom
GreggFranklin:fix-issue-21

Conversation

@GreggFranklin

@GreggFranklin GreggFranklin commented Aug 6, 2026

Copy link
Copy Markdown

Fixes #21 - $post_id is now passed as a %d placeholder through $wpdb->prepare() instead of being interpolated directly into the SQL string. prepare() casts it to an integer and escapes it, so no value in that position can alter the query structure. The table name stays interpolated (it can't be a placeholder), but it's a plugin-controlled constant, not user input. Wrapping it in {} is just clarity, not security.

@GreggFranklin GreggFranklin changed the title SQL injection in maybe_delete_stats() (#21) Fix SQL injection in maybe_delete_stats() (#21) Aug 6, 2026
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.

SQL injection in maybe_delete_stats()

1 participant