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
8038cdac
Commit
8038cdac
authored
Jun 21, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-geo-fix-iat' into 'master'
Fix broken time sync leeway with Geo See merge request !2208
parents
9fd5c408
e07793bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
changelogs/unreleased-ee/sh-geo-fix-iat.yml
changelogs/unreleased-ee/sh-geo-fix-iat.yml
+4
-0
lib/gitlab/geo/jwt_request_decoder.rb
lib/gitlab/geo/jwt_request_decoder.rb
+1
-1
spec/lib/gitlab/geo/jwt_request_decoder_spec.rb
spec/lib/gitlab/geo/jwt_request_decoder_spec.rb
+8
-2
No files found.
changelogs/unreleased-ee/sh-geo-fix-iat.yml
0 → 100644
View file @
8038cdac
---
title
:
Fix broken time sync leeway with Geo
merge_request
:
author
:
lib/gitlab/geo/jwt_request_decoder.rb
View file @
8038cdac
...
@@ -41,7 +41,7 @@ module Gitlab
...
@@ -41,7 +41,7 @@ module Gitlab
encoded_message
,
encoded_message
,
secret
,
secret
,
true
,
true
,
{
iat_
leeway:
IAT_LEEWAY
,
verify_iat:
true
,
algorithm:
'HS256'
}
{
leeway:
IAT_LEEWAY
,
verify_iat:
true
,
algorithm:
'HS256'
}
)
)
message
=
decoded
.
first
message
=
decoded
.
first
...
...
spec/lib/gitlab/geo/jwt_request_decoder_spec.rb
View file @
8038cdac
...
@@ -27,10 +27,16 @@ describe Gitlab::Geo::JwtRequestDecoder do
...
@@ -27,10 +27,16 @@ describe Gitlab::Geo::JwtRequestDecoder do
expect
(
described_class
.
new
(
data
).
decode
).
to
be_nil
expect
(
described_class
.
new
(
data
).
decode
).
to
be_nil
end
end
it
'successfully decodes when clocks are off by IAT leeway'
do
subject
Timecop
.
travel
(
30
.
seconds
.
ago
)
{
expect
(
subject
.
decode
).
to
eq
(
data
)
}
end
it
'returns nil when clocks are not in sync'
do
it
'returns nil when clocks are not in sync'
do
allow
(
JWT
).
to
receive
(
:decode
).
and_raise
(
JWT
::
InvalidIatError
)
subject
expect
(
subject
.
decode
).
to
be_nil
Timecop
.
travel
(
2
.
minutes
.
ago
)
{
expect
(
subject
.
decode
).
to
be_nil
}
end
end
it
'raises invalid decryption key error'
do
it
'raises invalid decryption key error'
do
...
...
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