Skip to content

Commit d63a19e

Browse files
committed
Add ambiguous username journey tests
These should not pass yet, because gix-transport and the gix binary do not yet have special handling to reject ambiguous usernames that can be interpreted as command-line options to ssh clients. These new journey tests may need further refinement.
1 parent b363cfb commit d63a19e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/journey/gix.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,21 @@ title "gix commit-graph"
345345
}
346346
)
347347
)
348+
(with "an ambiguous ssh username which could be mistaken for an argument"
349+
snapshot="$snapshot/fail-ambiguous-username"
350+
(with "explicit ssh (true url with scheme)"
351+
it "fails without trying to pass it to command-line programs" && {
352+
WITH_SNAPSHOT="$snapshot/explicit-ssh" \
353+
expect_run $WITH_FAILURE "$exe_plumbing" free pack receive 'ssh://-Fconfigfile@foo/bar'
354+
}
355+
)
356+
(with "implicit ssh (special syntax with no scheme)"
357+
it "fails without trying to pass it to command-line programs" && {
358+
WITH_SNAPSHOT="$snapshot/implicit-ssh" \
359+
expect_run $WITH_FAILURE "$exe_plumbing" free pack receive -- '-Fconfigfile@foo:bar/baz'
360+
}
361+
)
362+
)
348363
(with "an ambiguous ssh host which could be mistaken for an argument"
349364
it "fails without trying to pass it to command-line programs" && {
350365
WITH_SNAPSHOT="$snapshot/fail-ambiguous-host" \
@@ -370,6 +385,21 @@ title "gix commit-graph"
370385
if test "$kind" = "max" || test "$kind" = "max-pure"; then
371386
(with "the 'clone' sub-command"
372387
snapshot="$snapshot/clone"
388+
(with "an ambiguous ssh username which could be mistaken for an argument"
389+
snapshot="$snapshot/fail-ambiguous-username"
390+
(with "explicit ssh (true url with scheme)"
391+
it "fails without trying to pass it to command-line programs" && {
392+
WITH_SNAPSHOT="$snapshot/explicit-ssh" \
393+
expect_run $WITH_FAILURE "$exe_plumbing" clone 'ssh://-Fconfigfile@foo/bar'
394+
}
395+
)
396+
(with "implicit ssh (special syntax with no scheme)"
397+
it "fails without trying to pass it to command-line programs" && {
398+
WITH_SNAPSHOT="$snapshot/implicit-ssh" \
399+
expect_run $WITH_FAILURE "$exe_plumbing" clone -- '-Fconfigfile@foo:bar/baz'
400+
}
401+
)
402+
)
373403
(with "an ambiguous ssh host which could be mistaken for an argument"
374404
it "fails without trying to pass it to command-line programs" && {
375405
WITH_SNAPSHOT="$snapshot/fail-ambiguous-host" \

0 commit comments

Comments
 (0)