Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SQL injection vulnerability in jsonExtract#112

Open
Donach wants to merge 1 commit into
cfx/android-hermes-clientfrom
sentinel/sql-injection-jsonextract-15926952073635702236
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SQL injection vulnerability in jsonExtract#112
Donach wants to merge 1 commit into
cfx/android-hermes-clientfrom
sentinel/sql-injection-jsonextract-15926952073635702236

Conversation

@Donach

@Donach Donach commented Jun 30, 2026

Copy link
Copy Markdown

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: A SQL injection vulnerability existed in the jsonExtract utility function in packages/core/src/db/database-wrapper.ts. The code used sql.raw to dynamically insert JSON keys into PostgreSQL JSON operators (e.g., -> and ->>), completely bypassing parameterization.
🎯 Impact: If jsonExtract receives user-controlled input as part of the path argument, it would allow a malicious actor to perform a SQL injection, potentially gaining unauthorized read or write access to the PostgreSQL database.
πŸ”§ Fix: Replaced the sql.raw usages with parameterized Drizzle template strings, explicitly casting the parameterized keys as ::text (e.g. sql\->> (${key}::text)`) to prevent injection while allowing PostgreSQL to correctly resolve the overloaded JSON operators. βœ… **Verification:** Verified by successfully running the workspace linters (pnpm -w run lint:fix) and @agor/core` test suite without introducing any regressions or functionally altering valid code paths.


PR created automatically by Jules for task 15926952073635702236 started by @Donach

- Replaced `sql.raw` with parameterized template strings using `::text` casting in `packages/core/src/db/database-wrapper.ts` for PostgreSQL JSON operators.
- Added a security learning to `.jules/sentinel.md` outlining the SQL injection risk with `sql.raw` and PostgreSQL JSON operators.

Co-authored-by: Donach <39565367+Donach@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant