Summary
A relative path traversal vulnerability in projen's generated file manifest cleanup component may allow files and directories outside the intended project directory to be recursively deleted. The risk arises when an attacker can influence version-controlled manifest entries and the environment running projen has write access to the targeted paths.
Affected context
The issue may occur in projen projects that use the generated file manifest cleanup process during project synthesis. It becomes risky when manifest content can be altered through a version-control workflow or another trusted input path, and the projen runtime has write permissions beyond the project directory.
Exploit preconditions
- Attack surface: Generated file manifest processing during project synthesis
- Required access: Ability to influence or commit entries in the version-controlled generated file manifest
- Trigger point: Manifest cleanup performed by the projen runtime
- Why exploitation is possible: Relative paths may escape the intended project directory when containment checks do not correctly resolve and enforce the permitted path boundary
Why this happens
The underlying bug is an insufficient path containment check in a file cleanup routine. When relative paths are resolved without reliably verifying that the resulting canonical path remains within the project directory, attacker-controlled manifest entries may reference external locations.
This behavior maps to CWE-23: Relative Path Traversal, in which path manipulation causes an application to access or modify files outside an intended directory boundary.
Potential impact
- Files outside the project directory may be deleted
- Writable directories may be removed recursively
- Build, deployment, or development workflows could be disrupted
- Source code, configuration, or generated artifacts may be lost
- A broader compromise could occur if sensitive or security-relevant writable files are targeted
General mitigation guidance
Mitigation generally focuses on enforcing directory containment before performing filesystem cleanup.
Common defensive patterns include:
- Canonicalizing and normalizing paths before authorization or deletion
- Verifying that every resolved target remains beneath the designated project root
- Rejecting absolute paths, parent-directory traversal, and ambiguous path forms
- Treating version-controlled manifest content as untrusted input
- Restricting the runtime's filesystem permissions to the minimum required scope
- Using safe-by-default cleanup APIs that operate only on prevalidated project-relative paths
- Adding regression tests for symlinks, nested parent traversal, and platform-specific path behavior
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules that identify filesystem operations using untrusted or manifest-derived paths
- Code review checks for canonicalization followed by explicit root-containment validation
- Tests covering parent-directory segments, absolute paths, symlinks, and recursive deletion
- Policy enforcement that limits build and synthesis processes to isolated, least-privileged workspaces
- Runtime auditing of recursive delete operations performed outside expected project roots
Automated security review tools may help identify path construction and authorization patterns that require manual validation.

