Skip to content

fix(browser): block upload symlink escapes#21972

Merged
mbelinky merged 1 commit intomainfrom
fix/browser-upload-symlink-escape
Feb 20, 2026
Merged

fix(browser): block upload symlink escapes#21972
mbelinky merged 1 commit intomainfrom
fix/browser-upload-symlink-escape

Conversation

@mbelinky
Copy link
Contributor

@mbelinky mbelinky commented Feb 20, 2026

Summary\n- add resolveExistingPathsWithinRoot() to validate upload paths via safe file-open under root\n- reject symlink and non-regular file escapes while preserving existing not-found behavior\n- update browser upload call sites to await the new validator\n- add dedicated tests for traversal and symlink-escape cases\n\n## Why\nThis lands the browser path-hardening piece from #21268 separately from app deep-link changes.

Greptile Summary

Added resolveExistingPathsWithinRoot() to validate file upload paths via safe file-open operations, preventing symlink escapes and path traversal attacks while preserving existing behavior for non-existent files.

  • Introduced new async path validator using openFileWithinRoot() from fs-safe.ts
  • Updated all three upload call sites to use the new async validator
  • Added comprehensive tests covering traversal, symlink escapes, and edge cases
  • Maintains backward compatibility by allowing non-existent files to pass through validation

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it strengthens security without breaking existing functionality
  • The implementation correctly addresses symlink escape vulnerabilities using well-tested openFileWithinRoot() from fs-safe.ts. All call sites properly await the new async function, error handling follows project conventions, and comprehensive tests validate the security improvements. The backward-compatible handling of non-existent files preserves existing behavior.
  • No files require special attention

Last reviewed commit: 9520890

@openclaw-barnacle openclaw-barnacle bot added cli CLI command changes agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Feb 20, 2026
@mbelinky mbelinky force-pushed the fix/browser-upload-symlink-escape branch from 9520890 to f74e977 Compare February 20, 2026 16:21
@openclaw-barnacle openclaw-barnacle bot added the docs Improvements or additions to documentation label Feb 20, 2026
@bmendonca3
Copy link

Do the tests cover “non-regular file” cases (f.e. directories/FIFOs) across platforms, or is that intentionally out of scope for now? Happy to help add coverage if needed

@mbelinky mbelinky force-pushed the fix/browser-upload-symlink-escape branch from f74e977 to 4381ef9 Compare February 20, 2026 16:36
@openclaw-barnacle openclaw-barnacle bot removed the docs Improvements or additions to documentation label Feb 20, 2026
@mbelinky mbelinky merged commit 8e4f6c0 into main Feb 20, 2026
10 checks passed
@mbelinky mbelinky deleted the fix/browser-upload-symlink-escape branch February 20, 2026 16:36
@mbelinky
Copy link
Contributor Author

Merged via squash.

Thanks @mbelinky!

rodrigogs pushed a commit to rodrigogs/openclaw that referenced this pull request Feb 20, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
Hansen1018 added a commit to Hansen1018/openclaw that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
vincentkoc pushed a commit that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
dgarson pushed a commit to dgarson/clawdbot that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
mmyyfirstb pushed a commit to mmyyfirstb/openclaw that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
obviyus pushed a commit to guirguispierre/openclaw that referenced this pull request Feb 22, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 4381ef9
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants