Skip to content

improve path traversal in the file blob store#435

Open
cportele wants to merge 1 commit into
masterfrom
blob-path
Open

improve path traversal in the file blob store#435
cportele wants to merge 1 commit into
masterfrom
blob-path

Conversation

@cportele

Copy link
Copy Markdown
Contributor

BlobSourceFs resolved a key against the store root without normalizing or checking containment, so a key with .. segments or an absolute path escaped the root — every read/write/delete method (has/content/get/size/lastModified/ walk/put/delete) was affected. This is the root cause behind the traversal reachable through request-derived keys in the 3D-tiles and resources endpoints.

Enforce the invariant in canHandle: the normalized resolved path must start with the normalized root. Every method already gates on canHandle (directly or via has), so a traversal key is now treated as "not handled" — a no-op or not-found — instead of escaping the store.

Also harden BlobCacheImpl.getCachePath, which built a cache path from the blob key and the (source-provided) ETag: reduce the ETag to safe filename characters and reject a cache path that would resolve outside the cache directory.

Adds BlobSourceFsContainmentSpec.

BlobSourceFs resolved a key against the store root without normalizing or
checking containment, so a key with `..` segments or an absolute path escaped
the root — every read/write/delete method (has/content/get/size/lastModified/
walk/put/delete) was affected. This is the root cause behind the traversal
reachable through request-derived keys in the 3D-tiles and resources endpoints.

Enforce the invariant in canHandle: the normalized resolved path must start
with the normalized root. Every method already gates on canHandle (directly or
via has), so a traversal key is now treated as "not handled" — a no-op or
not-found — instead of escaping the store.

Also harden BlobCacheImpl.getCachePath, which built a cache path from the blob
key and the (source-provided) ETag: reduce the ETag to safe filename
characters and reject a cache path that would resolve outside the cache
directory.

Adds BlobSourceFsContainmentSpec.
@cportele cportele requested a review from azahnen as a code owner July 13, 2026 11:02
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.

1 participant