A browser upload decision changes once a backup can be restored by the wrong tenant. For a developer tool that stores per-tenant snapshots, I would start with a short-lived signed request for ordinary uploads, then add multipart only when object size, unreliable networks, or resumability makes one request a bad bet. The signed request is a narrow capability. Multipart is a transfer protocol and a recovery strategy. They solve different problems.
The rule I use is blunt: isolate the object name and authorization on the server first; choose the transfer shape second. That keeps revenue-per-hour focused on the failure that can hurt the product, instead of turning storage plumbing into a permanent side project.
Should I compare browser direct upload and object storage workflows?
The browser should never decide that acme/snapshot-42.tar belongs to tenant acme. It can ask an application endpoint for an upload operation. The server authenticates the session, resolves the tenant from that session, creates an opaque snapshot identifier, and returns a capability scoped to that one object.
That order matters. A client-provided tenant ID is input, not proof. The object key should be derived from server-owned values, for example tenant/<tenantId>/snapshots/<snapshotId>, with the tenant relationship stored in the database as well. A restore request repeats the authorization check before it creates a download capability. Storage prefixes help operators inspect data; they are not an authorization boundary by themselves.
The key is ownership.
Here is the smallest Node.js shape I would ship first. The storage adapter is deliberately generic. It hides provider-specific signing, while the application owns the policy decision.
type SnapshotUpload = {
snapshotId: string;
objectKey: string;
uploadUrl: string;
expiresAt: string;
};
async function beginSnapshotUpload(
userId: string,
input: { filename: string; sizeBytes: number },
): Promise<SnapshotUpload> {
const tenant = await tenantForUser(userId);
const snapshotId = crypto.randomUUID();
const objectKey = `tenant/${tenant.id}/snapshots/${snapshotId}`;
await snapshots.insert({
id: snapshotId,
tenantId: tenant.id,
objectKey,
originalName: input.filename,
expectedBytes: input.sizeBytes,
status: "pending",
});
const signed = await objectStore.signUpload({
key: objectKey,
expiresInSeconds: 600,
contentLength: input.sizeBytes,
});
return { ...signed, snapshotId, objectKey };
}
The client then uploads to the returned URL. It does not get a general bucket credential, and it does not get to substitute a different key. After the transfer, a server-side completion step checks that the pending snapshot belongs to the caller's tenant and records the object as ready. I would also verify the stored size and checksum when the storage interface exposes those values.
When is a single signed upload the better trade?
For small and medium snapshots, one request is easier to reason about. There is one pending row, one object key, one expiration window, and one completion transition. A failed request can be retried by issuing a new capability. That is a good weekly-shipping boundary for a one-person SaaS.
| Workflow | Main advantage | Isolation concern |
|---|---|---|
| One signed request | Less state to operate | A retry may resend the whole object |
| Multipart session | Failed parts can be retried | Session, parts, and completion need one tenant binding |
The trade-off is restart cost. If a 900 MB archive fails near the end, the browser starts again unless the storage protocol or application adds resume state. The signed URL also has a finite lifetime. Expiration is useful because the capability should not live forever, but it means a paused tab needs a fresh application authorization step.
HTTP semantics define request methods and status behavior, but they do not turn a signed URL into tenant authorization. The application still has to make the identity and object binding decisions.
Why use multipart for a selected snapshot?
Multipart becomes attractive when a single request is too fragile or too large for the path between browser and storage. The browser divides the file, transfers parts independently, and later asks the storage system to assemble them. A lost part can be retried without replaying every successful part. That is operationally useful. It is also more state.
There is now an upload session, a part-number map, expiration cleanup, and a completion race to handle. If the user changes tenant context in another tab, the old upload must remain bound to its original snapshot. If the browser crashes, the application needs a policy for abandoned sessions. I would rather delete incomplete sessions on a schedule than build a clever recovery UI before the product has evidence that it needs one.
The important distinction is this: multipart improves transport recovery; it does not improve tenant isolation automatically. Every part operation must belong to the same server-created upload session, and completion must check the session's tenant before marking the snapshot ready. A part number is not an identity.
A useful state model is small enough to test directly:
type SnapshotStatus = "pending" | "uploading" | "ready" | "expired" | "deleted";
type UploadSession = {
id: string;
tenantId: string;
snapshotId: string;
status: SnapshotStatus;
parts: Map<number, string>;
};
function mayComplete(session: UploadSession, tenantId: string): boolean {
return session.tenantId === tenantId && session.status === "uploading";
}
That predicate is not a complete security system. It is a reminder that completion is a business transition, not just a storage callback.
How should I test the boundary before adding features?
I would test tenant isolation before testing upload speed. Create two tenants, two users, and snapshots with deliberately similar names. Then try to begin, complete, restore, and delete each snapshot with the other tenant's session. The expected result is denial at the application boundary, including after an upload has finished.
Next, test the boring failures: an expired capability, a missing part, a duplicate part number, a completion request replayed after success, a browser refresh, and a worker that dies between storage completion and the database update. The database status should make these transitions explicit. A restore job should read the tenant and object key from the trusted snapshot row, never from a path supplied by the browser. For the cross-tenant case, use two snapshots with the same filename but different server-generated IDs, then attempt the restore using the other tenant's session. The filename should be irrelevant to the authorization result.
Observability should answer three questions without logging signed URLs: which tenant owns the snapshot, which snapshot state changed, and whether the failure happened in authorization, transfer, or finalization. Redact capability query strings. Keep correlation IDs in application logs. Storage access logs can be useful, but they do not replace an application audit trail.
What changes at scale?
At larger object sizes or with a meaningful mobile audience, I would add multipart behind the same application contract. The UI can still ask to begin an upload and receive an opaque session. The server can decide the transfer mode from policy, file size, and client capability. That lets the product keep one tenant-aware workflow while the transport evolves.
I would also separate cleanup from restore. A scheduled job can expire pending sessions and remove their incomplete storage state; a restore worker can validate a ready snapshot, write to a tenant-scoped destination, and emit an audit event. These are different failure domains, so coupling them makes incident diagnosis slower.
The decision is therefore less about signed URLs versus multipart than it first appears. Use the smallest capability that binds one browser action to one tenant-owned snapshot. Add resumable parts when restart cost justifies the extra state. Keep authorization, lifecycle, and audit records in the application you control. That is the part that protects a restore operation.
Sources
- RFC 9110: HTTP Semantics: https://www.rfc-editor.org/rfc/rfc9110
Top comments (0)