Reject scp-form remote URLs with a stray colon in the path #89

Merged
stephen merged 1 commit from fix/remote-scp-colon-owner into main 2026-06-08 12:14:20 +00:00
Owner

The scp-form remote parser (`git@host:owner/name`) splits on the first colon, so a URL carrying an extra colon, for example `git@host:2222:owner/name` (a port mistakenly placed in scp syntax), silently parsed `owner` as `2222:owner`. `fj` would then operate against the wrong repository path instead of reporting the URL as malformed, which is dangerous for any write command.

A real owner or name never contains a colon, so reject one in `split_path`. Adds a regression test for the multi-colon scp case.

The scp-form remote parser (\`git@host:owner/name\`) splits on the first colon, so a URL carrying an extra colon, for example \`git@host:2222:owner/name\` (a port mistakenly placed in scp syntax), silently parsed \`owner\` as \`2222:owner\`. \`fj\` would then operate against the wrong repository path instead of reporting the URL as malformed, which is dangerous for any write command. A real owner or name never contains a colon, so reject one in \`split_path\`. Adds a regression test for the multi-colon scp case.
Reject scp-form remote URLs with a stray colon in the path
All checks were successful
ci / check (pull_request) Successful in 9m43s
ci / live-e2e (pull_request) Successful in 1m47s
ci / coverage (pull_request) Successful in 1m54s
b8e3b0622d
The scp-form parser (`git@host:owner/name`) splits on the first colon, so a
URL with an extra colon such as `git@host:2222:owner/name` silently produced
owner `2222:owner` and went on to target the wrong repository. A real owner or
name never contains a colon, so reject one in split_path instead of operating
against a misparsed repo. Adds a regression test.
Sign in to join this conversation.
No description provided.