You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "danhuawang (via GitHub)" <gi...@apache.org> on 2026/08/19 10:07:18 UTC

[PR] [#12515] fix(auth): allow unauthenticated access to /api/version endpoint [gravitino]

danhuawang opened a new pull request, #12523:
URL: https://github.com/apache/gravitino/pull/12523

   ### What changes were proposed in this pull request?
   
   Add `/api/version` to the public bypass list in `HealthCheckPathMatcher` so that `AuthenticationFilter` skips authentication for `GET /api/version` requests.
   
   - Extend `HealthCheckPathMatcher.isHealthCheckPath()` to also match `/api/version`
   - Update Javadoc to reflect the broader scope (public endpoints, not just health checks)
   - Move `/api/version` from the non-exempt path list to the public bypass list in `TestAuthenticationFilter` and add it to the bypass assertion loop
   
   ### Why are the changes needed?
   
   The `/api/version` endpoint is read-only and exposes no sensitive data. Requiring authentication creates unnecessary friction for:
   
   - Operators checking server version during deployment or upgrades (e.g. Helm pre-upgrade hooks)
   - Health monitoring tools and scripts that do not need full credentials
   - Client compatibility checks before establishing an authenticated session
   - Deployment automation that needs to detect the running version without knowing the auth mode (basic, OAuth, etc.)
   
   The `/api/health` endpoint already bypasses authentication via `HealthCheckPathMatcher`. This change applies the same established pattern consistently to `/api/version`.
   
   Fix: #12515
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `GET /api/version` no longer requires an `Authorization` header. Unauthenticated clients will receive the version response instead of a `401 UnauthorizedException`.
   
   ### How was this patch tested?
   
   - Updated `TestAuthenticationFilter.testDoFilterBypassesAuthenticationForHealthEndpoints` to include `/api/version` in the public bypass assertion loop.
   - Updated `TestAuthenticationFilter.testDoFilterDoesNotBypassAuthenticationForNonHealthPaths` to remove `/api/version` from the non-exempt list (it is now public).
   - Run: `./gradlew :server-common:test -PskipITs`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12515] fix(auth): allow unauthenticated access to /api/version endpoint [gravitino]

