• 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: security-path-validation
CHANGE BRANCH
x
Reset
  • security-path-validation
  • 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
  • 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 security-path-validation
  • 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
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