• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

richardgirges / express-fileupload
93%
master: 95%

Build:
Build:
LAST BUILD BRANCH: security-path-validation
DEFAULT BRANCH: master
Repo Added 18 Feb 2017 04:21AM UTC
Files 9
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH security-path-validation
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • 0.4.0
  • 1.1.1-alpha.2
  • 1.1.6
  • 1.1.6-alpha.1
  • 1.1.6-alpha.3
  • 1.1.6-alpha.4
  • 1.1.6-alpha.5
  • 1.1.6-alpha.6
  • chore/update-dependencies
  • deleteme
  • dependabot/npm_and_yarn/eslint-utils-1.4.3
  • dependabot/npm_and_yarn/handlebars-4.5.3
  • dependabot/npm_and_yarn/js-yaml-3.13.1
  • dependabot/npm_and_yarn/lodash-4.17.15
  • feature/allowExtensionPreservationWithSafeFileNames
  • master
  • richard/update-dependencies
  • security-path-validation
  • v0.1.0
  • v0.1.1
  • v0.1.2
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.2.0
  • v0.3.0
  • v1.0.0
  • v1.0.0-alpha.1
  • v1.1.1-alpha.1
  • v1.1.1-alpha.2
  • v1.1.1-alpha.3
  • v1.1.1-alpha.4
  • v1.1.2-alpha.1
  • v1.1.3-alpha.1
  • v1.1.3-alpha.2
  • v1.1.4
  • v1.1.5

19 Dec 2025 10:50AM UTC coverage: 92.969% (-1.6%) from 94.524%
57eada64-12e3-4809-a474-ee1ff0a655d3

Pull #390

circleci

Theodoros Malachias
Add optional path validation to prevent path traversal attacks

This change adds opt-in path validation to protect against path traversal
vulnerabilities when user input is passed to the mv() function.

## Changes:

### New Configuration Options:
- uploadDir: Base directory for uploads (null = validation disabled)
- validatePaths: Enable/disable validation (default: true)
- allowAbsolutePaths: Allow absolute paths (default: false)

### Security Features:
- Validates paths to prevent directory traversal (../)
- Blocks URL encoded attacks (%2e%2e%2f)
- Blocks double URL encoding (%252e%252e)
- Blocks null byte injection (%00)
- Blocks Windows-style traversal (..\)
- Prevents paths from escaping uploadDir
- Validates path length (max 1024 chars)

### Implementation:
- Added validateUploadPath() function in lib/utilities.js
- Integrated validation in lib/fileFactory.js mv() method
- Added comprehensive test suite (15+ test cases)
- Updated README with security best practices

## Backward Compatibility:
- NON-BREAKING: Validation only active when uploadDir is set
- Existing code without uploadDir works exactly as before
- No changes required for current users

## Testing:
- All existing tests pass
- New tests cover path traversal prevention
- Tested with real application (legacy and secure modes)
- Attack vectors successfully blocked

Addresses security concerns around path traversal when developers
pass user-controlled input to file.mv() without validation.
Pull Request #390: Add optional path validation to prevent path traversal attacks

185 of 205 branches covered (90.24%)

30 of 38 new or added lines in 2 files covered. (78.95%)

357 of 384 relevant lines covered (92.97%)

744.42 hits per line

Relevant lines Covered
Build:
Build:
384 RELEVANT LINES 357 COVERED LINES
744.42 HITS PER LINE
Source Files on master
  • Tree
  • List 9
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
57eada64... security-path-validation Add optional path validation to prevent path traversal attacks This change adds opt-in path validation to protect against path traversal vulnerabilities when user input is passed to the mv() function. ## Changes: ### New Configuration Options: ... Pull #390 19 Dec 2025 10:51AM UTC Theodoros Malachias circleci
92.97
46282c63... security-path-validation Add optional path validation to prevent path traversal attacks This change adds opt-in path validation to protect against path traversal vulnerabilities when user input is passed to the mv() function. ## Changes: ### New Configuration Options: ... Pull #390 19 Dec 2025 08:54AM UTC h15629526027 circleci
92.97
1f440444... master Merge pull request #387 from RomanBurunkov/chore/update-dependencies Chore/update dependencies push 05 Jul 2025 12:19PM UTC web-flow circleci
94.52
a8778863... chore/update-dependencies Update ci node versions Pull #387 05 Jul 2025 12:15PM UTC RomanBurunkov circleci
94.52
0baad400... master Merge pull request #385 from RomanBurunkov/master Add process id to the temp files name push 25 Jun 2025 08:52PM UTC web-flow circleci
94.52
b554ce5b... master Bump version to 1.5.2 Pull #385 17 Jun 2025 09:00PM UTC RomanBurunkov circleci
94.52
4450386c... master Merge pull request #376 from raczynski/master Added option tempFilePermissions to allow limiting file access on shared servers push 27 Dec 2024 07:08PM UTC web-flow circleci
94.51
f6a54daa... master Added option tempFilePermissions to allow limiting file access on shared servers Pull #376 18 Jul 2024 08:54PM UTC jedrzejraczynski circleci
94.51
e853a1a4... master Merge pull request #375 from Kpovoc/master Issue 374: Allow an option to choose the hashing algorithm push 13 Jul 2024 11:47AM UTC web-flow circleci
94.48
6457d6e1... master PR 375: Suggested changes - `buildOptions` now throws an error if `hashAlgorithm` is not defined, instead of resetting to the default value of 'md5' - Moved + symbol for a string concatination to the beginning of the next line - Updated the REA... Pull #375 26 Jun 2024 02:35PM UTC Brad Wilson circleci
94.48
See All Builds (387)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc