Skip to content

fix: quote every part of the copied curl command - #26

Merged
heoblitz merged 1 commit into
toss:mainfrom
wjdtjq6:fix/curl-command-quoting
Oct 15, 2026
Merged

heoblitz merged 1 commit into
toss:mainfrom
wjdtjq6:fix/curl-command-quoting

Conversation

@wjdtjq6

@wjdtjq6 wjdtjq6 commented Oct 13, 2026

Copy link
Copy Markdown

Summary

The "copy as curl" command in the Network detail quoted header values and the body, but put the URL, the method and header names in as they were. A URL with an apostrophe (?q=it's) produced a command the shell could not read, and a URL written for the purpose (';<command>;' is legal in a path or query, and URLs come from servers as much as from the app) ran whatever followed the quote when the command was pasted. Every part is now a single quoted argument; a method that is a bare word stays bare, so the common case reads as before.

Changelog

Fix the copied curl command breaking, or running extra commands, when a URL contains a quote.

Test Plan

  • swift test: 162 tests in 12 suites passed. survivesAShell feeds the generated command to /bin/sh with curl replaced by printf '%s\0' and checks the arguments the shell actually produced for a URL, method and header containing ', ;, $(…) and backticks; on main the shell splits the method and exits 127. writesPlainCommand pins the unchanged output for an ordinary GET.

The URL, the method and header names went into the command as they
were. A URL with an apostrophe in it produced a command the shell could
not read, and one written for the purpose ran whatever followed the
quote when the command was pasted. Each part is now a single quoted
argument.
@heoblitz
heoblitz merged commit d8d31a7 into toss:main Oct 15, 2026
5 checks passed
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.

2 participants