You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "vigneshio (via GitHub)" <gi...@apache.org> on 2026/06/24 13:08:06 UTC
[PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
vigneshio opened a new pull request, #4884:
URL: https://github.com/apache/polaris/pull/4884
## Summary
Tightens the CEL expressions used for GCS credential downscoping in `GcpCredentialsStorageIntegration`.
When a table or namespace location does not end with `/` (e.g. `gs://bucket/db/table`), the previous `startsWith` rules could match sibling prefixes such as `db/table2` or `db/table-secret/...`.
The fix updates both the resource name condition and the list prefix condition:
- Paths that end with `/` or are empty keep the existing `startsWith` behaviour.
- Bare paths now use `startsWith('<path>/') || resource.name == '<path>'` (and the symmetric form for the `objectListPrefix` attribute).
### Changes
- Updated `resourceNameStartsWithExpression(...)` and `objectListPrefixStartsWithExpression(...)`
- Added explicit regression test `testGenerateAccessBoundaryPreventsSiblingPrefixBypass`
- Updated affected test golden files and string assertions
- Added entry to `CHANGELOG.md`
This is a security hardening change for subscoped storage credentials.
## Checklist
- [x] Don't disclose security issues! (contact security@apache.org)
- [x] Clearly explained why the changes are needed
- [x] Added/updated tests with good coverage
- [x] Updated `CHANGELOG.md`
- [ ] Updated documentation in `site/content/in-dev/unreleased` (not needed for this internal fix)
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3467822933
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
I believe it is NOT possible. If you could confirm that, I'd think a preferable fix would be a precondition checks (throwing an exception on bad data). WDYT?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3475569602
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
Thanks for the analysis, @vigneshio !
I also ran this through Codex, which confirmed that call paths without a trailing slash are possible.
TIL 😅 I was pretty sure trailing slashes were enforced on all user-visible call paths.
With that in mind, I think it is certainly worth fixing in this class.
However, rather than trying to accommodate paths without a trailing slash, I think we should add it here if it is missing.
All locations use for credential vending are supposed to be "directories", AFAIK.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "vigneshio (via GitHub)" <gi...@apache.org>.
vigneshio commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3483269125
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
@dimas-b thanks for the simpler approach... 💯 I have switched the PR to use that. & Paths are now normalized using StorageLocation.ensureTrailingSlash(...) in generateAccessBoundaryRules, and the CEL helpers are back to using plain startsWith. I also added tests for trailing slash normalization and sibling prefix protection.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b merged PR #4884:
URL: https://github.com/apache/polaris/pull/4884
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3467822933
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
I believe it is NOT possible. If you could confirm that, I'd think a preferable fix would be a precondition check (throwing an exception on bad data). WDYT?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "vigneshio (via GitHub)" <gi...@apache.org>.
vigneshio commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3474049266
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
Thanks for the review and for raising this... @dimas-b
I looked into whether `path` can arrive without a trailing slash at runtime. It turns out it can - and in practice often does.
- `TableMetadata.location()` is stripped of trailing slashes by Iceberg (`LocationUtil.stripTrailingSlash`).
- `StorageUri.rawPath()` preserves the input string exactly as provided.
- The locations passed to `generateAccessBoundaryRules()` come from `StorageUtil.getLocationsUsedByTable()` (which uses `tableMetadata.location()` and the raw `write.data.path` / `write.metadata.path` properties) via `StorageAccessConfigProvider`.
- Our existing tests already use bare paths (e.g. `gs://bucket1/path/to/data`), and the new regression test also uses `gs://bkt/db/table`.
So it looks like in my view we need to handle both cases (with and without trailing slash). A precondition check would reject valid table locations that are common in practice.
Would you be okay with the current approach... Or do you see a better way to handle this? WDYT?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3475605578
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
For ref: S3 locations are treated as "directories". Cf. https://github.com/apache/polaris/blob/005e889983d71a51402944bb1c75d5baa549391f/polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java#L342
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix GCS downscoped credential prefix boundary for locations without trailing slash [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4884:
URL: https://github.com/apache/polaris/pull/4884#discussion_r3467812557
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/gcp/GcpCredentialsStorageIntegration.java:
##########
@@ -390,16 +390,29 @@ public static CredentialAccessBoundary generateAccessBoundaryRules(
@VisibleForTesting
static String resourceNameStartsWithExpression(String bucket, String path) {
+ if (path.isEmpty() || path.endsWith("/")) {
Review Comment:
Is it possible in runtime for `path` NOT to end with `/`?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org