Skip to content

CXH-1588: fix role-grant expandable to reference principal, not parent role#135

Merged
manuel-ts-14 merged 1 commit into
mainfrom
manueltraversarosasia/cxh-1588-baton-sql-redshift-role-to-role-grant-aborts-the-entire-sync
Jun 4, 2026
Merged

CXH-1588: fix role-grant expandable to reference principal, not parent role#135
manuel-ts-14 merged 1 commit into
mainfrom
manueltraversarosasia/cxh-1588-baton-sql-redshift-role-to-role-grant-aborts-the-entire-sync

Conversation

@manuel-ts-14
Copy link
Copy Markdown
Contributor

Summary

Fixes CXH-1588. The svv_role_grants expandable in examples/redshift-test.yml referenced .granted_role_name (the parent role = the grant resource) instead of .role_name (the member role = the grant principal). After CXH-1583 swapped the grant direction so the principal is role_name, the expandable's source entitlement no longer matched the grant's principal, so baton-sdk rejected the grant (source entitlement resource id did not match grant principal id) and the runner aborted the entire full sync.

Because Redshift ships built-in system role grants (sys:dba <- sys:operator) in svv_role_grants, this aborted the sync on every real cluster out of the box.

Change

examples/redshift-test.yml — the svv_role_grants expandable now references 'role:' + .role_name + ':member' (the principal) instead of .granted_role_name (the resource), with a comment explaining the principal requirement.

Verification

Against a live Redshift Serverless cluster (2026-06-04):

  • Before: full sync deterministically aborts with the validation error; no .c1z.
  • After: Sync complete., and role-hierarchy expansion materializes — read_only inherits analytics.reporting_data.daily_metrics SELECT via reporting.
  • go build + go test ./pkg/bsql/... ./pkg/connector/... (116 tests) pass.

🤖 Generated with Claude Code

…t role

The svv_role_grants expandable in examples/redshift-test.yml referenced
.granted_role_name (the parent role / grant resource) instead of
.role_name (the member role / grant principal). After CXH-1583 swapped
the grant direction so the principal is role_name, the expandable's
source entitlement no longer belonged to the grant's principal, so
baton-sdk rejected the grant ("source entitlement resource id did not
match grant principal id") and the runner aborted the entire sync on any
role-to-role grant -- which every Redshift cluster has via built-in
system roles (sys:dba <- sys:operator).

Reference the principal's member entitlement instead. Verified against a
live Redshift Serverless cluster: sync now completes and role-hierarchy
expansion fans grants down to member users (read_only inherits
daily_metrics SELECT via reporting).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@manuel-ts-14 manuel-ts-14 requested a review from a team June 4, 2026 15:40
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 4, 2026

CXH-1588

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Connector PR Review: CXH-1588: fix role-grant expandable to reference principal, not parent role

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Review mode: full
View review run

Review Summary

The PR fixes a single field reference in examples/redshift-test.yml: the svv_role_grants expandable was using .granted_role_name (the parent role / grant resource) instead of .role_name (the member role / grant principal). Since the grant's principal_id is .role_name, the expandable's source entitlement must reference the same field — the mismatch caused the SDK to reject the grant and abort the entire sync. The fix is correct and minimal.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

@manuel-ts-14 manuel-ts-14 merged commit fbf3a03 into main Jun 4, 2026
9 checks passed
@manuel-ts-14 manuel-ts-14 deleted the manueltraversarosasia/cxh-1588-baton-sql-redshift-role-to-role-grant-aborts-the-entire-sync branch June 4, 2026 17:24
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.

4 participants