Design presigned object URLs: delegate narrow, short-lived access
A presigned object URL delegates a limited operation on a specific object for a limited time without giving the recipient storage credentials. Anyone holding the URL can perform the signed action without logging in, so treat the URL like a bearer credential. Authenticate and authorize the user in your application, then issue a URL scoped to the object, HTTP operation, and expiry, and prevent it from leaking.
A presigned object URL delegates a limited operation on a specific object for a limited time without giving the recipient storage credentials. Anyone holding the URL can perform the signed action without logging in, so treat the URL like a bearer credential. Authenticate and authorize the user in your application, then issue a URL scoped to the object, HTTP operation, and expiry, and prevent it from leaking.
Request flow: the app handles permission, storage handles bytes
A common download flow is: the user signs in to the application and requests an object; the application checks the user’s rights and ownership; then it returns a storage GET URL. The browser reads the object directly from storage. For uploads, the app checks the user and upload policy, issues a PUT URL for a specific object key, and the client sends the file bytes directly to storage.
This avoids relaying every file byte through the application. However, issuing a signed URL does not mean the file is approved or the upload is complete. After a completion event or status check, have the server verify the object key, size, checksum, and actual format. Keep files requiring inspection in quarantine until checks pass.
Narrow the delegated permission
Before signing, the server checks the signed-in user, tenant, object relationship, and business rules for the operation. Do not sign an arbitrary object key or operation supplied by the client; restrict it to a server-approved target and action.
**Target:** Allow one object key where possible. For uploads, generate a new server-side key instead of using a client path directly.
**Operation:** Sign only the needed HTTP method, such as read-only `GET` for downloads or `PUT` for uploads. Supported methods and constraints vary by storage provider; confirm the actual SDK and policy contract.
**Lifetime:** Choose a short expiry that allows expected transfer time and retries. Maximum validity depends on the provider and signing credentials. For example, an AWS S3 URL can become invalid at the configured expiry or earlier when its underlying temporary credentials expire or are revoked; Google Cloud Storage documents a seven-day maximum for V4 signed URLs. Do not generalize these as a universal limit.
**Request conditions:** Where supported, signed headers, content type, checksum, network conditions, or storage policies can narrow the request further. The client must send headers that match the signature; follow provider-specific documentation for exact constraints.
**Reuse and overwrite:** Determine whether the same URL can be reused before it expires. AWS S3 documents that uploading again to the same object key replaces the existing object. Do not assume one-time use; consider temporary upload keys, conditional creation, or promoting the object to its final key only after verification.
Treat URL exposure as credential exposure
The signature is often in the URL query string. Keep the full URL out of browser history, proxy and web-server logs, analytics, error reports, copied chat, Referer headers, and screenshots. Deliver it only over HTTPS; redact it from issuance API responses and client logs. Prefer short-lived, narrowly scoped URLs, and define a response plan to revoke the relevant object access, signing key, or policy if a URL leaks. Check provider-specific behavior, including whether a transfer that began before expiry may continue afterward.
A signed URL generally carries the result of the user authorization performed when it was issued. The object store does not authenticate the URL holder as the same application user. Check user permissions on every issuance, and design response caching and browser CORS separately. CORS controls browser cross-origin access; it does not expand or replace the permission in the signature.
Upload and download operations
Authenticate the user at the issuance endpoint and check object-level business permission.
Select the object key on the server and sign only the required method, headers, and expiry.
Return the URL with the required method, required headers, and expiration guidance. Do not let the client modify signed headers.
After upload, have the server inspect storage metadata or an event and verify expected size, checksum, format, and ownership.
Keep the object out of public download paths until validation passes. Remove temporary objects and sessions for failed, cancelled, or expired uploads.
Log a non-secret object ID, issuer, operation, and expiry policy instead of the complete signed URL, and monitor unusual use.
Before issuing a URL
Does the server check the user’s permission instead of signing a client-chosen object key?
Is the URL valid for only one object and the necessary operation, with a short expiry?
Have you confirmed how underlying credential expiry/revocation works and the provider’s maximum lifetime?
Can the URL be reused, and can another upload to the same key replace an existing object?
Are query strings kept out of logs, analytics, browser history, and `Referer` data?
Are uploaded objects validated, quarantined, and promoted after completion, with failed temporary objects removed?
Are browser CORS and caching configured separately from signature permissions?
Sources
[AWS S3: Downloading and uploading objects with presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html)
[Google Cloud Storage: Signed URLs](https://docs.cloud.google.com/storage/docs/access-control/signed-urls)
[Azure Storage: Shared access signature (SAS) overview](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview)