Changelog - 2026-11-11
A direct-upload policy signs one object, and a commit token can name its owner
Security New Feature BreakingIn one line. A signed POST policy used to allow any number of uploads under pending/ until it expired; it now allows exactly one key. The commit token can be bound to its owner, and the commit route is now guarded by authorize like the policy route.
What changed
- One policy, one object.
presignPosttakesobject: { key }and signs that key as it stands.formDatacarries thekey, so the client no longer appends it. - The token names its owner. The new optional
directUpload.resolveOwnersupplies the owner on both routes. A token issued to an owner commits only for that owner; any other caller, or none, gets the same invalid-token answer a forged token gets. upload-commitchecksauthorize, before the body is read and before any storage call.falseanswers403withcore.static_asset.upload_not_authorized. The message now reads "Not allowed to upload", since the code answers both routes; the code is unchanged.verify({ token, owner? })onStaticAssetUploadCommitServiceruns the checks a commit starts with (signature, expiry, owner,keyPrefixscope) and returns the pending{ bucket, object }. It makes no storage call, so an app can read an uploaded file and report its problems before anything is committed.commitcalls it itself.directUpload.expiressets two lifetimes:uploadfor the policy (default 15 minutes) andcommitfor the token (default:upload), so users can validate and fix a file for longer than the upload window.
Who is affected
- Apps that post the policy form by hand. Append every
formDatafield and thenfile; do not appendkey, and do not change it. A form with a secondkeyor a different one is refused by storage. - Apps that call
presignPostthemselves. Passobject: { key }in place ofkeyPrefix. - Apps that call the commit service. The parameter is now
token. - Apps that set
directUpload.expiresIn. It is nowdirectUpload.expires.upload. - Apps that mounted
upload-commitwith a different gate thanauthorize.authorizenow runs on both routes; make sure it answers for the commit caller too. - Tokens issued before this release. The token format changed, so an old token no longer verifies. They expire within minutes (the default window is 15), but a client holding one across the upgrade must ask for a new policy.
- Everyone else. No action needed.
Breaking changes
WARNING
Nothing is aliased. Replace each old form with its new one.
| Old | New |
|---|---|
presignPost({ bucket, keyPrefix, maxBytes }) | presignPost({ bucket, object: { key }, maxBytes }) |
form.append('key', policy.objectName) in the client | remove it; policy.formData already has key |
commit({ commitToken, labels }) on the commit service | commit({ token, labels }) |
directUpload: { expiresIn } | directUpload: { expires: { upload } } |
commit token payload { bucket: string, key, expiresAt } | { bucket: IBucketRef, object: IObjectRef, expiresAt, owner? } |
upload-commit ran without authorize | upload-commit calls authorize first |
The HTTP field is still commitToken in the policy response and in the commit body; only the service parameter was renamed.
Before:
typescript
const form = new FormData();
for (const [key, value] of Object.entries(policy.formData)) form.append(key, value);
form.append('key', policy.objectName);
form.append('file', file);After:
typescript
const form = new FormData();
const formFields = Object.entries(policy.formData);
for (const [fieldName, fieldValue] of formFields) {
form.append(fieldName, fieldValue);
}
form.append('file', file);Details
typescript
directUpload: {
authorize: ({ context }) => Boolean(context.get('currentUser')),
resolveOwner: ({ context }) => context.get('currentUser').id,
secretKey,
maxBytes: 100 * 1024 * 1024,
expires: { upload: { unit: 'minute', value: 10 }, commit: { unit: 'hour', value: 6 } },
},See Direct upload for "Validate, then commit" and "Operating it". Put a lifecycle rule on pending/ that is longer than expires.commit.