Summary
A path traversal vulnerability in Clasp versions prior to 3.2.0 allows specially crafted filenames inside a Google Apps Script project to escape expected directories during local processing.
When a victim interacts with a malicious project, an attacker-controlled file path can be resolved outside the intended workspace, potentially leading to remote code execution on the developer's machine or CI environment.
Affected context
This vulnerability arises when Clasp is used to pull, push, or otherwise synchronize Google Apps Script projects that contain files with directory traversal sequences in their names (for example, segments that attempt to move up or out of the expected project directory).
The risk primarily affects environments where Clasp translates remote project entries into local filesystem paths and then reads, writes, or executes them without fully normalizing and validating those paths.
It is most relevant to developers or automation systems (such as CI/CD pipelines) that work with Apps Script projects from untrusted or partially trusted sources.
Exploit preconditions
- Attack surface: Clasp's file synchronization and project handling logic (e.g., commands that read or write project files locally).
- Required access: Ability to introduce or control filenames within a Google Apps Script project that will later be processed by a victim using Clasp (for instance, via sharing a project, template, or repository).
- Trigger point: The victim runs Clasp commands (such as pulling/downloading or synchronizing the project) that cause the tool to resolve and create local filesystem paths based on project file metadata.
- Why exploitation is possible: Clasp fails to robustly normalize, constrain, and validate file paths derived from project content, allowing directory traversal sequences (like
../) to escape the intended project root and target arbitrary locations on the filesystem, which can be leveraged to place or modify executable content.
Why this happens
The core issue maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Clasp trusts path components derived from project metadata and composes them into filesystem paths without fully normalizing them or enforcing that they remain within a defined, safe base directory.
By embedding traversal sequences into filenames inside a Google Apps Script project, an attacker can cause Clasp to operate on files outside the intended workspace.
In environments where these files are then executed, interpreted, or used as part of build or tooling workflows, this broken path constraint can be escalated into remote code execution.
Potential impact
- Creation or overwriting of files outside the intended Clasp project directory.
- Placement or modification of scripts, configuration files, or binaries that may later be executed.
- Compromise of developer workstations through execution of attacker-controlled code.
- CI/CD or build pipeline compromise when automation processes interact with the affected project.
- Potential exposure or corruption of sensitive local files, depending on how overwritten data is later used.
General mitigation guidance
Effective mitigation focuses on enforcing strict path handling and reducing trust in remote project content:
- Normalize and canonicalize all paths derived from project metadata before use, resolving symbolic links and
./..segments. - Enforce that every computed path remains within a single, well-defined project root directory; reject or sanitize paths that attempt to traverse outside.
- Treat filenames from remote or shared Apps Script projects as untrusted input and apply strict validation (for example, allow-listed characters and directory layouts).
- Separate project synchronization from any automatic execution or loading of synchronized files; require an explicit, user-visible step before running newly pulled content.
- Run development and automation environments with least privilege, minimizing filesystem permissions so that even if traversal occurs, the impact is constrained.
How teams detect issues like this
To detect and manage similar issues, organizations can:
- Use static analysis or linting rules that flag concatenation of untrusted path components without proper normalization and boundary checks.
- Incorporate code review guidelines that call out any usage of external data when constructing filesystem paths, especially around sync or import tooling.
- Add unit and integration tests that feed in crafted filenames with traversal sequences and assert that they are rejected or safely handled.
- Employ security-focused scanning tools on CLI utilities and build tools to identify path traversal patterns and missing root-directory enforcement.

