Keep file upload security checks on the server
An upload needs rules for the content it accepts and the object it may create. A filename from the browser doesn't decide ownership.
npm install --save-dev @sitecmd/cli
npx sitecmd audit .
The CLI runs on your computer or in your CI, and your code stays there.
What it finds on a demo project
The audit reports upload handlers with no size or type check, and uploads saved under a browser-supplied name with no owner in the storage key.
SiteCMD CLI 2.0.0
Demo project: File upload endpoint
npx sitecmd audit .
SiteCMD Code Scan - .
Checked: November 9, 2026
Framework: Express
Issues: 2 total | critical 0 | high 2 | medium 0 | low 0
High (2)
- [Security · security] Request-derived upload key lacks recognized ownership scope - src/upload.js:16
- [Security · security] Upload handler lacks recognized size or content-type guards - src/upload.js:3
Your code passes? Now watch your site.
Validate file uploads beyond the browser's Content-Type
Accept only the file types the feature needs, enforce a size limit and inspect each file with checks suited to its type. A request's Content-Type can be spoofed. OWASP's upload guidance explains these checks.
Scope file upload storage keys to the allowed user
Generate the object's identity on the server or enforce an owner record the server can trust. Test what happens when two users submit the same filename or one user supplies another user's object key.
How does presigned URL security work for uploads?
An S3 presigned upload URL grants access to a specific object until it expires, subject to the signing credentials. You can reuse it during that time, and uploading to an existing key replaces that object. Amazon's presigned URL guide explains those limits.
Frequently asked questions
Does client-side file upload validation protect my server?
No. The server or storage service must enforce the upload policy even when a request bypasses the browser form. Test oversized and disallowed files through that direct path.
Connect upload permissions to request limits and record ownership
Website security
Catch leaked API keys and exposed files before someone uses them against you.
API rate limiting
Put limits on sign-in, password reset, forms and other public endpoints.
IDOR and tenant isolation
Look for app queries that trust an ID without checking who may use it.