Skip to content

[codex] harden path safety and docs wording#155

Merged
gotalab merged 2 commits into
mainfrom
codex/harden-path-safety
Apr 11, 2026
Merged

[codex] harden path safety and docs wording#155
gotalab merged 2 commits into
mainfrom
codex/harden-path-safety

Conversation

@gotalab

@gotalab gotalab commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Summary

This change hardens cc-sdd against unsafe filesystem path handling and follows up with a small wording cleanup in the English docs.

The main user-facing issue is that the CLI accepted manifest- and template-derived paths without enforcing repository boundaries. In the current threat model, the realistic risk is not a remote HTTP exploit but a supply-chain or workspace-trust attack: a user runs the tool with a malicious manifest or inside a repository that contains attacker-controlled path structures such as symlinks.

Root Cause

The root cause was inconsistent trust-boundary handling around filesystem paths.

buildFileOperations() resolved source and destination paths directly from manifest and template inputs, but it did not verify that template sources remained inside the expected template root or that generated outputs remained inside the working repository. shared-rules names were also accepted without strict validation, which allowed traversal-oriented inputs to reach path resolution. On the write side, the executor wrote to resolved paths without rejecting symlinked destinations or symlinked parent path components.

Fix

The fix introduces a small path-safety layer and applies it at both planning time and write time.

A new pathSafety utility now validates that resolved paths stay within an allowed root and that path-bearing inputs are relative before resolution. fileOperations now uses these checks for manifest sources, template directories, generated output paths, and fallback template lookups. shared-rules handling was tightened to allow only safe markdown basenames. The executor now re-validates destination and backup paths against the repository boundary and refuses to write through symlinked paths.

This PR also updates a few English documentation lines to replace team-scale AI-driven development with the more natural AI-driven development at team scale.

Validation

I added regression coverage for:

  • rejecting template destinations that escape cwd
  • rejecting template sources that escape the templates root
  • rejecting writes through symlinked destinations
  • rejecting traversal in shared-rules

Checks run:

  • npm test in tools/cc-sdd (193 tests passing)

Impact

For normal usage, behavior is unchanged except that invalid or hostile path inputs now fail closed instead of being resolved and written. This should reduce the blast radius of malicious manifests, unsafe template metadata, and symlink-based repository tricks without changing the expected installation flow for valid templates.

@gotalab gotalab marked this pull request as ready for review April 11, 2026 01:49
@cursor

cursor Bot commented Apr 11, 2026

Copy link
Copy Markdown

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@gotalab gotalab merged commit 87c3c7f into main Apr 11, 2026
@gotalab gotalab mentioned this pull request Apr 11, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant