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
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
Léo-Paul Géneau
gitlab-ce
Commits
70623cd4
Commit
70623cd4
authored
Mar 02, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix token issue - timing attack
parent
8cba0612
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/project.rb
app/models/project.rb
+2
-2
app/models/project_services/ci_service.rb
app/models/project_services/ci_service.rb
+1
-1
No files found.
app/models/project.rb
View file @
70623cd4
...
@@ -889,13 +889,13 @@ class Project < ActiveRecord::Base
...
@@ -889,13 +889,13 @@ class Project < ActiveRecord::Base
end
end
def
valid_runners_token?
token
def
valid_runners_token?
token
self
.
runners_token
&&
self
.
runners_token
==
token
self
.
runners_token
&&
ActiveSupport
::
SecurityUtils
.
secure_compare
(
token
,
self
.
runners_token
)
end
end
# TODO (ayufan): For now we use runners_token (backward compatibility)
# TODO (ayufan): For now we use runners_token (backward compatibility)
# In 8.4 every build will have its own individual token valid for time of build
# In 8.4 every build will have its own individual token valid for time of build
def
valid_build_token?
token
def
valid_build_token?
token
self
.
builds_enabled?
&&
self
.
runners_token
&&
self
.
runners_token
==
token
self
.
builds_enabled?
&&
self
.
runners_token
&&
ActiveSupport
::
SecurityUtils
.
secure_compare
(
token
,
self
.
runners_token
)
end
end
def
build_coverage_enabled?
def
build_coverage_enabled?
...
...
app/models/project_services/ci_service.rb
View file @
70623cd4
...
@@ -26,7 +26,7 @@ class CiService < Service
...
@@ -26,7 +26,7 @@ class CiService < Service
default_value_for
:category
,
'ci'
default_value_for
:category
,
'ci'
def
valid_token?
(
token
)
def
valid_token?
(
token
)
self
.
respond_to?
(
:token
)
&&
self
.
token
.
present?
&&
self
.
token
==
token
self
.
respond_to?
(
:token
)
&&
self
.
token
.
present?
&&
ActiveSupport
::
SecurityUtils
.
secure_compare
(
token
,
self
.
token
)
end
end
def
supported_events
def
supported_events
...
...
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