Summary
Compliance-trestle's catalog, profile, and SSP generation commands may write Markdown outside the intended Trestle workspace when their output path is influenced by untrusted data. An attacker who can control that path may cause files or directories to be overwritten as the invoking process owner, and forced overwrite mode may also delete an attacker-selected directory tree.
Affected context
The issue occurs in Trestle author commands that generate Markdown and append a user-supplied output argument to the Trestle root without applying the local-path security validation used by other commands. Risk depends on a trusted CI job, shared service, wrapper, or automation pipeline deriving the output path from repository-controlled, tenant-controlled, or otherwise untrusted input while assuming that generated files remain within the workspace.
Exploit preconditions
- Attack surface: The
catalog-generate,profile-generate, or
ssp-generate author command.
- Required access: The ability to influence the command's output argument
or the data from which that argument is derived.
- Trigger point: Path resolution and file generation during command
execution, especially when forced overwrite is enabled.
- Why exploitation is possible: The output path is checked for task-name
collisions but is not consistently validated as a confined local path, so
absolute paths or traversal components can escape the workspace. The
invoking process permissions determine what can be written or removed.
Why this happens
The underlying bug is insufficient canonical path validation at a filesystem trust boundary. The commands combine a trusted workspace root with attacker-influenced path data but rely on a name-collision check rather than verifying that the resolved destination remains beneath the permitted root. This maps to CWE-22: Path Traversal, where path elements allow access outside the intended directory. Recursive deletion in forced overwrite mode increases the impact of the same missing containment check.
Potential impact
- An attacker may write generated or replacement content to arbitrary paths permitted to the invoking process.
- Existing files may be overwritten, which could alter configuration, scripts, or pipeline inputs.
- Forced overwrite may delete an attacker-selected directory tree.
- A downstream automation process could execute tampered files, enabling indirect code execution.
- Shared services or CI workers could experience cross-tenant or cross-workspace impact.
General mitigation guidance
Mitigation generally focuses on enforcing filesystem confinement consistently across every command that accepts an output path. Secure-by-default designs resolve and canonicalize destinations, reject absolute paths and traversal escapes, and verify that the final path remains beneath an approved workspace root before writing or deleting. Input trust should be reduced by treating repository, tenant, and wrapper-provided paths as untrusted, while deletion operations should require separate, narrowly scoped safeguards. Running automation with least-privilege filesystem permissions, isolated workspaces, and minimal write access can limit consequences if validation fails.
How teams detect issues like this
Detection can include static analysis and code review rules that identify filesystem writes or recursive deletes using user-controlled paths, path joining without canonical containment checks, and validation based only on filename or task-name collisions. CI policies can require approved path validation helpers for commands that accept output locations and can flag absolute paths or traversal components in generated job specifications. Runtime monitoring may alert on writes or deletions outside the expected workspace, particularly from shared automation identities. Automated review tools can help identify inconsistent use of path-security utilities.

