Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
6e907f26
Commit
6e907f26
authored
Aug 09, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Harden gitlab-shell against arguments following the gl_id parameter in the command line
parent
c4b5a076
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
bin/gitlab-shell
bin/gitlab-shell
+1
-1
spec/gitlab_shell_gitlab_shell_spec.rb
spec/gitlab_shell_gitlab_shell_spec.rb
+3
-3
No files found.
bin/gitlab-shell
View file @
6e907f26
...
...
@@ -19,7 +19,7 @@ require File.join(ROOT_PATH, 'lib', 'gitlab_shell')
# We must match e.g. "key-12345" anywhere on the command-line. See
# https://gitlab.com/gitlab-org/gitlab-shell/issues/145
who
=
/\b(?:(?:key|user)-[0-9]+|username-\S+)\b/
.
match
(
ARGV
.
join
).
to_s
;
who
=
/\b(?:(?:key|user)-[0-9]+|username-\S+)\b/
.
match
(
ARGV
.
join
(
' '
)).
to_s
if
GitlabShell
.
new
(
who
).
exec
(
original_cmd
)
exit
0
...
...
spec/gitlab_shell_gitlab_shell_spec.rb
View file @
6e907f26
...
...
@@ -130,21 +130,21 @@ describe 'bin/gitlab-shell' do
# Not so basic valid input
# (https://gitlab.com/gitlab-org/gitlab-shell/issues/145)
it
'succeeds and prints username when a valid known key id is given in the middle of other input'
do
output
,
status
=
run!
([
"-c/usr/share/webapps/gitlab-shell/bin/gitlab-shell
key-100
"
])
output
,
status
=
run!
([
"-c/usr/share/webapps/gitlab-shell/bin/gitlab-shell
"
,
"key-100"
,
"2foo
"
])
expect
(
output
).
to
eq
(
"Welcome to GitLab, @someuser!
\n
"
)
expect
(
status
).
to
be_success
end
it
'succeeds and prints username when a valid known user id is given in the middle of other input'
do
output
,
status
=
run!
([
"-c/usr/share/webapps/gitlab-shell/bin/gitlab-shell
user-10
"
])
output
,
status
=
run!
([
"-c/usr/share/webapps/gitlab-shell/bin/gitlab-shell
"
,
"user-10"
,
"2foo
"
])
expect
(
output
).
to
eq
(
"Welcome to GitLab, @someuser!
\n
"
)
expect
(
status
).
to
be_success
end
it
'succeeds and prints username when a valid known username is given in the middle of other input'
do
output
,
status
=
run!
([
"-c/usr/share/webapps/gitlab-shell/bin/gitlab-shell
username-someuser
"
])
output
,
status
=
run!
([
"-c/usr/share/webapps/gitlab-shell/bin/gitlab-shell
"
,
"username-someuser"
,
"foo
"
])
expect
(
output
).
to
eq
(
"Welcome to GitLab, @someuser!
\n
"
)
expect
(
status
).
to
be_success
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment