-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from PerimeterX/dev
Releasing version 1.3.0
- Loading branch information
Showing
30 changed files
with
824 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.rbc | ||
*.iml | ||
capybara-*.html | ||
.rspec | ||
/log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: ruby | ||
rvm: | ||
- 2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...imeterx/internal/perimeter_x_cookie_v1.rb → ...internal/payload/perimeter_x_cookie_v1.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...imeterx/internal/perimeter_x_cookie_v3.rb → ...internal/payload/perimeter_x_cookie_v3.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module PxModule | ||
class PerimeterxTokenV1 < PerimeterxPayload | ||
|
||
attr_accessor :px_config, :px_ctx | ||
|
||
def initialize(px_config, px_ctx) | ||
super(px_config) | ||
@px_ctx = px_ctx | ||
@px_cookie = px_ctx.get_px_cookie | ||
@cookie_secret = px_config[:cookie_key] | ||
@logger.debug('PerimeterxTokenV1[initialize]') | ||
end | ||
|
||
def cookie_score | ||
return @decoded_cookie[:s][:b] | ||
end | ||
|
||
def cookie_hmac | ||
return @decoded_cookie[:h] | ||
end | ||
|
||
def valid_format?(cookie) | ||
return cookie.key?(:t) && cookie.key?(:s) && cookie[:s].key?(:b) && cookie.key?(:s) && cookie.key?(:v) && cookie.key?(:h) | ||
end | ||
|
||
def cookie_block_action | ||
return 'c' | ||
end | ||
|
||
def secured? | ||
hmac_str = "#{cookie_time}#{@decoded_cookie[:s][:a]}#{cookie_score}#{cookie_uuid}#{cookie_vid}" | ||
|
||
return hmac_valid?(hmac_str, cookie_hmac) | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module PxModule | ||
class PerimeterxTokenV3 < PerimeterxPayload | ||
|
||
attr_accessor :px_config, :px_ctx, :cookie_hash | ||
|
||
def initialize(px_config, px_ctx) | ||
super(px_config) | ||
hash, cookie = px_ctx.get_px_cookie().split(':', 2) | ||
@px_cookie = cookie | ||
@cookie_hash = hash | ||
@px_ctx = px_ctx | ||
@cookie_secret = px_config[:cookie_key] | ||
@logger.debug('PerimeterxTokenV3[initialize]') | ||
end | ||
|
||
def cookie_score | ||
return @decoded_cookie[:s] | ||
end | ||
|
||
def cookie_hmac | ||
return @cookie_hash | ||
end | ||
|
||
def valid_format?(cookie) | ||
return cookie.key?(:t) && cookie.key?(:s) && cookie.key?(:u) && cookie.key?(:u) && cookie.key?(:a) | ||
end | ||
|
||
def cookie_block_action | ||
@decoded_cookie[:a] | ||
end | ||
|
||
def secured? | ||
return hmac_valid?(@px_cookie, cookie_hmac) | ||
end | ||
end | ||
end |
Oops, something went wrong.