Skip to content

fix: resolve symlinks in validateOutputPath (#665)#712

Closed
stedfn wants to merge 1 commit intogarrytan:mainfrom
stedfn:stedfn/fix-symlink-output-path
Closed

fix: resolve symlinks in validateOutputPath (#665)#712
stedfn wants to merge 1 commit intogarrytan:mainfrom
stedfn:stedfn/fix-symlink-output-path

Conversation

@stedfn
Copy link
Copy Markdown
Contributor

@stedfn stedfn commented Mar 31, 2026

Summary

  • Mirrors the validateReadPath symlink-resolution pattern into validateOutputPath
  • Resolves SAFE_DIRECTORIES via realpathSync at module load to handle platform symlinks (e.g., macOS /tmp/private/tmp)
  • Resolves input paths via realpathSync with ENOENT fallback for parent directory (output files may not exist yet)

Fixes #665

Test plan

  • bun test passes
  • bun run build succeeds
  • Verify symlink under /tmp no longer bypasses output path validation

🤖 Generated with Claude Code

…an#665)

Mirror the validateReadPath pattern: resolve SAFE_DIRECTORIES and input
paths via realpathSync to prevent symlinks under /tmp from redirecting
writes to arbitrary locations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stedfn
Copy link
Copy Markdown
Contributor Author

stedfn commented Mar 31, 2026

Closing — PR #664 already addresses #665 as part of a larger security omnibus fix.

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.

[Security] validateOutputPath symlink bypass — screenshots/PDFs can write outside safe dirs

1 participant