🛡️ Sentinel: [CRITICAL] Fix SQL injection in PRAGMA table_info usage#93
🛡️ Sentinel: [CRITICAL] Fix SQL injection in PRAGMA table_info usage#93mattjoyce wants to merge 1 commit into
Conversation
…tion
Updated `sqliteColumnExists` in `internal/storage/sqlite.go` to use the `pragma_table_info(?)` table-valued function with a parameterized argument instead of dynamically constructing a SQL query using string interpolation (`fmt.Sprintf("PRAGMA table_info(%s);", table)`). This ensures the codebase is secure against SQL injection if the table name is ever derived from untrusted input. Recorded this security improvement in `.jules/sentinel.md`.
Co-authored-by: mattjoyce <278869+mattjoyce@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesSQL Injection Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
A binary swapped since its grant must not inherit a trusted worker identity: bindWorkerToFingerprint (reusing #12's PluginVerifier) downgrades it to the most-restricted tier (untrusted) so a supply-chain swap cannot reach a sibling's memory; fail-closed if there is no tier to downgrade to. Blast-radius reduction, not an execution gate (grill B5). Wired into spawnPlugin with a worker_downgraded event. Unit-tested with a fake verifier; downgrade/keep/fail-closed paths covered.
A binary swapped since its grant must not inherit a trusted worker identity: bindWorkerToFingerprint (reusing #12's PluginVerifier) downgrades it to the most-restricted tier (untrusted) so a supply-chain swap cannot reach a sibling's memory; fail-closed if there is no tier to downgrade to. Blast-radius reduction, not an execution gate (grill B5). Wired into spawnPlugin with a worker_downgraded event. Unit-tested with a fake verifier; downgrade/keep/fail-closed paths covered.
…locate, secrets not a config reconcile Relocating plugin code to /opt invalidates attestation → #93 fail-safe downgrades to untrusted until plugin lock re-records fingerprints (witnessed live). Plugin secrets need the #107 vault-native workstream (PluginConf has no secret_ref; principals must be kebab; vault compose fail-open #108). migrate-everything splits 3 ways: keyless-now / secret-holders-after-#107 / unconfinable-admin-#106.
Enforced data-plane gateway live on :8081: vault carried, 5 keyless integrations enforced+attested on default(1001), config/plugin lock, admission re-enabled, all wall-bites pass. #93 downgrade proven live. Remaining carded as dev workstreams: #107 (HEAVY, secret-holders), #106 (admin instance), #108 (vault fail-open), #105 (FHS package). Old --user decommission deferred until #106+#107 land.
🚨 Severity: CRITICAL
💡 Vulnerability: Found a potential SQL injection vulnerability in
sqliteColumnExistswherefmt.Sprintf("PRAGMA table_info(%s);", table)was used to dynamically construct a SQL query using string interpolation instead of parameterized queries.🎯 Impact: If
sqliteColumnExistsis ever used with a table name coming from an untrusted source, it could lead to SQL injection attacks against the application's underlying database.🔧 Fix: Changed the function to use the table-valued function
pragma_table_info(?)which natively supports query parameterization instead of direct string formatting, removing the SQL injection vector. Also documented this pattern in.jules/sentinel.md.✅ Verification: Verified changes visually and ensured storage tests (
go test -v ./internal/storage/...) pass without issue.PR created automatically by Jules for task 1189187947129556733 started by @mattjoyce
Summary by CodeRabbit