Files
seaweedfs/weed
Chris LuandClaude Opus 5.5 533f5060b9 filer: scope a prefix JWT to the directory a zip extract writes under (#12305)
* filer: scope a prefix JWT to the directory a zip extract writes under

Without a trailing slash, an extract request writes members beside the
named path, in its parent directory, while the JWT check only saw the
request path. A token scoped to /tenant1 could therefore extract into /
by posting to /tenant1?extract=zip. Add the extract root to the paths a
prefix-restricted token must cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: do not keep an extracted archive under the name ".."

A multipart file name of ".." passes path.Base unchanged, so
extract.keep stored the archive as an entry literally named ".." in the
target directory, a name that local sinks resolve to the parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* leveldb3: keep a non-local bucket name out of the per-bucket folder

findDB splits the bucket out of a /buckets/ path and uses it as a folder
name under the store directory. The name cannot hold a slash and dot
names already go to the default DB, so this only rejects an empty or
non-local name, but it also lets static analysis see the folder cannot
escape the store directory.

* filer: clean the zip extract root before scoping and writing

A percent-encoded dot segment survives the path cleaning in front of the
mux, so a request path ending in "/" reached extractZipRoot with ".."
in it. The JWT scope check cleans the path it compares, but the members
were written under the raw root, so the two could disagree.

* leveldb3: apply the bucket folder check to bucket create and delete events

findDB already keeps dot and non-local bucket names out of the per-bucket
folders, but OnBucketCreation and OnBucketDeletion used the name as is. A
directory event for /buckets/.. opened a DB in the parent of the store
directory, and its delete removed that parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* leveldb3: keep a bucket delete event off the default DB

A bucket named _main maps to the default DB in findDB, so deleting
/buckets/_main closed the default DB and removed its folder, taking every
non-bucket entry with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* leveldb3: keep bucket names with a path separator out of the store dir

A bucket event named x/../_main passed the local-name check, and its
delete removed the default DB folder once store.dir/x existed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* leveldb3: only reject the platform separator in a bucket name

A backslash is an ordinary file name character on Unix, and a bucket
folder named that way already exists for anyone who created one. Rejecting
it on every platform would route those entries to the default DB after an
upgrade. The slash can never appear in a bucket name here, and on Windows
the backslash is the separator, so rejecting os.PathSeparator alongside
the slash keeps the folder flat without changing Unix routing.

* leveldb3: check for an escaped bucket db before its delete event

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 18:36:31 -08:00
..
2026-04-10 17:31:14 -07:00
2026-04-14 20:48:24 -07:00
2026-04-23 10:05:51 -07:00