Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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-ce
Commits
5f9bb026
Commit
5f9bb026
authored
Mar 26, 2021
by
Adrien Kohlbecker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove programatic access to runner registration tokens
parent
dcc14623
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
changelogs/unreleased/ak-fix-registration-token.yml
changelogs/unreleased/ak-fix-registration-token.yml
+5
-0
lib/gitlab/ci/runner_instructions.rb
lib/gitlab/ci/runner_instructions.rb
+3
-3
spec/lib/gitlab/ci/runner_instructions_spec.rb
spec/lib/gitlab/ci/runner_instructions_spec.rb
+3
-3
No files found.
changelogs/unreleased/ak-fix-registration-token.yml
0 → 100644
View file @
5f9bb026
---
title
:
Remove programmatic access to registration tokens
merge_request
:
57524
author
:
type
:
changed
lib/gitlab/ci/runner_instructions.rb
View file @
5f9bb026
...
...
@@ -117,20 +117,20 @@ module Gitlab
return
unless
@project
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
@current_user
,
:admin_pipeline
,
@project
)
@project
.
runners_token
'$REGISTRATION_TOKEN'
end
def
group_token
return
unless
@group
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
@current_user
,
:admin_group
,
@group
)
@group
.
runners_token
'$REGISTRATION_TOKEN'
end
def
instance_token
raise
Gitlab
::
Access
::
AccessDeniedError
unless
@current_user
&
.
admin?
Gitlab
::
CurrentSettings
.
runners_registration_token
'$REGISTRATION_TOKEN'
end
end
end
...
...
spec/lib/gitlab/ci/runner_instructions_spec.rb
View file @
5f9bb026
...
...
@@ -123,7 +123,7 @@ RSpec.describe Gitlab::Ci::RunnerInstructions do
result
=
subject
.
register_command
expect
(
result
).
to
include
(
"
#{
commands
[
commands
.
each_key
.
first
]
}
register"
)
expect
(
result
).
to
include
(
"--registration-token
#{
group
.
runners_token
}
"
)
expect
(
result
).
to
include
(
"--registration-token
$REGISTRATION_TOKEN
"
)
expect
(
result
).
to
include
(
"--url
#{
Gitlab
::
Routing
.
url_helpers
.
root_url
(
only_path:
false
)
}
"
)
end
end
...
...
@@ -166,7 +166,7 @@ RSpec.describe Gitlab::Ci::RunnerInstructions do
result
=
subject
.
register_command
expect
(
result
).
to
include
(
"
#{
commands
[
commands
.
each_key
.
first
]
}
register"
)
expect
(
result
).
to
include
(
"--registration-token
#{
project
.
runners_token
}
"
)
expect
(
result
).
to
include
(
"--registration-token
$REGISTRATION_TOKEN
"
)
expect
(
result
).
to
include
(
"--url
#{
Gitlab
::
Routing
.
url_helpers
.
root_url
(
only_path:
false
)
}
"
)
end
end
...
...
@@ -205,7 +205,7 @@ RSpec.describe Gitlab::Ci::RunnerInstructions do
result
=
subject
.
register_command
expect
(
result
).
to
include
(
"
#{
commands
[
commands
.
each_key
.
first
]
}
register"
)
expect
(
result
).
to
include
(
"--registration-token
#{
Gitlab
::
CurrentSettings
.
runners_registration_token
}
"
)
expect
(
result
).
to
include
(
"--registration-token
$REGISTRATION_TOKEN
"
)
expect
(
result
).
to
include
(
"--url
#{
Gitlab
::
Routing
.
url_helpers
.
root_url
(
only_path:
false
)
}
"
)
end
end
...
...
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