Skip to content

Commit 2d3ab5d

Browse files
committed
server/user-create: Disallow single and double quotes in SSH key
1 parent 67029aa commit 2d3ab5d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/git-shell-commands/user-create

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ if [ -z "$PUBLIC_KEY" ]; then
3434
exit 1
3535
fi
3636

37+
if (echo "$PUBLIC_KEY" | grep -xPq '^.*(\047|\042).*$'); then
38+
echo 'Disallowed characters in public key. Disallowed: '"'"', "'
39+
exit 1
40+
fi
41+
3742
# TODO(leon): Do we want to validate ssh-key type (e.g. rsa / ed25519 / ..)?
3843
case "$PUBLIC_KEY" in
3944
'ssh-'*)

0 commit comments

Comments
 (0)