Changelog - 2026-09-08
Storage hardening and Bun S3
Security Bug Fix Breaking New Feature Enhancement Behavior Change Behaviour Change DeprecatedIn one line. An uploaded evil.html is no longer served back as text/html on your own origin, and the storage surface gets safer, more consistent names and byte-range support.
What changed
- Safe content type (Security). The served content type now comes from the object NAME, through an allow-list of types safe to render. Anything else is served as
application/octet-streamwithContent-Disposition: attachment.image/svg+xmlis excluded, because an SVG carries script. This also fixes the three backends serving the same object three ways (minio served the uploader's claimed type; bun-s3 and disk always servedapplication/octet-stream). WHITELIST_HEADERSdropscontent-type(Behavior Change). The served type is never taken from the backend any more. Onbun-s3anddisknothing that worked changes. Onminiothis closes the hole where the uploader's claimed type was served back.resolveServedContentTypeis exported (Enhancement) from@venizia/ignis/static-asset, next toWHITELIST_HEADERS. Serving objects from your own controller? It returns{ contentType, isRenderable };isRenderableisfalsewhen the type is served as an attachment, which is also when you wantContent-Disposition.BunS3Helper.getStat(Behavior Change).metadatacarried the same string undercontentTypeandmimetype. Onlymimetyperemains. If you persist that object, rows written after the upgrade have one fewer key. Readmimetype, and backfill if a consumer readscontentType.- A missing object answers 404 (Behaviour Change). It was
400 core.system_errorondiskand500 core.system_erroronbun-s3andminio. Storage helpers now throw a cataloguedcore.storage.object_not_foundcarrying 404, so GET, DOWNLOAD and RECREATE_METALINK answer 404 with a code a client can branch on. Other failures still answer 500.DELETEof a missing object still answers 200 on every backend (diskused to answer 400). - Byte ranges (New Feature). The object route honours a
Rangeheader and answers206withContent-Range. Every response advertisesAccept-Ranges: bytes, so a video is seekable. On S3 the range becomes a ranged GET.bytes=-500means the LAST 500 bytes. An unusable range serves the whole object with 200. BunS3Helperprovider options (New Feature).publicEndpointsigns URLs against a name a browser can reach (the host is inside every signature).virtualHostedStylesupports AWS virtual-hosted buckets, while MinIO and R2 take path style.partSize,queueSizeandretryexpose Bun's multipart tuning.listObjectspagination (Bug Fix). It followed no continuation token, so a bucket over 1000 keys was silently truncated. It now follows it.useRecursive: falseis honoured onbun-s3(mapped to a delimiter, matchingdisk), andmaxKeys: 0means zero, not unlimited.- Disk path containment (Security).
DiskHelper.getObject,getStatandremoveObjectjoined the name onto the bucket path unvalidated, so../secret.txtread and deleted outside the bucket. Both the name and the resolved path are now checked. - Bounded concurrency (Behaviour Change).
uploadandremoveObjectsrun at most 16 at a time instead of an unboundedPromise.all, anddiskandbun-s3now agree on failure handling.RedisHelper.publishis capped at 32. - New methods (New Feature).
getObjectStream({ bucket, name, range? }),writeStream({ bucket, name, source, contentType? })(upload without holding the object in memory),presignPut,presignGet(takesresponseContentDisposition),getObjectTagsandreplaceObjectTags. MemoryStorageHelper(Behaviour Change). It is an in-process keyed container, not anIStorageHelper, and is now built on aMapwithunsetandsizeadded.getContainer()returns a copy instead of the live object.get()returnsT[K] | undefined, so a caller that checkedisBoundfirst must read the value once and check it.assert*andhas*prefixes (Enhancement).assert*throws and returnsvoid;has*is the ownership question;is*still returns a boolean.
Who is affected
- Applications relying on HTML or SVG from the asset routes. Serve it from a separate domain instead.
- Anyone using the storage helpers directly. See the breaking changes below. TypeScript catches the method and option changes.
- Anyone calling the old route paths. These do not fail at compile time; the client gets a 404 at runtime.
- Serving through
AssetControllerFactoryorStaticAssetComponent. Nothing to do for the content type change.
Breaking changes
WARNING
Every storage caller is touched: validators, upload results, method names and two route paths.
Validators take options objects.
// before
helper.isValidName(name);
helper.isValidPath(objectName, { maxDepth: 3 });
helper.getMimeType(fileName);
// after
helper.isValidName({ name });
helper.isValidPath({ path: objectName, maxDepth: 3 });
helper.getMimeType({ filename: fileName });The upload result is scoped. It also carries size and contentType, so no second getStat call is needed.
// before
{ bucketName: 'images', objectName: 'photo.png', link: '/assets/...', metaLinkError: 'FAILED' }
// after
{
bucket: { name: 'images' },
object: { key: 'photo.png', size: 4823, contentType: 'image/png' },
link: '/assets/...',
metaLink: { error: 'META_LINK_CREATE_FAILED' }, // or { data: row }
}Five methods renamed. Only the names changed; getObject still returns Promise<Readable> and getObjectStream still returns Promise<ReadableStream>.
| Before | After |
|---|---|
isBucketExists | hasBucket |
getFile | getObject |
getFileStream | getObjectStream |
getFileType | getMediaType |
setObjectTags | replaceObjectTags (it replaces the WHOLE tag set, so flipping one tag used to drop the rest) |
Two route paths changed.
| Before | After |
|---|---|
POST {base}/upload | POST {base}/objects |
GET {base}/download/{objectName} | GET {base}/downloads/{objectName} |
A static route your application registers itself, such as /download/i18n, is unaffected.
Deprecated
@venizia/ignis-helpers/minio, MinioHelper, the minio optional peer dependency and StaticAssetStorageTypes.MINIO still ship but are deprecated, and go away in a later release. Nothing to do today. MinioHelper does not implement presigned URLs or object tagging (those methods throw), and a missing object throws the same catalogued 404. Move to BunS3Helper, which takes any endpoint:
new BunS3Helper({
accessKey: process.env.S3_ACCESS_KEY,
secretKey: process.env.S3_SECRET_KEY,
endpoint: 'http://minio:9000',
publicEndpoint: 'https://cdn.example.com',
});