A stored file is not a public URL by default. Download access depends on the current actor, case, tenant, asset state, and sometimes a purpose or time window. A signed storage URL can carry a short-lived capability after authorization, but it cannot revoke bytes already downloaded and may outlive an immediate permission change until expiry. A proxy route offers tighter per-request control at the cost of application bandwidth. Either model needs content-disposition and type handling that prevents active content from executing under the application origin. Originals, thumbnails, transcripts, and exports need the same ownership rule.
Private Asset Downloads, Revocation, and Expiry
Working case
Reviewer 29 may read asset 63 while assigned to case 47. The app issues a brief download grant for the accepted image and an equally scoped preview. When reviewer 29 loses case access, new grants are denied. An earlier short grant remains usable only for its bounded lifetime under the selected policy. Reviewer 62 cannot use asset 63’s predictable ID to get either object. When case 47 reaches its retention deadline, a deletion workflow removes raw, preview, and stale staging objects, records completion, and prevents a backup restore from making the file visible again.
Implementation boundary
function mayIssueDownload(actorCases, asset) {
return asset.state === "accepted" && actorCases.has(asset.caseId);
}
console.log(mayIssueDownload(new Set([62]), { caseId: 47, state: "accepted" }));
// Output: falseMap asset IDs to private object keys on the server and check current object-level authorization before proxying or signing. Bind the grant to one object, operation, and short expiry; do not sign arbitrary browser-supplied keys. Use response headers appropriate to the actual detected type, and use attachment disposition for content that should not render in the app origin. Avoid revealing private object names through cache keys or analytics. For revocation, document the maximum grant lifetime and consider proxying higher-risk objects. Maintain an inventory of derivatives and processing outputs so expiry and erasure can remove all related bytes. Test cache behavior under account and tenant switching.
Cost and boundaries
A proxy download uses O(n) application egress for n bytes and keeps the app in the transfer path. Direct signed storage can reduce that load but has a revocation delay bounded by grant lifetime and storage controls. Checking authorization is near O(1) with indexed asset and case relations, while deletion must visit O(k) related objects. Caches can save repeated transfer but become a disclosure risk if keys omit tenant or permission context. Measure denied reads, expired grant use, object leaks after deletion, orphaned derivatives, and download error rates after revocation.
Failure trace
A preview URL uses a public bucket while the original file uses a protected route. Reviewer 62 sees a sensitive thumbnail by guessing asset 63. Give every derivative the same ownership check. Another app serves user-controlled HTML inline on its own origin; a downloaded file executes with application context. Force safe type and disposition policy. Test a removed case assignment, shared browser history, stale service-worker cache, expired signed grant, cross-tenant ID, asset deleted during transfer, and a restored backup that contains an old object key.
Verification
- Originals and derivatives share current object-level authorization.
- Signed grants are scoped and expire within the documented bound.
- Retention cleanup includes staging and all derived objects.
Practice drill
Grant reviewer 29 read access to asset 63 and deny reviewer 62. Produce one original and one preview, then inspect both retrieval routes and cache headers. Revoke reviewer 29’s case assignment and prove new grants fail; record the bounded behavior of an already issued grant. Run retention deletion and enumerate all keys tied to the asset, including staging and derivatives. Restore an older copy of metadata in a test and verify a deletion marker prevents the asset from reappearing.
Decision note
Authorize every retrieval from current case state and make grant expiry and derivative deletion explicit.
Common Mistakes
- Publishing a preview while protecting only the original.
- Using long-lived signed URLs as instant revocation.
- Deleting metadata while leaving object copies behind.
Connected lessons
File Ingestion and Private Asset Lifecycle; Upload Intake Budgets and Storage Ownership; Resumable Transfer Parts and Integrity; File Quarantine, Inspection, and Derived Previews; Object-Level Authorization for Reads and Writes; Retention Inventory and Expiry Workflows; Large Export Download and Integrity.
Apply and check
Build Project: private evidence file lifecycle and review Web Development: file and email delivery decisions quiz.
