Developer security mini-course

Lesson 5: Dependency Security and File Upload Controls

Learn how to manage dependency risk and protect file uploads, storage and downloads. Includes practical review steps and a controlled developer exercise.

Dependency security and file upload controls address two ways external content enters an application. Libraries introduce code maintained elsewhere. Uploads introduce data that your application may store, transform or present to other users.

A secure file lifecycle covers receipt, processing, storage, retrieval and deletion. Checking a filename at upload time does not establish that every later use is safe.

Learning outcome

You should be able to identify a component's owner and update path, and trace an uploaded file through the controls that protect it and its users.

Maintain a useful dependency inventory

Use manifests, lockfiles and build records to identify the components actually shipped. Include indirect dependencies and relevant runtime images or services where they are part of the application.

Assign ownership for vulnerability alerts and updates. Investigate whether an advisory affects the deployed version, configuration and reachable functionality. Record uncertainty instead of treating every alert as either proven exploitation or harmless noise.

Keep updates manageable, remove unused components and retain a way to produce and deploy a corrected build. A component that has reached the end of support may require migration rather than another ordinary patch.

Define what users may upload

Start with the feature's needs. Accept only the formats and sizes required, using several suitable checks rather than trusting the browser's content type or the extension alone.

StageControl to consider
ReceiptAuthentication, permission, size, count and resource limits.
IdentificationAllowed extension, content inspection and appropriate parsing.
ProcessingMaintained libraries, constrained execution and limits on expansion or conversion.
StorageApplication-generated identifiers and separation from executable application content.
RetrievalCurrent permission checks and safe response headers.
DeletionRemoval or retention according to the service's defined lifecycle.

Malware scanning and content processing can add protection where appropriate, but neither should be treated as proof that every file is safe.

Keep file paths under application control

Map an authorised object identifier to a known storage location. Avoid using a submitted path as the authority for which file may be read or written.

Use application-generated storage names and suitable filesystem permissions. Account for alternative routes, archives and background processing when reviewing path handling.

An unpredictable download URL can still be disclosed or forwarded. Enforce access according to the feature's intended sharing model, including expiry and revocation where needed.

Review how files are served

Decide whether a file should render in the browser or download as an attachment. Use appropriate content type and disposition, and consider a separate origin for untrusted active content where the architecture supports it.

Ensure downloads and previews apply the intended user and tenant checks. A protected upload screen does not prevent a later unauthorised retrieval.

Review exercise

Choose one dependency and one upload workflow. Record the component version, maintenance owner, update path and a relevant advisory or review result.

For the upload, trace a benign controlled file through storage and retrieval. Check limits, file identification and the result when another controlled user requests it. Test only within a suitable environment and agreed limits.

Add regression checks for meaningful boundaries, including unauthorised downloads and rejected formats. Repeat the review when a new parser, preview feature or storage service is introduced.

Read our Testing methodology to discuss coverage, or Book a demo with the systems and objectives you have in mind.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo