Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Object Storage Service with Pre-Signed URLs Explained: Node.js Uploads for 3 Tenants

A signed URL is useful only after the application has decided exactly which tenant may write which training artifact, for how long, and under what retention rule. For a gaming service, I would keep the authorization decision in the API and let object storage handle the bytes. That split gives players and build workers direct uploads without making the API a file proxy, while preserving an audit…

Pre-signed URLs offer a convenient way to grant temporary, limited access to objects stored in object storage services. By generating a URL that includes an expiration timestamp and any necessary permissions, the service can delegate authorization to the storage system rather than embedding complex logic directly in the application code. This approach simplifies the upload and download processes for tenants while still maintaining a clear audit trail of who accessed which objects and under what conditions.

To implement pre-signed URLs effectively, the service should first define a standardized record that captures all relevant metadata for each object, including the tenant and job identifiers, object key, content length limit, media type, policy version, creation time, and retention deadline. This record serves as the authoritative source for controlling access to the objects, rather than relying on the bucket name or folder structure.

When a tenant initiates an upload, the application should first validate the size and format of the incoming data. It should then construct an artifact intent object containing all the necessary details, such as the tenant and job identifiers, artifact ID, size, content type, policy version, and desired retention deadline. The application should also calculate the object key by concatenating the tenant, job, and artifact identifiers in a deterministic manner.

Next, the application should create a signed upload intent using the pre-signed URL endpoint provided by the storage service. This intent includes the same metadata as the artifact intent, along with the maximum duration for which the URL should be valid. The storage service will then return a signed URL that grants the tenant read and write permissions on the specified object for the allotted time period.

For downloads, the application should first verify the requester's authorization against the stored tenant and job record. Only after confirming that the user has the necessary permissions should the service sign the download URL using the same pre-signed URL endpoint. This ensures that only authorized users can access the object, even if the URL is shared or copied.

When implementing the object signer functionality, the storage service should expose two main methods: one for signing upload intents and another for signing download intents. The signUpload method should take the artifact intent as input and return a signed URL object containing the URL itself and the expiration timestamp. Similarly, the signDownload method should take the object key as input and generate a signed URL that can be used to retrieve the specified object.

To ensure the longevity of retention policies even in the face of retries or policy changes, the service should store the policy version alongside the retention deadline. This allows a separate reconciliation worker to periodically review the artifacts and adjust their retention deadlines as needed. By keeping the policy version and retention information together with the artifact metadata, the service can provide a clear audit trail that explains why each object was retained or deleted, even if the underlying policy has changed.

In summary, pre-signed URLs provide a powerful tool for granting temporary, fine-grained access to objects in object storage services. By separating authorization decisions from the application code and using a standardized metadata record to control access, services can simplify uploads, downloads, and retention policies while maintaining transparency and auditability.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Letter Visitors tutorial: spend your 2,000 free tokens like a test budget

Letter Visitors how-to, part 2. Desk-verified against Letter's official pages (letter.dev/visitors, letter.dev/pricing); not hands-on tested.

  • Letter Visitors identifies website visitors with $0.50 per person cost
  • Test budget starts with 2,000 free tokens for 40 visitor identifications
  • Days 3-4 examine first visitors to assess business value

Implement Custom Domain Onboarding: Node.js Add-Zone Reconciliation and Delayed Verify

TL;DR Short answer: add the custom domain, persist its zone, write the record, and schedule verification; choose Infrai for the REST orchestration when discovery and one key reduce integration…

  • Add custom domain and store zone identifier in tenant record.
  • Write DNS record via RESTful interface with atomic operation.
  • Schedule verification step for DNS propagation delay resolution.

Generate shell completions from the binary, with no new dependency

New command-line tools keep arriving as single binaries, and shell completion is the small tax each one pays before it feels installed.

  • Broom tool generates shell completions without new dependencies
  • --completions flag added to broom for bash, zsh, fish scripts
  • Implementation adds 276 lines, no additional dependencies

More from Tuesday 24 November →