Skip to content

Fix GCS downscoped credential prefix boundary for locations without trailing slash#4884

Merged
dimas-b merged 1 commit into
apache:mainfrom
vigneshio:fix/gcs-credential-downscope-prefix-traversal
Jun 26, 2026
Merged

Fix GCS downscoped credential prefix boundary for locations without trailing slash#4884
dimas-b merged 1 commit into
apache:mainfrom
vigneshio:fix/gcs-credential-downscope-prefix-traversal

Conversation

@vigneshio

Copy link
Copy Markdown
Contributor

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

  • Don't disclose security issues! (contact security@apache.org)
  • Clearly explained why the changes are needed
  • Added/updated tests with good coverage
  • Updated CHANGELOG.md
  • Updated documentation in site/content/in-dev/unreleased (not needed for this internal fix)

@vigneshio vigneshio force-pushed the fix/gcs-credential-downscope-prefix-traversal branch from 5cf552b to 72522a1 Compare June 26, 2026 18:04

@dimas-b dimas-b 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.

Thanks, @vigneshio !

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jun 26, 2026
@dimas-b dimas-b merged commit 546f733 into apache:main Jun 26, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jun 26, 2026
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.

2 participants