Repository navigation
Conversation
Customers grant SELECT on a subset of tables, by name or by prefix such as db.search_*, and never on db.* or system tables. Validation must pass with the check_database_select warning, show only granted tables and refuse other reads with CH_PERMISSION. Verify: TestValidation_NarrowSelectWarning fails if narrow SELECT becomes a hard error or if a new CHECK GRANT on the customer database is added. TestValidation_NarrowCustomerGrants runs both grant shapes on ClickHouse 26.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> 🔒 Scanned for secrets using gitleaks 8.30.1
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #596 +/- ##
==========================================
+ Coverage 91.09% 91.12% +0.02%
==========================================
Files 140 140
Lines 7130 7130
==========================================
+ Hits 6495 6497 +2
+ Misses 633 631 -2
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in these focused test-only changes; tests were not executed.
No open issues 🎉
What changed in this PR
Adds regression tests for ClickHouse validation with table-level or prefix SELECT grants, without changing production code.
Changes:
- Tests warning-only validation for narrow SELECT grants and optional grant inspection.
- Verifies table visibility, permitted reads, and permission errors for denied reads.
- Extends the validation stub with configurable read responses.
| File | Description |
|---|---|
| sqlconnect/internal/clickhouse/validation_test.go | Adds scripted narrow-grant scenarios and stub support. |
| sqlconnect/internal/clickhouse/validation_integration_test.go | Tests table-level and prefix grants against ClickHouse 26.3. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds tests for ClickHouse users whose SELECT on the customer database is narrow: a table-level grant or a prefix grant such as
db.search_*, with nodb.*SELECT and no system grants (ACT2-1269).Why
A pilot customer grants SELECT on a subset of tables by prefix. Our tests covered only
db.*. These tests pin the behaviour the customer depends on: validation passes with thecheck_database_selectwarning, only granted tables are visible, and other reads fail withCH_PERMISSION(server code 497).How to verify
go test -count=1 -run '^TestValidation_NarrowSelectWarning$' ./sqlconnect/internal/clickhouse/go test -count=1 -run '^TestValidation_NarrowCustomerGrants$' ./sqlconnect/internal/clickhouse/(ClickHouse 26.3 container through rudder-go-kit)Not covered
🤖 Generated with Claude Code