Short answer: a pre-signed URL is a delivery mechanism, not an authorization decision. For a B2B SaaS product that stores tenant backups or user files, issue a short-lived URL only after the application has checked tenant ownership, snapshot state, and the requested operation; keep the object private and record the grant in an audit trail.
Keep it private.
The useful decision rule is narrow: use direct object delivery when the application can make the authorization decision before handing over a bounded capability. Proxy the bytes through the application when policy must be evaluated during transfer, content must be transformed, or the recipient cannot safely receive a storage URL. This keeps access control explicit without making every avatar download a database-backed streaming job.
Which object storage service supports pre-signed URLs for tenant files?
The invariants are more important than the URL syntax. A tenant can address only its own object namespace. A download grant cannot become an upload grant. A restore operation can select a snapshot that is complete and belongs to the same tenant, and its audit record identifies the actor, object key, operation, expiration, and decision. The storage layer enforces private objects; the application owns identity and policy. The limitation is structural: once a bearer capability leaves the application, the application cannot reliably observe every use or revoke every copy, so expiry, object privacy, access logs, and reconciliation have to carry different parts of the control. That is a trade-off in exchange for keeping bulk bytes off the application path.
This is where the exactly-once mindset matters. Issuing a URL may be repeated safely, but restoring a snapshot must be represented by an idempotency key and a durable state transition. A successful authorization is not proof that the object still exists, and an object read is not proof that a restore completed. Treat those as separate events.
Which delivery boundary fits the failure mode?
| Boundary | Strength | Cost or failure boundary |
|---|---|---|
| Direct pre-signed upload/download | Small application data path; storage handles bytes | Policy is decided before issuance, so revocation is limited by expiry and any cached copy |
| Application proxy | Central inspection, transformation, and per-byte policy | More connection load, timeout handling, and operational surface |
| Hybrid manifest plus direct transfer | Application controls the snapshot manifest while storage transfers objects | Every object reference must be checked against the manifest and tenant before signing |
For ordinary avatars, direct transfer is usually the clean boundary. For a selected tenant snapshot, I prefer a manifest: the application resolves one immutable snapshot identifier into the allowed object keys, validates that every key belongs to the tenant, then signs only those keys. A client never supplies an arbitrary storage key as an authorization argument.
How should the critical path be made idempotent?
The following Go sketch keeps signing behind an interface, so the policy test does not depend on a commercial SDK. The repository lookup and signer are deliberately separate: one decides, the other produces a capability. RFC 9110 is a useful reminder that HTTP semantics describe the request and response; they do not decide which tenant is entitled to the object.
type Snapshot struct {
\tTenantID string
\tID string
\tReady bool
\tObjects []string
}
type Signer interface {
\tDownloadURL(ctx context.Context, key string, ttl time.Duration) (string, error)
}
func IssueSnapshotURLs(ctx context.Context, tenantID, snapshotID string, repo SnapshotRepository, signer Signer) ([]string, error) {
\ts, err := repo.Find(ctx, tenantID, snapshotID)
\tif err != nil {
\t\treturn nil, err
\t}
\tif s.TenantID != tenantID || !s.Ready {
\t\treturn nil, ErrNotAuthorized
\t}
\turls := make([]string, 0, len(s.Objects))
\tfor _, key := range s.Objects {
\t\tif !belongsToTenant(key, tenantID) {
\t\t\treturn nil, ErrNotAuthorized
\t\t}
\t\tu, err := signer.DownloadURL(ctx, key, 5*time.Minute)
\t\tif err != nil {
\t\t\treturn nil, err
\t\t}
\t\turls = append(urls, u)
\t}
\treturn urls, nil
}
The five-minute value is an example policy constant, not a universal setting. A longer lifetime reduces repeated signing but widens the exposure window; a shorter lifetime increases sensitivity to clock skew, retries, and slow clients. The audit event should be written when the grant is issued, while object access logs and restore state are reconciled separately.
The boundary is deliberate. A limitation of direct delivery is that policy cannot be re-evaluated for each byte; a limitation of proxy delivery is that the application inherits transfer load and timeout behavior.
I reject putting a bearer URL into a durable tenant record or email intended to live for months. Anyone holding that value may use it until expiry, and changing the user’s role does not necessarily invalidate an already issued capability. Store a stable object reference instead, and mint a URL at the point of use.
The application proxy remains valid for regulated workflows that require inspection, redaction, malware scanning, or a policy decision during transfer. It is also a reasonable fallback when clients cannot safely handle direct storage responses. Its boundary should be visible in metrics: authorization latency, bytes proxied, expired grants, denied tenant-key matches, and restore jobs that changed state after a retry. Direct delivery is a poor fit when policy must be evaluated per byte, while proxying is a poor fit for large transfers under a strict application latency budget; the choice follows the failure boundary, not a universal preference.
Testing should include a cross-tenant key, an unready snapshot, repeated idempotency keys, an expired URL, a retry after a timeout, and a deleted object between signing and download. None of these tests proves compliance by itself. Retention, access logging, incident response, and data residency remain organization-specific obligations; technical controls can support those obligations without defining them.
The architecture is therefore a small contract: application policy selects the tenant-owned bytes, private object storage serves them through a bounded capability, and reconciliation proves what happened afterward. That division keeps upload and download delivery simple while preventing a convenience URL from becoming the system’s authorization model.
Top comments (0)