harden: add parameterized queries in lynkr-reset.js - #107
Open
anupamme wants to merge 1 commit into
Open
Conversation
Automated security fix generated by OrbisAI Security
| let hadError = false; | ||
| for (const t of targets) { | ||
| const { table } = RESOURCES[t]; | ||
| const { countQuery, deleteQuery } = RESOURCES[t]; |
There was a problem hiding this comment.
Duplicated resource table mapping
The reset loop now ignores table and relies on two independent SQL strings, duplicating each resource's table mapping across three fields. Renaming a table or adding a resource requires synchronized edits, otherwise the command can report a count for one table while deleting another or fail at runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Harden input handling in
bin/lynkr-reset.js(flagged by semgrep).Vulnerability
utils.custom.sql-injection-template-literalbin/lynkr-reset.js:62Description: SQL query constructed using JavaScript template literals with dynamic input. This can lead to SQL injection. Use parameterized queries instead.
Threat Model Context
This is a web service - vulnerabilities in request handlers are directly exploitable by remote attackers.
Changes
bin/lynkr-reset.jsBehavior Preservation
The change is scoped to 1 file on the vulnerable path.
Security Invariant
Regression test
This test guards against regressions — it's useful independent of the code change above.
This patch removes an exploit primitive — a code pattern that, while not independently exploitable today, could be chained with other weaknesses by automated exploit-development tooling. Proactive removal of such primitives raises the bar against increasingly capable automated attack tools.
Automated security fix by OrbisAI Security
Greptile Summary
The PR replaces dynamically assembled reset SQL with fixed statements from the internal resource allowlist, preventing resource names from being interpolated into queries.
session_pinsresource.Confidence Score: 4/5
The PR appears safe to merge, with a non-blocking maintainability concern around duplicated resource table configuration.
The fixed queries correctly target the sole supported resource, but the reset loop no longer uses the existing table field and therefore creates multiple independently maintained representations of the same mapping.
Files Needing Attention: bin/lynkr-reset.js
Important Files Changed
Reviews (1): Last reviewed commit: "fix: utils.custom.sql-injection-template..." | Re-trigger Greptile