Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis pull request introduces case-insensitive string filtering through new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 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 |
Pull Request Test Coverage Report for Build 23581110940Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1c9eba0b-c172-4ae4-8f52-3ee982080f31
📒 Files selected for processing (1)
internal/store/postgres/org_billing_repository.go
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/store/postgres/org_billing_repository_test.go (1)
110-126: Add a matchingnotlikeregression case.This PR changes both
likeandnotlike, but this table only addslikecoverage. Add a sibling case assertingNOT ILIKEgeneration to prevent one-sided regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0acc1813-2df9-42bf-9dcb-84163a7884f8
📒 Files selected for processing (1)
internal/store/postgres/org_billing_repository_test.go
…and query processing
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
internal/store/postgres/org_billing_repository.go (1)
420-423:⚠️ Potential issue | 🔴 CriticalLine 421 and Line 423: Raw SQL interpolation introduces injection risk.
filter.Valueis interpolated directly into SQL viafmt.Sprintf, so crafted input can break out of the predicate. Please switch to parameterized goqu expressions (same fix should be applied to all LIKE/ILIKE branches).🔧 Proposed fix
- case OPERATOR_ILIKE: - query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT ILIKE '%s'`, filter.Name, filter.Value.(string)))) - case OPERATOR_NOT_ILIKE: - query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT NOT ILIKE '%s'`, filter.Name, filter.Value.(string)))) + case OPERATOR_ILIKE: + query = query.Where(goqu.Cast(goqu.I(filter.Name), "TEXT").ILike(filter.Value.(string))) + case OPERATOR_NOT_ILIKE: + query = query.Where(goqu.Cast(goqu.I(filter.Name), "TEXT").NotILike(filter.Value.(string)))#!/bin/bash set -euo pipefail echo "=== Interpolated LIKE/ILIKE patterns in org_billing_repository.go ===" rg -nP 'fmt\.Sprintf\(`"%s"::TEXT (NOT )?I?LIKE '\''%s'\''' internal/store/postgres/org_billing_repository.go || true echo echo "=== Parameterized/cast expressions present ===" rg -nP 'goqu\.Cast\(goqu\.I\(filter\.Name\), "TEXT"\)\.(I|NotI|L|NotL)ike\(' internal/store/postgres/org_billing_repository.go || true
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c9ef6627-0bd0-4bfb-b4fa-290566c6fc63
📒 Files selected for processing (4)
internal/api/v1beta1connect/organization_billing.gointernal/api/v1beta1connect/rql_validation.gointernal/store/postgres/org_billing_repository.goweb/sdk/admin/utils/transform-query.ts
…salt/rql validation
…rsion from go.mod
Summary
Make organization like filters case-insensitive in Admin SearchOrganizations backend query handling.
Related PR - raystack/salt#83
Changes
Updated frontier/internal/store/postgres/org_billing_repository.go
Added regression coverage in frontier/internal/store/postgres/org_billing_repository_test.go to assert title like generates ILIKE.
Why
Filtering organizations by title from /organizations returned different results for different casing (e.g. fah vs Fah). This aligns filter behavior with expected case-insensitive search.
Technical Details
Test Plan