fix: CodeQL alerts#31
Conversation
CodeQL continued to flag operator-authored SQL, 1Password CLI arguments, and schema map allocation. Validate structured op references before invocation, document intentional full-query execution for CodeQL, and avoid overflow-prone capacity arithmetic.
WalkthroughThe change adds structured validation for 1Password references with tests, documents intentional execution of complete caller-supplied SQL statements for CodeQL, and removes a map capacity hint in Changes1Password reference validation
SQL analysis and schema cleanup
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
query/schema/connection.go (1)
112-112: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winPreserve the map capacity hint unless benchmarks justify removing it.
appendUniquecan insert up tolen(base)+len(values)keys. Without preallocation, large inputs may require additional map growth and allocations. Retain the hint or add a benchmark demonstrating a real memory improvement.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@query/schema/connection.go` at line 112, Update the map initialization in appendUnique to preallocate capacity for up to len(base)+len(values) entries, preserving the existing capacity hint and avoiding unnecessary map growth for large inputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@query/schema/connection.go`:
- Line 112: Update the map initialization in appendUnique to preallocate
capacity for up to len(base)+len(values) entries, preserving the existing
capacity hint and avoiding unnecessary map growth for large inputs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0e90a32a-8e6e-4c12-8fc8-3c86ba82dbd5
📒 Files selected for processing (5)
cmd/query/connections/browser.gocontext/onepassword.gocontext/onepassword_test.goquery/providers/sql.goquery/schema/connection.go
Summary by CodeRabbit
Bug Fixes
Security
Maintenance