Skip to content

Add a flag to allow disabling credential vending for external catalogs#395

Merged
collado-mike merged 4 commits intoapache:mainfrom
collado-mike:mcollado-control-credentialvending-external
Oct 24, 2024
Merged

Add a flag to allow disabling credential vending for external catalogs#395
collado-mike merged 4 commits intoapache:mainfrom
collado-mike:mcollado-control-credentialvending-external

Conversation

@collado-mike
Copy link
Contributor

Description

Some external catalogs do not enforce any kind of directory structure for tables, allowing for table locations to overlap. Some admins may mistakenly believe that vended credentials and table-level RBAC will save them from loose configurations and uncontrolled table locations. Thus, they may be encouraged to grant overly permissive privileges to the role used to generate the session token returned by the loadTable command without realizing that a user in the source catalog could create a table that intentionally overlaps with one or more tables in the catalog. If that user is granted read access to the table in Polaris, the user could take advantage of the generated session token to read tables they didn't have access to.

This PR adds a configuration flag to disable credential vending for all EXTERNAL catalogs with a catalog-level override so that admins can support credential vending, provided they are aware of the security implications.

Right now, the default value for the flag does not change the current default behavior. We should consider changing the default so that users must explicitly allow credential vending for these cases.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • PolarisRestCatalogIntegrationTest

Test Configuration:

  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • If adding new functionality, I have discussed my implementation with the community using the linked GitHub issue

Copy link
Contributor

@eric-maynard eric-maynard Oct 22, 2024

Choose a reason for hiding this comment

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

Since this is a catalog-level property, is there a need to make it specific to external catalogs?

I would prefer just ALLOW_CREDENTIAL_VENDING. Admins could just choose to set this on only external catalogs.

This would also extend nicely if we ever introduce overrides on the namespace or table level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think admins should be allowed to control it for INTERNAL and/or EXTERNAL catalogs independently. For now, this change focuses on EXTERNAL catalogs, but I think a subsequent PR that allows for disabling for INTERNAL catalogs as well would be a good approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Admins could do that by just setting the flag on either INTERNAL or EXTERNAL catalogs, couldn't they? I don't see a reason to make the parameter specific to one type or the other.

Choose a reason for hiding this comment

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

Looks like the current code will support different keys for yaml-level system-wide settings, while using the same catalogConfig for per-catalog overrides, which does seem to achieve both goals.

I would agree that the yaml-level config is the main thing that needs to be configurable separately by whoever is running the Polaris service.

If we can verify that it won't cause any problems to have the same catalogConfig("enable.credential.vending") for both ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING and ALLOW_INTERNAL_CATALOG_CREDENTIAL_VENDING then this seems like the best approach.

Copy link
Member

Choose a reason for hiding this comment

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

I would agree with @eric-maynard and @sfc-gh-dhuo . Ideally I would probably like to be able to set this on a per catalog basis but having blanket coverage is nice too. In the future I would like to have a more flexible way defining policies like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also prefer a catalog property for this at this moment. We could consider policy-based one if there are solid use cases in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current impl allows setting the default value for the service and allowing for catalog-level overrides. This is confirmed in the tests here and here. This allows admins to turn off credential vending by default, but to enable it on a case-by-case basis if they trust the external catalog or if the potential for credential overreach is not a security concern.

Choose a reason for hiding this comment

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

Looks like the current code will support different keys for yaml-level system-wide settings, while using the same catalogConfig for per-catalog overrides, which does seem to achieve both goals.

I would agree that the yaml-level config is the main thing that needs to be configurable separately by whoever is running the Polaris service.

If we can verify that it won't cause any problems to have the same catalogConfig("enable.credential.vending") for both ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING and ALLOW_INTERNAL_CATALOG_CREDENTIAL_VENDING then this seems like the best approach.

Copy link
Member

@RussellSpitzer RussellSpitzer left a comment

Choose a reason for hiding this comment

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

Overall I think this is good to go, I have a few nits on the test that I think we can resolve quickly.

@collado-mike collado-mike force-pushed the mcollado-control-credentialvending-external branch from ae72746 to 3bb4eb7 Compare October 24, 2024 12:37
@collado-mike collado-mike enabled auto-merge (squash) October 24, 2024 12:39
@collado-mike collado-mike merged commit ef111d9 into apache:main Oct 24, 2024
public static final PolarisConfiguration<Boolean> ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING =
PolarisConfiguration.<Boolean>builder()
.key("ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING")
.catalogConfig("enable.credential.vending")
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this name is not specific to external catalogs: enable.credential.vending

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.

5 participants