Changelog - 2026-11-06
The disk helper checks the real path of a target, and writeStream needs an existing bucket
Security Behavior changeIn one line. DiskHelper kept a path inside the storage root by its text only. It now follows symbolic links and refuses a target that resolves outside the root, and writeStream refuses a bucket that does not exist, as upload does.
What changed
- Real-path containment.
getObject,getObjectStream,getStat,removeObjectandwriteStreamresolve the real path of the target (for a write, of its nearest existing parent) and require it inside the real storage root. A link to a file or a directory outside the root, and a link whose own target is missing, answerInvalid object name. - Buckets. A bucket directory that is a link leading outside the root is not a bucket:
hasBucketanswersfalse,getBucketanswersnull,listObjectsis empty andremoveBucketreports it as missing. writeStreamand the bucket. A missing bucket is refused withBucket does not existand no directory is created. Create the bucket first withcreateBucket.- Check, then use. The check and the open are two steps. A link that is swapped in between them, by something else with write access to the storage root, is not caught: closing that gap needs file descriptors. This change does not claim to close it; keep the storage root writable only by the application.
- Ordinary paths are unchanged. Links that stay inside the root keep working.
Who is affected
- Deployments whose storage root holds links to other disks or folders. Mount the target as the root, or as a bucket directory under it; a link leading outside is refused.
- Callers of
writeStreamthat relied on the bucket being created. CallcreateBucketfirst. - Everyone else. No action needed.
Details
| File | Package |
|---|---|
src/modules/storage/disk/helper.ts | helpers |
src/modules/storage/base.ts | helpers |