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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to