Select Object Storage APIs for Browser Direct Uploads Across Fintech Tenants
TL;DR: choose an upload API that keeps authorization decisions on your server and gives the browser a narrowly scoped, short-lived write capability. For generated fintech reports, the tenant boundary matters more than wh
TL;DR: choose an upload API that keeps authorization decisions on your server and gives the browser a narrowly scoped, short-lived write capability. For generated fintech reports, the tenant boundary matters more than whether the API feels pleasant. A direct upload is a good fit when the server mints the object name and upload permission, the storage layer enforces that scope, and a completion step verifies what arrived.
| Upload shape | Tenant isolation | Operational cost | Best fit |
|---|---|---|---|
| Server proxy | Strong central control | Highest bandwidth and compute use | Small files or strict inspection before storage |
| Short-lived signed upload | Strong when the key and policy are server-generated | Low application bandwidth use | Generated reports with a known destination |
| Client-issued broad credential | Weak and difficult to audit | Low initial effort | Almost never for customer data |
The practical recommendation is the middle row: issue one short-lived capability for one report, one tenant, one object key, and one size limit. Keep the report metadata and access decision in the application database. Storage should hold bytes, not become the source of truth for who may read them.
Keep it narrow.
Where does the tenant boundary actually live?
A browser upload starts with an untrusted client. Even when the browser is your own frontend, its code, network requests, and local state are visible to the customer. The browser can present a tenant ID, filename, MIME type, or report ID that does not belong to the signed-in user. None of those values should grant authority.
Authority belongs on the server.
The server should derive the tenant from the authenticated session, load the report record, and choose the object key. A useful key is boring and non-semantic: reports/{tenantId}/{reportId}/source.bin. The important property is not the spelling. It is that the client cannot replace tenantId or reportId after authorization.
I initially treated the object path as an implementation detail. That was too casual. The path is part of the authorization contract because a read URL, overwrite permission, cleanup job, and audit record all depend on it. If two tenants can cause the same key to be signed, isolation has already failed before storage sees a request.
Use separate checks for upload and download. A customer who may upload a generated report is not automatically allowed to download every object under that prefix. The download endpoint should authenticate again, check the report's tenant, and mint a read capability only after that check.
How should a fintech team select an object storage API for browser direct uploads?
For a small single-shot upload, a signed request can be enough. For a large report or an unreliable connection, a resumable protocol reduces the cost of restarting. That choice is about transfer behavior, not authorization: every part or resume operation still needs to remain bound to the same server-approved object.
The API contract I want is narrow:
-
POST /reports/{reportId}/upload-intentauthenticates the customer and returns a short-lived upload capability. - The browser sends bytes directly to storage using that capability.
-
POST /reports/{reportId}/upload-completerecords completion only after the server checks the expected object and metadata.
That is enough application surface for most generated reports. I do not want the frontend choosing a bucket, changing a prefix, or receiving a credential that can list objects. A capability that can upload one object is easier to rotate, log, revoke, and explain during an incident review.
The browser's declared content type is useful for routing, but it is not proof of file contents. If downstream parsers care about the format, inspect the stored object asynchronously. Keep that worker separate from the request that authorizes the upload, so a parser failure cannot turn into a mistaken authorization decision.
A small server-side capability contract
The following TypeScript-like interface makes the boundary explicit. The storage adapter is deliberately generic; the application owns identity and policy, while the adapter owns the provider-specific signing call.
type UploadIntent = {
tenantId: string;
reportId: string;
objectKey: string;
contentType: string;
maxBytes: number;
expiresAt: string;
};
interface StorageSigner {
createUploadCapability(input: {
objectKey: string;
contentType: string;
maxBytes: number;
expiresInSeconds: number;
}): Promise<{ url: string; headers: Record<string, string>; expiresAt: string }>;
}
async function createIntent(
signer: StorageSigner,
session: { userId: string },
reportId: string,
requestedType: string,
): Promise<UploadIntent & { url: string; headers: Record<string, string> }> {
const report = await loadReportForUser(reportId, session.userId);
if (!report) throw new Error('report not found');
const contentType = allowedReportTypes.has(requestedType)
? requestedType
: 'application/octet-stream';
const objectKey = `reports/${report.tenantId}/${report.id}/source.bin`;
const capability = await signer.createUploadCapability({
objectKey,
contentType,
maxBytes: 25_000_000,
expiresInSeconds: 300,
});
return {
tenantId: report.tenantId,
reportId: report.id,
objectKey,
contentType,
maxBytes: 25_000_000,
expiresAt: capability.expiresAt,
url: capability.url,
headers: capability.headers,
};
}
The number in this example is a policy placeholder, not a universal limit. Set it from the actual report envelope and parser capacity, then enforce the same limit at the storage boundary. A limit checked only in JavaScript is a hint. A limit included in the signed policy or provider request is an enforcement point.
Do not put a long-lived secret in this flow. Do not accept a client-supplied object key as authoritative. Do not use a successful HTTP response as proof that the expected bytes were stored unless the completion path also verifies the object identity and the metadata your application relies on.
The limitation is clear: direct upload is a poor fit when bytes must be transformed or scanned before storage. In that case, a server proxy is the better choice, even though it spends more application bandwidth and adds operational load.
What should be tested before shipping?
The happy path is easy. The useful tests are cross-tenant attempts and half-finished transfers.
Create two tenants and two reports. Sign an upload for tenant A, then try to alter the key, report ID, content type, and expiration from the browser. Each mutation should fail or become harmless because the signed request no longer matches. Use the capability against tenant B's key and expect rejection. Then let a valid upload finish twice; completion should be idempotent and should not create a second logical report.
Test expiration with a clock boundary, not just a sleep in an integration test. Test an object larger than the policy. Test a missing object at completion. Test a storage success followed by an application timeout, because retries are normal and the record must converge instead of creating duplicate work.
Log the user ID, tenant ID, report ID, object key, capability creation time, completion result, and failure reason. Avoid logging the signed URL or any secret-bearing query string. An audit trail that can answer who authorized the object and who later downloaded it is more valuable than a verbose request log.
For a one-person SaaS, this is where revenue per hour matters. A proxy can simplify inspection, but it also makes every report consume application bandwidth and adds another failure path during traffic spikes. A direct upload shifts transfer work to storage, while the application keeps the small, high-value decisions. That division is usually easier to operate weekly. Outsource the undifferentiated byte movement; keep tenant policy in code you can review.
When is the runner-up the better choice?
Use a server proxy when the bytes must be transformed, scanned, or rejected before they are accepted as durable storage, and the extra application bandwidth is an intentional trade. It can also be the clearer design for small files where a second capability protocol would add more code than it removes.
Use resumable upload semantics when reports are large enough that restarting is painful or when clients commonly lose connectivity. The resume token still needs an object scope, an expiry, and an ownership check. Resumability does not make a broad credential safe.
The decision rule stays simple: the browser may transport bytes, but it should not define ownership. For authenticated fintech customers, a storage API earns its place when its authorization scope is narrow, its failure states are observable, and the application can prove which tenant owns every object.
References
- https://supabase.com/docs/guides/storage
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
- https://datatracker.ietf.org/doc/html/rfc6750
- https://datatracker.ietf.org/doc/html/rfc9110
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/PresignedUrlUploadObject.html
- https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes â full credit and traffic to the original publisher.