Skip to content

Commit 998f78e

Browse files
authored
Merge pull request from GHSA-h76c-85mw-72gq
Disallow scp access
2 parents b8b94d6 + ad4cd7b commit 998f78e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

apps/gitgud/lib/gitgud/ssh_server.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ defmodule GitGud.SSHServer do
180180
ssh_cli: {__MODULE__, []},
181181
parallel_login: true,
182182
pwdfun: &check_credentials/2,
183+
subsystems: [],
183184
system_dir: to_charlist(system_dir)]
184185
end
185186

apps/gitgud/test/gitgud/ssh_server_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ defmodule GitGud.SSHServerTest do
2727
assert {^output, 255} = System.cmd("ssh", args, env: env_vars, stderr_to_stdout: true)
2828
end
2929

30+
test "disallows scp", %{user: user} do
31+
env_vars = [{"DISPLAY", "nothing:0"}, {"SSH_ASKPASS", Path.join([Path.dirname(__DIR__), "support", "ssh_askpass.exs"])}]
32+
args = ["-P", "9899", "mix.exs", "#{user.login}@localhost:/tmp/mix.exs"]
33+
assert {output, 255} = System.cmd("scp", args, env: env_vars, stderr_to_stdout: true)
34+
assert output =~ "subsystem request failed on channel"
35+
end
36+
3037
describe "when user has ssh public-key" do
3138
setup :create_ssh_key
3239

0 commit comments

Comments
 (0)