Urgent.News

What's breaking now, across thousands of outlets.

Tech

Private User Document Storage for PDF, DOCX, Invoices, and Tenant Metadata

Short answer: store uploaded bytes in private object storage, but make a tenant-scoped database record the only way an application can discover or deliver them. Prefixes organize keys; they do not authorize a download. For a product handling user uploads, the decisive question is not whether the object is a PDF, DOCX, or invoice. It is where the system makes its access decision. Put that decision…

When a SaaS handles user uploads of PDFs, DOCX files, invoices, and tenant metadata, the most crucial factor is not the file type but the access decision made by the system. To protect these private documents, store the uploaded bytes in private object storage, while maintaining a tenant-scoped database record as the sole method for the application to locate or deliver them.

Prefixes are used to organize keys, but they do not grant authorization to download a file. For instance, a Python service can act as a control plane to test and process a document before it reaches a parser, embedding job, or model prompt. This approach ensures trust in the query process.

A recommended approach is to create an upload state machine instead of relying on folder conventions. Each upload should be represented by a single logical document row in the database, containing essential information such as tenant ID, uploader, opaque document ID, original filename, claimed media type, byte count, checksum, object key, and lifecycle state.

The original file name is merely display data and should not be used as a canonical key segment or an authorization input. The object key can still be readable enough for operations, adhering to a format like tenants/{tenant_id}/documents/{document_id}/v1. A prefix can facilitate inventory, targeted retention work, and incident investigation, but it does not prevent unauthorized access if an attacker obtains the key.

Private storage combined with a scoped metadata lookup provides the necessary protection against unauthorized access. For AI workflows, it is essential to maintain a distinction between source bytes and derivatives. This ensures that parsed text, chunks, embeddings, and generated summaries each reference a specific checksum or document version. Otherwise, retries can inadvertently parse and tokenize identical bytes multiple times, leading to cost attribution and evaluation results that are difficult to interpret.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Jensen Huang Is Gone. Now What?

After a shocking downfall, Nvidia’s CEO is out of a job. WIRED’s Lauren Goode explains what that means for the world’s most critical chip company, the AI industry, and Jensen Huang himself.

Python - for & while Loops

for Loop For loops is used to iterate over a sequence such as a list, tuple, string or range. It executes a block of code once for each item in the sequence.

More from Monday 16 November →