{
  "id": 22428912,
  "title": "Marketplace Object Storage Downloads: How to Generate Pre-Signed URLs for Tenant Files in Node.js",
  "url": "https://urgent.news/2026/11/28/marketplace-object-storage-downloads-how-to-generate-pre-signed-urls",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-28T19:22:32.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/finneganblake3578/marketplace-object-storage-downloads-how-to-generate-pre-signed-urls-for-tenant-files-in-nodejs-aa9"
  },
  "original_language": null,
  "account": "To create signed download URLs for tenant files in Node.js, follow these steps. First, confirm the authenticated principal is associated with a tenant and valid report record. Next, verify the report's state and intended recipient before interacting with object storage. In Node.js, generate pre-signed download URLs by receiving a report ID and principal, deriving the object key from trusted data, and never letting raw browser paths select files. The server should always handle lookup, never trusting browser-provided keys.\n\nUse a data structure like this for reports:\n\n```javascript\ntype Report = {\nid: string;\ntenantId: string;\nobjectKey: string;\nstate: \"ready\" | \"processing\" | \"failed\";\ncontentType: string;\n};\n```\n\nCreate a function to check if a user can download a report:\n\n```javascript\nfunction canDownload(report: Report, tenantId: string): boolean {\nreturn report.tenantId === tenantId && report.state === \"ready\";\n}\n```\n\nRetrieve the report based on the browser-provided ID, not the object key. The object key should be derived from the server-side report record. Prefix the key with the tenant identifier for easier auditing, though the prefix alone doesn't provide security. The final object key might look like \"tenants/t_482/reports/r_901/export.csv\". Keep the tenant identifier in the key prefix to aid in spotting mistakes.\n\nLog the authorization decisions with necessary details like principal, tenant, report ID, object key, outcome, and expiry. Avoid placing signed URLs in standard application logs to prevent leaking through various channels.\n\nTo prevent tenant escape, separate four boundaries: identity (established by API session or token), ownership (decided from server-side data), capability scope (narrow, one object, one read operation, limited interval), and response behavior (minimal disclosure). Always validate tenantId in a route, then perform object lookup in a separate function. This approach makes authorization testing easier and ensures separation from storage infrastructure changes.",
  "summary": "Short answer: authorize the report request before you create a signed object-storage URL, and make the object key tenant-specific. Treat the URL as a short-lived capability, not as proof that the requester may see the report. For a marketplace serving generated reports, the useful decision rule is simple: choose a server-mediated download when every access must be rechecked; choose a signed link…",
  "summary_source": "publisher",
  "key_points": [
    "Confirm authenticated principal is associated with a tenant and valid report record",
    "Generate pre-signed download URLs using report ID and principal in Node.js",
    "Prefix object key with tenant identifier for auditing"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}