Hi all,

While adding tests for Azure SAS permissions 
(https://github.com/apache/polaris/pull/6213), I looked at
how the SAS token is scoped and found a few things worth agreeing on.

Behavior today
- With ADLS Gen2 and hierarchical=true, Polaris narrows the user delegation
  SAS to the directory of the requested namespace or table.
- In every other case the SAS covers the whole container: Blob endpoints
  (blob.core.windows.net), and dfs endpoints with hierarchical unset or
  false. For a write grant the token carries add, write and delete on every
  object in the container, not only under the table location.

This is a documented Azure limitation (the Azure configuration page says
per-namespace isolation needs HNS), so I am not reporting a vulnerability.
These are the gaps I see:

1. vended-credentials.md says the Azure SAS is scoped to "the container
   and path prefix", which is not true without HNS. The write consequence
   is not called out anywhere. I have a docs PR for both 
(https://github.com/apache/polaris/pull/6214).
2. Operators get no signal at runtime or at catalog creation that a
   catalog's tokens are container-wide.
3. Docs and code disagree about wasb(s)://. The Azure page says "The
   wasbs:// scheme is not supported" and asks for abfss:// with
   dfs.core.windows.net. But the code accepts it on purpose:
   PolarisStorageConfigurationInfo lists wasb:// and wasbs:// as Azure
   prefixes, AzureLocation parses them, there is a WasbTranslatingFileIO
   (fileIo.type=wasb), and the tests use wasbs://...blob.core.windows.net
   locations. Those Blob-endpoint locations are exactly the ones that can
   never get a narrower token.

Proposal, 
 a) Fix the docs (PR - https://github.com/apache/polaris/pull/6214), and decide 
what the docs should say
    about wasb(s)://. Once we agree on that, I will update the same PR,
    so the Azure page and the vended-credentials page change together.
 b) Log a warning, or add a readiness check, when vending a
    container-wide SAS for a grant narrower than the container.
 c) Add an opt-in feature flag, default off, to refuse vending in that
    case.
 d) Rejecting Blob-endpoint or non-HNS catalogs at creation would be a
    breaking change, so I list it only for completeness.

Questions
- Is wasb(s):// meant to be supported for catalog locations?
    * If yes: I will remove "The wasbs:// scheme is not supported" and
      document that Blob-endpoint locations always get a container-wide
      SAS.
    * If it is only for legacy tables via WasbTranslatingFileIO: I will
      reword it to say so, and we can discuss whether catalog creation
      should reject it.
    * If it is not supported at all: the docs line is right, and we
      should discuss rejecting those prefixes in
      PolarisStorageConfigurationInfo.
- Does anyone run multi-tenant catalogs on non-HNS storage who would be
  affected by (c)?

Thanks,
Akash

Reply via email to