Skip to content

🛡️ Sentinel: [CRITICAL] Fix SQL Injection in PRAGMA table_info check#88

Open
mattjoyce wants to merge 1 commit into
mainfrom
sentinel-sqlite-injection-fix-2208617742026367357
Open

🛡️ Sentinel: [CRITICAL] Fix SQL Injection in PRAGMA table_info check#88
mattjoyce wants to merge 1 commit into
mainfrom
sentinel-sqlite-injection-fix-2208617742026367357

Conversation

@mattjoyce
Copy link
Copy Markdown
Owner

🛡️ Sentinel: [CRITICAL] Fix SQL Injection vulnerability in PRAGMA table_info

🚨 Severity: CRITICAL
💡 Vulnerability: The sqliteColumnExists function in internal/storage/sqlite.go was using fmt.Sprintf to directly interpolate the table variable into the PRAGMA query string (PRAGMA table_info(%s);). This creates a critical SQL injection risk if user-controlled or variable data is passed to this check.
🎯 Impact: If exploited, an attacker could inject arbitrary SQLite syntax, bypass schema checks, read unintended tables, or potentially escalate depending on the surrounding logic or available attack surface.
🔧 Fix: Refactored the function to use SQLite's table-valued PRAGMA function (pragma_table_info(?)), allowing the table name to be safely passed as a bound parameter. Explicitly double-quoted the "notnull" reserved keyword in the column list to avoid syntax errors.
Verification: Verified by running make test and go test ./internal/storage/... to ensure all functionality and tests remain green.


PR created automatically by Jules for task 2208617742026367357 started by @mattjoyce

…ed table-valued functions

Co-authored-by: mattjoyce <278869+mattjoyce@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.

mattjoyce added a commit that referenced this pull request Jun 6, 2026
…verifies under cap-only (#88)

A cap-only gateway (CAP_SETUID+CAP_SETGID, no CAP_CHOWN) cannot chown worker dirs,
so they are init-provisioned (sysusers.d accounts + tmpfiles.d 0700 dirs) and the
gateway VERIFIES them fail-closed (reconcileWorkerDir: best-effort provision, then
verify). Ships deploy/systemd/ templates + DEPLOYMENT.md §5b. Test gates switch from
euid to hasDropCapability; adds TestPrivsepDropUnderCapabilityOnly for systemd-run.
mattjoyce added a commit that referenced this pull request Jun 6, 2026
mattjoyce added a commit that referenced this pull request Jun 6, 2026
…verifies under cap-only (#88)

A cap-only gateway (CAP_SETUID+CAP_SETGID, no CAP_CHOWN) cannot chown worker dirs,
so they are init-provisioned (sysusers.d accounts + tmpfiles.d 0700 dirs) and the
gateway VERIFIES them fail-closed (reconcileWorkerDir: best-effort provision, then
verify). Ships deploy/systemd/ templates + DEPLOYMENT.md §5b. Test gates switch from
euid to hasDropCapability; adds TestPrivsepDropUnderCapabilityOnly for systemd-run.
mattjoyce added a commit that referenced this pull request Jun 6, 2026
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