Tenant isolation is the constraint that changes this storage decision. Short answer: keep user documents in private object storage, keep the tenant-to-object mapping in the application database, and create a short-lived presigned download link only after checking that mapping. For a media SaaS with US and EU tenants, that authorization path matters more than a provider's SDK ergonomics or a headline rate.

The runbook starts with one question: can an operator trace a download from an authenticated tenant to an authorized object key? If the answer depends on a filename, a URL supplied by the browser, or a bucket prefix, stop there. Those are locations, not identity.

How should a SaaS team define the boundary for private files?

An object store can keep bytes private, but it does not know that document 418 belongs to tenant A unless the application supplies that relationship. The dangerous handler accepts tenantID and documentID, joins values into a path, and signs the result. Swap one input and it may authorize another tenant's file. A successful storage response then proves only that the signature was valid.

The failure path is easy to miss in review because every individual line looks reasonable. The request carries a document ID, the repository returns an object key, and the signer returns a URL. The missing comparison sits between the second and third steps. A safer trace starts with the authenticated principal, loads the document by its stable ID, compares the row's tenant to that principal, checks that the document is in an issuable state, and only then passes the stored key to the signing adapter. If the lookup returns no row, or the tenant comparison fails, the handler should stop before it asks storage for anything. The browser must not be allowed to choose the key, and the signer must not be asked to rediscover ownership from a path. This is also why a bucket policy cannot carry the whole design: it can enforce private reads, but it does not know the application's tenant relationship. Make that sequence visible in tests and in the runbook. An incident responder should be able to identify which decision was made without reconstructing it from access logs.

Make the database row the authority. A useful row contains the authenticated tenant_id, an application-facing document_id, an opaque server-generated object_key, the permitted region, a lifecycle state, and validation metadata such as size and content type. The key should not contain an email address, title, or other user-controlled label. Those values leak into logs and support tickets.

There are two checks, with different owners. The application decides who may ask for a link. The storage policy keeps the object private and honors the signed request until its expiry. Keep the first check explicit in code review; a prefix can help inventory and lifecycle jobs, but it is not an authorization policy.

No guessing.

Before comparing storage, write down the governance decision. Treat placement as a data policy, not a latency toggle. Record where each tenant's documents may live, where replicas and backups are kept, where derived media is processed, and which operators may administer it. Do not infer residency from a browser locale or an IP address.

Decision Evidence to keep Failure to prevent
Tenant placement Tenant policy and object region A document copied to the wrong region
Replication Replica inventory and deletion test A deleted file surviving in a second copy
Administration Access review and operator scope An operator reading unrelated tenants
Retention Expiry rule and cleanup evidence Old files, logs, or fragments accumulating

Replication may improve recovery while creating another copy to protect, audit, and delete. The deletion runbook must cover primary objects, replicas, incomplete multipart uploads, backups, logs, thumbnails, and search indexes. I'm not sure a region label can establish compliance by itself; the access review, retention evidence, incident response, and administrative controls still need an owner. NIST SP 800-66 Rev. 2 is a useful implementation reference when protected health information is in scope.

For large media uploads, multipart upload lets a client retry individual parts instead of restarting one large transfer. The documented lifecycle is initiate, upload parts, then complete. Add a cleanup rule for incomplete uploads, or an abandoned browser session can leave fragments behind. This is a storage-lifecycle decision, not a presigned-URL feature.

How can a SaaS API issue presigned download links without crossing tenants?

The signing adapter should receive an already-authorized key. It should never receive a browser-supplied path assembled from a tenant name. The interface below leaves the provider-specific SDK behind a narrow boundary, so the authorization decision stays testable and a provider change does not spread through handlers.

Imagine tenant A and tenant B upload files both named contract.pdf. A filename-based key collides; a tenant taken only from a query parameter is untrusted. The database lookup must compare the authenticated tenant before signing. Don't log the full bearer URL. Five minutes is an example lifetime, not a universal policy: choose a duration that matches the download flow and document sensitivity.

package documents import ( "context" "errors" "time" ) type Document struct { TenantID string ObjectKey string State string } type Store interface { Find(ctx context.Context, documentID string) (Document, error) } type Signer interface { PresignGet(ctx context.Context, objectKey string, lifetime time.Duration) (string, error) } func DownloadURL(ctx context.Context, store Store, signer Signer, tenantID, documentID string) (string, error) { doc, err := store.Find(ctx, documentID) if err != nil { return "", err } if doc.TenantID != tenantID { return "", errors.New("document is not in this tenant") } if doc.State != "available" { return "", errors.New("document is not available") } return signer.PresignGet(ctx, doc.ObjectKey, 5*time.Minute) } 

The same state machine should govern uploads. Create a pending row with a server-generated key, issue an upload destination, validate size, content type, checksum, and tenant ownership, then move the row to available. A client-side completion event is not evidence that the stored bytes meet policy. For highly sensitive documents, stream through an authorization service or record the download before issuing a link; presigning alone is not revocation.

What should the storage test, migration, and release gate prove?

Use two tenants and two documents in an integration environment. Test the application result, not a vendor-specific error string. The release gate should prove that tenant A can receive a link for its own available document, cannot receive a usable link for tenant B's document, and cannot bypass the application check by guessing an object key. Pending, quarantined, and deleted rows must produce no download link, and anonymous direct reads must be rejected by the storage policy.

Add the interrupted cases. Stop an upload between parts and verify that the cleanup rule removes the incomplete upload. Expire a link and verify that a later fetch is not usable. Send a retry of the same upload-completion event and verify that it does not create a second authoritative document row. That last check is an idempotency reflex: duplicate delivery is normal queue behavior, not an exceptional test case.

A denied request should produce no usable URL and an audit event with tenant, document, decision, and request ID. Bearer URLs, raw personal data, and document titles do not belong in logs. Useful alerts include a spike in authorization denials, repeated cross-tenant attempts, unusual link issuance, and growth in incomplete multipart uploads.

Inventory every object before moving it. Record tenant, old key, destination region, state, and checksum; retain the old key beside the new key until an independent count and read test agree. Interrupt a rehearsal, retry it, and compare the database pointer with the bytes actually available.

Keep the cutover reversible. During a bounded dual-read period, the service can consult the old location when the database row says it is authoritative, while new links follow the new adapter. Delete old objects only after the inventory, authorization tests, and backup review pass. A rollback that restores code but cannot locate the previous authorized bytes is not a rollback.

When is this object-storage pattern not suitable?

Private object storage with application-owned authorization is not suitable for permanent public downloads, static website hosting, or a single-tenant deployment where a managed document system already owns the required audit, retention, and sharing workflow. Stick with that simpler system when operating a multi-tenant object boundary would add more risk than it removes.

It is also a poor fit when full-text search, document transformation, or collaborative editing is the primary product feature. Add those services as needed, but keep the original authorization row as the source of truth. The decision is ready when a reviewer can trace one download through tenant identity, the database check, the signed request, expiry, and audit evidence—and explain what happens when any step is denied.

References