Skip to content

[#11968] test(iceberg): cover role narrowing in Iceberg credential vending - #12461

Merged
roryqi merged 1 commit into
apache:mainfrom
bharos:active-roles-vending-11968
Aug 14, 2026
Merged

[#11968] test(iceberg): cover role narrowing in Iceberg credential vending#12461
roryqi merged 1 commit into
apache:mainfrom
bharos:active-roles-vending-11968

Conversation

@bharos

@bharos bharos commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Covers role narrowing in the Iceberg REST credential vending path, which had no integration test.

IcebergAuthorizationIT can now register a second Spark catalog that sends X-Gravitino-Active-Roles, so the same caller can be exercised with and without narrowing. The per-catalog configuration moved into a helper; the new catalog is opt-in through narrowedCatalogActiveRoles(), mirroring the existing supportsCredentialVending() hook, so the other subclasses are unaffected.

The test asserts the WRITE to READ downgrade: the write succeeds through the default catalog and is refused by the storage layer through the narrowed one, while the read still succeeds. It lives on IcebergRESTCloudTokenAuthorizationBaseIT, so every cloud subclass inherits it; MinIO runs it in CI.

The narrowed role carries USE_CATALOG and USE_SCHEMA itself, because narrowing deactivates the USE_SCHEMA role that @BeforeEach grants under a random name.

Why are the changes needed?

RoleAssumptionAuthorizationIT covers the header grammar and listCatalogs filtering, but nothing covered credential vending, so the privilege-to-credential mapping under narrowing had no protection against regressions.

Fix: #11968

Does this PR introduce any user-facing change?

No. Test only.

How was this patch tested?

MinIO, in both modes:

./gradlew :iceberg:iceberg-rest-server:test --tests "*IcebergRESTMinIOTokenAuthorizationIT*" \
  -PskipTests -PtestMode=deploy -PskipDockerTests=false
Test Result
MinIO deploy 4 pass
MinIO embedded 4 pass
IcebergTableAuthorizationIT deploy 16 pass

The sibling run checks that the shared base class change did not regress the other Iceberg authorization ITs.

The test is self-controlling: the same user, table and Spark session write successfully through the default catalog and fail through the narrowed one, and the narrowed catalog still reads, so the only difference is the header.

@bharos
bharos force-pushed the active-roles-vending-11968 branch from 765ced3 to 6120aae Compare August 13, 2026 19:15
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 68.66% 🟢
Files changed No Java source files changed -

Module Coverage
aliyun 1.72% 🔴
api 49.31% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 9.92% 🔴
catalog-fileset 79.77% 🟢
catalog-glue 68.95% 🟢
catalog-hive 79.4% 🟢
catalog-jdbc-common 45.7% 🟢
catalog-jdbc-doris 81.8% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 84.23% 🟢
catalog-model 77.72% 🟢
cli 44.48% 🟢
client-java 78.46% 🟢
common 52.75% 🟢
core 83.63% 🟢
filesystem-hadoop3 77.28% 🟢
flink 0.0% 🔴
flink-common 48.68% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 12.7% 🔴
hive-metastore-common 53.4% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 64.75% 🟢
iceberg-rest-server 75.03% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 31.75% 🔴
lance-rest-server 63.47% 🟢
lineage 53.02% 🟢
optimizer 83.24% 🟢
optimizer-api 21.95% 🔴
server 87.25% 🟢
server-common 79.41% 🟢
spark 28.57% 🔴
spark-common 45.89% 🟢
tencent 69.84% 🟢
trino-connector 40.29% 🟢

@bharos bharos self-assigned this Aug 13, 2026
…ial vending

The Iceberg REST credential vending path had no coverage for
X-Gravitino-Active-Roles. Register a second Spark catalog that sends the
header so the same caller can be exercised with and without narrowing,
and assert the WRITE to READ downgrade: the write succeeds through the
default catalog and is refused by the storage layer through the narrowed
one, while the read still succeeds.

The narrowed role carries USE_CATALOG and USE_SCHEMA itself, because
narrowing deactivates the USE_SCHEMA role granted per test.
@bharos
bharos force-pushed the active-roles-vending-11968 branch from 6120aae to 31f868e Compare August 13, 2026 20:37
@bharos
bharos requested a review from roryqi August 13, 2026 20:37

@roryqi roryqi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@roryqi
roryqi merged commit dde8546 into apache:main Aug 14, 2026
41 of 42 checks passed
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.

[Subtask] Apply role narrowing to list filtering + credential vending, with ITs & docs

2 participants