Repository navigation
harness-runtime: reject unsafe /download default filenames - #2159
Merged
Merged
Conversation
The interactive /download shortcut derives a local filename from the workspace path with POSIX basename semantics. On Windows a Linux filename containing backslashes, ".." or a drive prefix is a path, so a workspace author could choose where the victim's download lands. Require the derived name to be a single host-local filename and otherwise ask for one.
Contributor
Author
Test results
Windows assertions for |
sanpj2292
approved these changes
Nov 30, 2026
sanpj2292
left a comment
Contributor
There was a problem hiding this comment.
LGTM. The inferred /download name now has to be one host-local filename: filepath.IsLocal plus the filepath.Base check rejects ..\, drive-qualified, UNC and trailing-backslash names on Windows, and /workspace/.., which used to slip through. Ordinary names and the POSIX parsing are unchanged. The /download tests pass locally, the test package builds for Windows, and CI is green on all three OSes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The interactive
/downloadshortcut guessed a local filename from the workspace path using POSIX basename semantics. On Windows, a Linux filename containing backslashes,..or a drive prefix is a path, so a workspace author could choose where the victim's download lands.Require the derived name to be a single host-local filename (
filepath.IsLocalplus basename equality,..rejected); otherwise the caller must name the destination explicitly. The POSIX parse is unchanged.Tests: Windows-gated cases for
..\outside.txt, drive-qualified, UNC and.., plus a command-level check that rejection happens before any transfer.