Fix SQL injection vulnerability in cleanup-template.ts #1939

Closed
opened 2026-02-28 19:59:10 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @coderabbitai[bot] on GitHub (Mar 6, 2025).

Originally assigned to: @joel-jeremy on GitHub.

This issue addresses a SQL injection vulnerability in the cleanup-template.ts file.

Currently, there is direct string concatenation in an SQL query:

const notes = await db.all<db.DbNote>(
  `SELECT * FROM notes WHERE lower(note) like '%${TEMPLATE_PREFIX}%'`,
);

It should be replaced with parameterized queries:

const notes = await db.all<db.DbNote>(
  `SELECT * FROM notes WHERE lower(note) like ?`,
  [`%${TEMPLATE_PREFIX}%`]
);

The fix has been implemented and pushed to the 'fix-sql-injection-in-cleanup-template' branch but creating a PR is experiencing technical difficulties.

cc: @joel-jeremy

Originally created by @coderabbitai[bot] on GitHub (Mar 6, 2025). Originally assigned to: @joel-jeremy on GitHub. This issue addresses a SQL injection vulnerability in the cleanup-template.ts file. Currently, there is direct string concatenation in an SQL query: ```typescript const notes = await db.all<db.DbNote>( `SELECT * FROM notes WHERE lower(note) like '%${TEMPLATE_PREFIX}%'`, ); ``` It should be replaced with parameterized queries: ```typescript const notes = await db.all<db.DbNote>( `SELECT * FROM notes WHERE lower(note) like ?`, [`%${TEMPLATE_PREFIX}%`] ); ``` The fix has been implemented and pushed to the 'fix-sql-injection-in-cleanup-template' branch but creating a PR is experiencing technical difficulties. cc: @joel-jeremy
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#1939