Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SQL injection in metadata generation#200

Open
thebearwithabite wants to merge 1 commit intomasterfrom
sentinel/fix-sql-injection-4276451137286979743
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SQL injection in metadata generation#200
thebearwithabite wants to merge 1 commit intomasterfrom
sentinel/fix-sql-injection-4276451137286979743

Conversation

@thebearwithabite
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: SQL Injection via dictionary keys
🎯 Impact: An attacker injecting arbitrary keys into the file metadata mapping could execute unparameterized SQL operations, potentially extracting sensitive data, mutating tables, or dropping the schema via INSERT OR REPLACE and ALTER TABLE.
πŸ”§ Fix: Refactored dynamic SQL generation in metadata_generator.py to enforce a strictly validated schema allowlist fetched via PRAGMA table_info, ensuring keys map perfectly to existing database fields, while appending Python's str.isidentifier() as an additional defensive tier for new columns.
βœ… Verification: Verified fix securely filters injected keys without crashing operations via test script (temp_mock.py). Recorded critical learning in .jules/sentinel.md.


PR created automatically by Jules for task 4276451137286979743 started by @thebearwithabite

Identified and fixed a critical SQL injection vulnerability in `metadata_generator.py` where dictionary keys were used dynamically to construct SQL `INSERT` and `ALTER TABLE` queries. The fix leverages `PRAGMA table_info` and `.isidentifier()` to validate columns dynamically, neutralizing potential exploits while retaining functional flexibility.

Co-authored-by: thebearwithabite <216692431+thebearwithabite@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

πŸ‘‹ 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