Summary
A path traversal vulnerability in Romeo's webserver API allows crafted tar archives to write files outside the intended extraction directory when processed for coverage-related operations.
Because the archive path sanitization relies on an incorrect prefix check without a trailing path separator, an attacker who can upload or submit tar archives may cause arbitrary file writes on the underlying system.
Affected context
This vulnerability affects environments where Romeo is used to process tar archives, typically within CI/CD pipelines such as GitHub Actions for Go (≥1.20) applications.
The issue occurs in the sanitizeArchivePath function of webserver/api/v1/decoder.go, where archive entry paths are validated using an imprecise strings.HasPrefix check.
When Romeo is configured to accept or process user- or pipeline-supplied tar archives, a malicious archive entry can escape the designated extraction directory and target arbitrary filesystem locations that the Romeo process can write to.
Exploit preconditions
- Attack surface: Tar archive handling endpoint or functionality exposed by Romeo's webserver.
- Required access: Ability to supply or influence tar archives processed by Romeo (e.g., via CI artifacts, API upload, or repository-controlled inputs).
- Trigger point: Extraction of archive entries by the webserver using
sanitizeArchivePathto validate paths. - Why exploitation is possible: The path validation uses
strings.HasPrefixwithout enforcing a trailing path separator, allowing crafted paths that share the same prefix but refer to directories outside the intended extraction root.
Why this happens
The root cause is a flawed path normalization and validation logic, mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The sanitizeArchivePath function attempts to confirm that extracted file paths remain within a target directory by checking that the final path starts with the desired base path.
However, the check does not append or enforce a path separator, so a malicious path such as one that begins with the base directory string but continues into a different directory hierarchy can bypass this protection.
Without canonicalization and strict directory boundary checks, the code implicitly trusts archive entry names, enabling traversal outside the intended extraction directory.
Potential impact
- Arbitrary file creation or overwrite outside the intended extraction directory.
- Overwriting configuration files, scripts, or other sensitive assets accessible to the Romeo process.
- Potential escalation to remote code execution if overwritten files are later executed or interpreted (e.g., shell scripts, configuration loaded by other services).
- Disruption of CI/CD workflows through corruption of build artifacts or pipeline metadata.
General mitigation guidance
Effective mitigation focuses on enforcing strict directory boundaries and treating archive entry names as untrusted input.
Recommended defensive patterns include:
- Normalizing and canonicalizing paths (e.g., using
filepath.Clean) before validation, and rejecting entries that contain traversal components such as... - Enforcing that the resolved, absolute path of each archive entry resides within the intended extraction directory, using checks based on
filepath.Relor equivalent functions and verifying the result does not escape the root. - Including a trailing path separator when performing prefix checks on directories, or using dedicated path-joining APIs instead of raw string prefix logic.
- Restricting the privileges of the Romeo process so that even if path validation fails, the process has minimal access to sensitive directories and files.
- Isolating archive extraction into a dedicated, throwaway workspace or sandbox to limit the blast radius of any file writes.
How teams detect issues like this
Detection usually combines code-level analysis with runtime hardening:
- Static analysis: Search for custom path sanitization routines that rely on
strings.HasPrefixor similar string-based checks to enforce directory boundaries, especially in archive extraction or upload handling code. - Code review: Flag any file extraction or write operations based on user-controlled paths that do not use canonicalization and strict root checks; ensure reviewers look for
..handling and absolute/relative path normalization. - Policy enforcement: Establish guidelines and linters that prohibit raw string prefix checks for filesystem security and encourage use of path-aware standard library functions.
- Runtime monitoring: Monitor CI/CD runners or servers for unexpected file changes outside designated work directories when tar extractions occur, to help identify attempted abuse.