Posted by "jerryshao (via GitHub) via commits" <co...@gravitino.apache.org>.
jerryshao closed pull request #12523: [#12515] fix(auth): allow unauthenticated access to /api/version endpoint
URL: https://github.com/apache/gravitino/pull/12523


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12515] fix(auth): allow unauthenticated access to /api/version endpoint [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on code in PR #12523:
URL: https://github.com/apache/gravitino/pull/12523#discussion_r3841049749


##########
server-common/src/main/java/org/apache/gravitino/server/web/HealthCheckPathMatcher.java:
##########
@@ -56,6 +65,7 @@ public boolean isHealthCheckPath(String path) {
         || path.startsWith("/health/")
         || path.equals("/health.html")
         || path.equals("/api/health")
-        || path.startsWith("/api/health/");
+        || path.startsWith("/api/health/")
+        || path.equals("/api/version");

Review Comment:
   @danhuawang `/ap/version` doesn't belong to this class `HealthCheck...`. You should figure out a different way to put this API into the authorization exclusion filter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12515] fix(auth): allow unauthenticated access to /api/version endpoint [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12523:
URL: https://github.com/apache/gravitino/pull/12523#issuecomment-5345514688

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|68.76% **`+0.34%`**|:green_circle:|
   |:-|:-|:-:|
   |Files changed|83.31%|:green_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|49.18%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|42.04%|:green_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|9.92%|:red_circle:|
   |catalog-fileset|79.77%|:green_circle:|
   |catalog-glue|68.95%|:green_circle:|
   |catalog-hive|82.96%|:green_circle:|
   |catalog-jdbc-common|45.7%|:green_circle:|
   |catalog-jdbc-doris|81.8%|:green_circle:|
   |catalog-jdbc-mysql|79.33%|:green_circle:|
   |catalog-jdbc-postgresql|83.39%|:green_circle:|
   |catalog-jdbc-starrocks|79.16%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|59.18%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.86%|:green_circle:|
   |catalog-lakehouse-paimon|84.23%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.48%|:green_circle:|
   |client-java|78.57%|:green_circle:|
   |common|52.39%|:green_circle:|
   |core|83.53% **`-0.02%`**|:green_circle:|
   |filesystem-hadoop3|77.28%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|48.68%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-auth|68.0%|:green_circle:|
   |hadoop-common|12.7%|:red_circle:|
   |hive-metastore-common|53.4%|:green_circle:|
   |iceberg-aliyun-bundle|0.0%|:red_circle:|
   |iceberg-common|64.75%|:green_circle:|
   |iceberg-rest-server|75.0%|:green_circle:|
   |idp-basic|85.98%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|62.92%|:green_circle:|
   |lance-common|31.63%|:red_circle:|
   |lance-rest-server|63.47%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|83.24%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|87.57%|:green_circle:|
   |server-common|79.58% **`+0.06%`**|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|45.89%|:green_circle:|
   |tencent|69.84%|:green_circle:|
   |trino-connector|41.56%|:green_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |core|[MetalakeMetaSQLProviderFactory.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/MetalakeMetaSQLProviderFactory.java)|100.0%|:green_circle:|
   ||[MetalakeMetaBaseSQLProvider.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/MetalakeMetaBaseSQLProvider.java)|100.0%|:green_circle:|
   ||[CatalogMetaService.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/service/CatalogMetaService.java)|98.65%|:green_circle:|
   ||[MetalakeMetaService.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/service/MetalakeMetaService.java)|98.65%|:green_circle:|
   ||[POConverters.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/utils/POConverters.java)|88.33%|:green_circle:|
   ||[CatalogMetaSQLProviderFactory.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/CatalogMetaSQLProviderFactory.java)|85.71%|:green_circle:|
   ||[CatalogMetaBaseSQLProvider.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/CatalogMetaBaseSQLProvider.java)|83.33%|:green_circle:|
   ||[CatalogMetaPostgreSQLProvider.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/CatalogMetaPostgreSQLProvider.java)|83.33%|:green_circle:|
   ||[MetalakeMetaPostgreSQLProvider.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/MetalakeMetaPostgreSQLProvider.java)|80.0%|:green_circle:|
   ||[SchemaMetaPostgreSQLProvider.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/SchemaMetaPostgreSQLProvider.java)|75.0%|:green_circle:|
   ||[SchemaMetaSQLProviderFactory.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SchemaMetaSQLProviderFactory.java)|72.73%|:green_circle:|
   ||[CatalogManager.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java)|70.43%|:green_circle:|
   ||[SchemaMetaBaseSQLProvider.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/SchemaMetaBaseSQLProvider.java)|65.22%|:green_circle:|
   ||[CatalogMetaMapper.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/CatalogMetaMapper.java)|0.0%|:red_circle:|
   ||[MetalakeMetaMapper.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/MetalakeMetaMapper.java)|0.0%|:red_circle:|
   ||[SchemaMetaMapper.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/core/src/main/java/org/apache/gravitino/storage/relational/mapper/SchemaMetaMapper.java)|0.0%|:red_circle:|
   |server-common|[HealthCheckPathMatcher.java](https://github.com/danhuawang/gravitino/blob/138d092029c4795dbb4cd764104b67e20749b136/server-common/src/main/java/org/apache/gravitino/server/web/HealthCheckPathMatcher.java)|100.0%|:green_circle:|
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12515] fix(auth): allow unauthenticated access to /api/version endpoint [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #12523:
URL: https://github.com/apache/gravitino/pull/12523#discussion_r3819152804


##########
server-common/src/main/java/org/apache/gravitino/server/web/HealthCheckPathMatcher.java:
##########
@@ -56,6 +65,7 @@ public boolean isHealthCheckPath(String path) {
         || path.startsWith("/health/")
         || path.equals("/health.html")
         || path.equals("/api/health")
-        || path.startsWith("/api/health/");
+        || path.startsWith("/api/health/")
+        || path.equals("/api/version");

Review Comment:
   It's not so proper to add `/api/version` into the method `isHealthCheckPath` though it works.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12515] fix(auth): allow unauthenticated access to /api/version endpoint [gravitino]

Posted by "jerryshao (via GitHub) via commits" <co...@gravitino.apache.org>.
jerryshao commented on PR #12523:
URL: https://github.com/apache/gravitino/pull/12523#issuecomment-6678921146

   Closing, see the discussion on #12515. We decided not to expose `/api/version` without authentication, because it would reveal the exact server version to unauthenticated callers. Thanks for the contribution, @danhuawang.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org