Skip to content

fix: sanitize step summaries used as file paths - #40

Closed
rubenfiszel wants to merge 1 commit into
mainfrom
fix/sanitize-step-summary-paths
Closed

rubenfiszel wants to merge 1 commit into
mainfrom
fix/sanitize-step-summary-paths

Conversation

@rubenfiszel

Copy link
Copy Markdown
Contributor

Summary

  • Step summaries passed to assignPath() were not sanitized, allowing path separators (/, \), control characters, and OS-reserved characters (<>:"|?*) to end up in generated file paths
  • Added sanitizePathSegment() in file-utils.ts that strips these characters
  • Wrapped the path assigner in extension.ts so summaries are sanitized before path generation, keeping both on-disk files and !inline references consistent

Test plan

  • Added sanitize-path.test.ts with 7 test cases covering normal passthrough, path traversal sequences, OS-reserved chars, control chars, empty strings, and all-bad-character strings
  • All 54 tests pass (npx jest)
  • TypeScript compiles cleanly (npx tsc --noEmit)

🤖 Generated with Claude Code

Step summaries are used as the source of truth for inline script file
names via assignPath(). They were not sanitized, so summaries containing
path separators (/, \) or OS-reserved characters could produce invalid
or traversal-prone file paths. Wrap the path assigner to strip control
characters, path separators, and reserved filename characters before
path generation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rubenfiszel rubenfiszel closed this Apr 9, 2026
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