Changelog - 2026-11-11
A validated upload is pinned, and commit takes the token validate returns
Breaking SecurityIn one line. A file could be overwritten between your validation and the commit copy. Validation now pins the content it read, and commit copies only that content.
What changed
- Validate answers a token. A valid file gets
{ isValid: true, issues: [], commitToken }. The token is bound to the exact content the handler read and keeps the expiry of the token you sent. An invalid file gets no token. - Commit takes that token. With
validationon, commit with the policy's token is refused422core.static_asset.upload_not_validated. Commit no longer runs the handler. - A pinned file. The handler takes
{ file, owner }.filehaskey,sizeandstream({ range? }), and every read is for the pinned content. - The pin. The exact version id when the bucket has real versions, else the ETag. A read or the commit copy that finds other content, or no object, fails
409core.static_asset.upload_changed, and nothing is copied. No extra object is created. - Helpers.
getObjectStreamtakesifMatchandversionId.copyObjecttakesifMatchandsourceVersionId.BunS3Helper.getStatreportsversionId. A failed condition throwscore.storage.precondition_failed(412).copyObjectof a missing source throwscore.storage.object_not_found(404).DiskHelperrefuses a conditional read. - New errors.
core.static_asset.upload_changed(409),core.static_asset.upload_not_validated(422),core.storage.precondition_failed(412). - Removed error.
core.static_asset.upload_invalidis gone. Commit no longer runs the handler, so nothing raises it. An invalid file answers200{ isValid: false, issues }onupload-validate. - Who commits. The direct upload page now lists the four combinations of
validationandroutes.uploadCommit, with the token commit takes in each.
Who is affected
- Apps with a
validation.handler. Change the handler arguments. Compilation fails until you do. - Clients of
upload-commitwithvalidationon. Send thecommitTokenfrom the validate answer. Until then commit answers422. - Tokens issued before the upgrade. They lack the new fields and answer
400invalid_commit_token. Users upload again. - Apps that use validation as a malware gate. Enable bucket versioning, and add a lifecycle rule that expires noncurrent versions and delete markers under the pending prefix. Without versioning the pin is the ETag, an MD5 for a plain upload.
- Everyone else. With
validationoff nothing changes: commit takes the policy's token.
Breaking changes
WARNING
The handler no longer receives helper, bucket or object, upload-commit no longer accepts the policy's token when validation is on, and the error code core.static_asset.upload_invalid is removed. A client that branched on it now branches on upload_not_validated (commit with the wrong token) or on isValid: false from upload-validate.
Before:
handler: async ({ bucket, object, owner, helper }) => {
const fileStream = await helper.getObject({ bucket, object });
const issues = await checkWorkbook({ fileStream, owner });
return { isValid: issues.length === 0, issues };
},After:
handler: async ({ file, owner }) => {
const stream = await file.stream();
const issues = await checkWorkbook({ stream, owner });
return { isValid: issues.length === 0, issues };
},file.stream() returns a web ReadableStream. In the browser or your service, take commitToken from the validate answer and send it to upload-commit.
See Direct upload, the pin and the migration notes.