Skip to content

Fix SQL injection in getItemsByTag (#243)#254

Open
boot-coco wants to merge 1 commit intodevelopfrom
fix/243-sql-injection-tag-query
Open

Fix SQL injection in getItemsByTag (#243)#254
boot-coco wants to merge 1 commit intodevelopfrom
fix/243-sql-injection-tag-query

Conversation

@boot-coco
Copy link
Copy Markdown
Contributor

Summary

  • Replace LIKE pattern matching with SQLite json_each() in getItemsByTag to prevent SQL injection via LIKE wildcards (%, _) and double-quotes
  • All query parameters are now fully parameterized with no string interpolation
  • Added test case verifying that LIKE wildcards and partial matches no longer produce false results

Test plan

  • All 515 existing tests pass
  • New test confirms % wildcard no longer matches all items
  • New test confirms partial tag names don't match (exact match only)

Closes #243

🤖 Generated with Claude Code

Replace LIKE pattern matching with SQLite json_each() for proper JSON
array searching. The previous approach interpolated the tag parameter
into a LIKE pattern, allowing SQL wildcards (%, _) and double-quotes
to alter query semantics and leak data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@jessie-coco jessie-coco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQL injection fix LGTM. Parameterized query with json_each() is the correct approach. 515/515 tests passing.

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.

2 participants