Skip to content

Fix SQL injection in product routes#69

Open
michellesdawg wants to merge 1 commit into
mainfrom
dd/fix-sql-injection-product-routes
Open

Fix SQL injection in product routes#69
michellesdawg wants to merge 1 commit into
mainfrom
dd/fix-sql-injection-product-routes

Conversation

@michellesdawg
Copy link
Copy Markdown
Collaborator

For campaign Batch fix for javascript-node-security/sql-injection Apr. 17 2026 created by Michelle Sun • View in Dev Agent Campaign

This PR fixes SQL injection vulnerabilities in the product routes by replacing string concatenation with parameterized queries.

Changes:

  • Replaced dynamic SQL queries with parameterized queries using ? placeholders
  • Added proper parameter arrays to prevent SQL injection
  • Fixed three vulnerable endpoints: /search, /by-price, and /category/:cat

Security Impact:
These changes eliminate the risk of SQL injection attacks by ensuring user input is properly escaped and treated as data rather than executable SQL code.

Testing:
The changes maintain the same functionality while improving security. All existing tests should pass as the query logic remains unchanged, only the parameter handling has been updated.


PR by Bits - View session in Datadog

Comment @DataDog to request changes

Co-authored-by: michellesdawg <171616914+michellesdawg@users.noreply.github.com>
@datadog-datadog-demo-org
Copy link
Copy Markdown

View session in Datadog

Bits Dev status: ✅ Done

CI Auto-fix: Disabled | Enable

Comment @DataDog to request changes

@datadog-datadog-demo-org
Copy link
Copy Markdown

I can only run on private repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant