Skip to content

Allow CatalogAdmin to list Principal Roles#3852

Open
vignesh-manel wants to merge 2 commits intoapache:mainfrom
vignesh-manel:feature/catalog-admin-list-principal-role
Open

Allow CatalogAdmin to list Principal Roles#3852
vignesh-manel wants to merge 2 commits intoapache:mainfrom
vignesh-manel:feature/catalog-admin-list-principal-role

Conversation

@vignesh-manel
Copy link

Duplicate of #3761 which got closed accidentally while rebasing

Implements automatic principal role listing for catalog_admin users via a new system-managed catalog_role_manager role. Fixes #363

Implementation

  • catalog_role_manager created at bootstrap with PRINCIPAL_ROLE_LIST privilege (read-only)
  • Automatically granted to principals when they receive catalog_admin on any catalog
  • Automatically revoked when all catalog_admin grants are removed

Limitations

  • A new system role is introduced just to grant PRINCIPAL_ROLE_LIST for catalog_admin
  • Principal must be assigned to principal role before granting catalog_admin. If assigned after, revoke and re-grant catalog_admin to trigger auto-grant.
  • No backfill for existing catalog_admin grants (requires manual grant or re-grant)

CC: @collado-mike

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Feb 20, 2026
@vignesh-manel vignesh-manel changed the title Feature/catalog admin list principal role Allow CatalogAdmin to list Principal Roles Feb 20, 2026
@dimas-b
Copy link
Contributor

dimas-b commented Feb 23, 2026

@vignesh-manel : please avoid opening multiple PRs for the same feature (cf. https://polaris.apache.org/community/contributing-guidelines/)

You should be able to take the commits from this PR, put them into your local vignesh-manel:main branch and force-push into #3761

Once that PR is merged, you'll be able to reuse main for a different purpose locally 😉

@vignesh-manel
Copy link
Author

@vignesh-manel : please avoid opening multiple PRs for the same feature (cf. https://polaris.apache.org/community/contributing-guidelines/)

You should be able to take the commits from this PR, put them into your local vignesh-manel:main branch and force-push into #3761

Once that PR is merged, you'll be able to reuse main for a different purpose locally 😉

@dimas-b I had tried that, I had forced push the same commits to the main branch of my fork, even though they showed up in the fork, GitHub wasn't giving me the option to reopen the old PR. Seems to be an issue with GitHub isaacs/github#361 hence I created this new PR

@dimas-b
Copy link
Contributor

dimas-b commented Feb 24, 2026

@vignesh-manel : no worries, let's continue on this PR 👍

@dimas-b
Copy link
Contributor

dimas-b commented Feb 24, 2026

@dimas-b
Copy link
Contributor

dimas-b commented Feb 24, 2026

@vignesh-manel : just heads up: I'm willing to facilitate the progress of this PR, but I do not have enough context for the internal Polaris RBAC system and its applications for an approval.

I hope @dennishuo, @collado-mike, @flyrain could provide feedback on the actual behaviour changes.

private static final String ADMIN_PRINCIPAL_ROLE_NAME = "service_admin";

// the name of the principal role for catalog admins to list principal roles
private static final String CATALOG_ROLE_MANAGER_PRINCIPAL_ROLE_NAME = "catalog_role_manager";

Choose a reason for hiding this comment

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

should it be protected from being droppable?

// if revoking catalog_admin, check if principal still has catalog_admin on other catalogs
if (result.isSuccess()
&& PolarisEntityConstants.getNameOfCatalogAdminRole().equals(catalogRoleName)) {
revokeCatalogRoleManagerIfNeeded(principalRoleEntity);

Choose a reason for hiding this comment

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

I see the catalog_role_manager is revoked only via revokeCatalogRoleFromPrincipalRole, but catalog_role_manager is granted to principal (not principal roles). Say when a principal is unassigned from a principal role (i.e., revoke principal role from principal API), catalog_role_manager granted to the principal would be never revoked.

I feel it should be cleaned up as well to avoid leaking PRINCIPAL_ROLE_LIST privilege

Choose a reason for hiding this comment

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

Similarly, when catalog drops, it should be cleaned up

Choose a reason for hiding this comment

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

we should have tests capturing them

PolarisEntityConstants.getNameOfCatalogRoleManagerPrincipalRole());

if (!catalogRoleManagerResult.isSuccess() || catalogRoleManagerResult.getEntity() == null) {
return;

Choose a reason for hiding this comment

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

2 cents: log something when nothing found. This should be helpful to capture the missing catalog_role_manager role, as currently it is created only during bootstrap IIUC, i.e., we don't have upgrade/backfill path for already bootstrapped realms. I'm fine with temporary gaps for upgrade and backfill, but strongly recommend at least to warn on role not found

PolarisEntityConstants.getNameOfCatalogRoleManagerPrincipalRole());

if (!catalogRoleManagerResult.isSuccess() || catalogRoleManagerResult.getEntity() == null) {
return;

Choose a reason for hiding this comment

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

2 cents: log something when nothing found

// if granting catalog_admin, also grant catalog_role_manager to allow listing principal roles
if (result.isSuccess()
&& PolarisEntityConstants.getNameOfCatalogAdminRole().equals(catalogRoleName)) {
grantCatalogRoleManagerIfNeeded(principalRoleEntity);

Choose a reason for hiding this comment

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

catalog role manager should be granted on catalog_admin grant to a role as well, i.e., inside assignPrincipalRole

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.

[FEATURE REQUEST] CatalogAdmin should be able to list principal roles

3 participants