perimeter_x 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perimeter_x
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nitzan Goldfeder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-18 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '12.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '12.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: concurrent-ruby
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -104,14 +104,14 @@ dependencies:
104
104
  requirements:
105
105
  - - ">="
106
106
  - !ruby/object:Gem::Version
107
- version: 4.2.0
107
+ version: 5.2.4.3
108
108
  type: :runtime
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 4.2.0
114
+ version: 5.2.4.3
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: rspec
117
117
  requirement: !ruby/object:Gem::Requirement
@@ -178,19 +178,14 @@ files:
178
178
  - lib/perimeterx/internal/payload/perimeter_x_token_v1.rb
179
179
  - lib/perimeterx/internal/payload/perimeter_x_token_v3.rb
180
180
  - lib/perimeterx/internal/perimeter_x_context.rb
181
- - lib/perimeterx/internal/validators/perimeter_x_captcha_validator.rb
182
181
  - lib/perimeterx/internal/validators/perimeter_x_cookie_validator.rb
183
182
  - lib/perimeterx/internal/validators/perimeter_x_s2s_validator.rb
184
183
  - lib/perimeterx/utils/px_constants.rb
185
184
  - lib/perimeterx/utils/px_http_client.rb
186
185
  - lib/perimeterx/utils/px_logger.rb
187
186
  - lib/perimeterx/utils/px_template_factory.rb
188
- - lib/perimeterx/utils/templates/block.mobile.mustache
189
- - lib/perimeterx/utils/templates/block.mustache
190
- - lib/perimeterx/utils/templates/funcaptcha.mobile.mustache
191
- - lib/perimeterx/utils/templates/funcaptcha.mustache
192
- - lib/perimeterx/utils/templates/recaptcha.mobile.mustache
193
- - lib/perimeterx/utils/templates/recaptcha.mustache
187
+ - lib/perimeterx/utils/templates/block_template.mustache
188
+ - lib/perimeterx/utils/templates/ratelimit.mustache
194
189
  - lib/perimeterx/version.rb
195
190
  - perimeter_x.gemspec
196
191
  - readme.md
@@ -217,8 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
212
  - !ruby/object:Gem::Version
218
213
  version: '0'
219
214
  requirements: []
220
- rubyforge_project:
221
- rubygems_version: 2.6.11
215
+ rubygems_version: 3.0.3
222
216
  signing_key:
223
217
  specification_version: 4
224
218
  summary: PerimeterX ruby implmentation
@@ -1,65 +0,0 @@
1
- require 'perimeterx/internal/clients/perimeter_x_risk_client'
2
-
3
- module PxModule
4
- class PerimeterxCaptchaValidator < PerimeterxRiskClient
5
-
6
- def initialize(px_config, http_client)
7
- super(px_config, http_client)
8
- end
9
-
10
- def send_captcha_request(captcha, px_ctx)
11
-
12
- request_body = {
13
- :request => {
14
- :ip => px_ctx.context[:ip],
15
- :headers => format_headers(px_ctx),
16
- :uri => px_ctx.context[:uri],
17
- :captchaType => @px_config[:captcha_provider]
18
- },
19
- :additional => {
20
- :module_version => @px_config[:sdk_name]
21
- },
22
- :pxCaptcha => captcha,
23
- :hostname => px_ctx.context[:hostname]
24
- }
25
-
26
- # Prepare request
27
- headers = {
28
- "Authorization" => "Bearer #{@px_config[:auth_token]}" ,
29
- "Content-Type" => "application/json"
30
- }
31
-
32
- return @http_client.post(PxModule::API_CAPTCHA, request_body, headers, @px_config[:api_timeout], @px_config[:api_timeout_connection])
33
-
34
- end
35
-
36
- def verify(px_ctx)
37
- captcha_validated = false
38
- begin
39
- if !px_ctx.context.key?(:px_captcha)
40
- return captcha_validated, px_ctx
41
- end
42
- captcha = px_ctx.context[:px_captcha]
43
- if captcha.nil?
44
- return captcha_validated, px_ctx
45
- end
46
-
47
- response = send_captcha_request(captcha, px_ctx)
48
-
49
- if response.success?
50
- response_body = eval(response.body)
51
- if response_body[:status] == 0
52
- captcha_validated = true
53
- end
54
- end
55
-
56
- return captcha_validated, px_ctx
57
-
58
- rescue Exception => e
59
- @logger.error("PerimeterxCaptchaValidator[verify]: failed, returning false => #{e.message}")
60
- return captcha_validated, px_ctx
61
- end
62
- end
63
-
64
- end
65
- end
@@ -1,133 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Access to this page has been denied.</title>
7
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
8
- <style>
9
- html,body{
10
- margin: 0;
11
- padding: 0;
12
- font-family: 'Open Sans', sans-serif;
13
- color: #000;
14
- }
15
-
16
- a{
17
- color: #c5c5c5;
18
- text-decoration: none;
19
- }
20
-
21
- .container{
22
- align-items: center;
23
- display: flex;
24
- flex: 1;
25
- justify-content: space-between;
26
- flex-direction: column;
27
- height: 100%;
28
- }
29
-
30
- .container > div {
31
- width: 100%;
32
- display: flex;
33
- justify-content:center;
34
- }
35
-
36
- .container > div > div {
37
- display: flex;
38
- width: 80%;
39
- }
40
-
41
- .customer-logo-wrapper{
42
- padding-top: 2rem;
43
- flex-grow: 0;
44
- background-color: #fff;
45
- visibility: {{logoVisibility}};
46
- }
47
-
48
- .customer-logo{
49
- border-bottom: 1px solid #000;
50
- }
51
-
52
- .customer-logo > img{
53
- padding-bottom: 1rem;
54
- max-height: 50px;
55
- max-width: auto;
56
- }
57
-
58
- .page-title-wrapper{
59
- flex-grow: 2;
60
- }
61
- .page-title {
62
- flex-direction: column-reverse;
63
- }
64
-
65
- .content-wrapper{
66
- flex-grow: 5;
67
- }
68
- .content{
69
- flex-direction: column;
70
- }
71
-
72
- .page-footer-wrapper{
73
- align-items: center;
74
- flex-grow: 0.2;
75
- background-color: #000;
76
- color: #c5c5c5;
77
- font-size: 70%;
78
- }
79
- @media (min-width:768px){
80
- html,body{
81
- height: 100%;
82
- }
83
- }
84
- </style>
85
- <!-- Custom CSS -->
86
- {{# cssRef }}
87
- <link rel="stylesheet" type="text/css" href="{{cssRef}}" />
88
- {{/ cssRef }}
89
- </head>
90
- <body>
91
- <section class="container">
92
- <div class="customer-logo-wrapper">
93
- <div class="customer-logo">
94
- <img src="{{customLogo}}" alt="Logo"/>
95
- </div>
96
- </div>
97
- <div class="page-title-wrapper">
98
- <div class="page-title">
99
- <h1>Access to this page has been denied.</h1>
100
- </div>
101
- </div>
102
- <div class="content-wrapper">
103
- <div class="content">
104
- <p>
105
- You have been blocked because we believe you are using automation tools to browse the website.
106
- </p>
107
- <p>
108
- Please note that Javascript and Cookies must be enabled on your browser to access the website.
109
- </p>
110
- <p>
111
- If you think you have been blocked by mistake, please contact the website administrator with the reference ID below.
112
- </p>
113
- <p>
114
- Reference ID: #{{refId}}
115
- </p>
116
- </div>
117
- </div>
118
- <div class="page-footer-wrapper">
119
- <div class="page-footer">
120
- <p>
121
- Powered by
122
- <a href="https://www.perimeterx.com/whywasiblocked">PerimeterX</a>
123
- , Inc.
124
- </p>
125
- </div>
126
- </div>
127
- </section>
128
- <!-- Custom Script -->
129
- {{# jsRef }}
130
- <script src="{{jsRef}}"></script>
131
- {{/ jsRef }}
132
- </body>
133
- </html>
@@ -1,146 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Access to this page has been denied.</title>
7
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
8
- <style>
9
- html,body{
10
- margin: 0;
11
- padding: 0;
12
- font-family: 'Open Sans', sans-serif;
13
- color: #000;
14
- }
15
-
16
- a{
17
- color: #c5c5c5;
18
- text-decoration: none;
19
- }
20
-
21
- .container{
22
- align-items: center;
23
- display: flex;
24
- flex: 1;
25
- justify-content: space-between;
26
- flex-direction: column;
27
- height: 100%;
28
- }
29
-
30
- .container > div {
31
- width: 100%;
32
- display: flex;
33
- justify-content:center;
34
- }
35
-
36
- .container > div > div {
37
- display: flex;
38
- width: 80%;
39
- }
40
-
41
- .customer-logo-wrapper{
42
- padding-top: 2rem;
43
- flex-grow: 0;
44
- background-color: #fff;
45
- visibility: {{logoVisibility}};
46
- }
47
-
48
- .customer-logo{
49
- border-bottom: 1px solid #000;
50
- }
51
-
52
- .customer-logo > img{
53
- padding-bottom: 1rem;
54
- max-height: 50px;
55
- max-width: auto;
56
- }
57
-
58
- .page-title-wrapper{
59
- flex-grow: 2;
60
- }
61
- .page-title {
62
- flex-direction: column-reverse;
63
- }
64
-
65
- .content-wrapper{
66
- flex-grow: 5;
67
- }
68
- .content{
69
- flex-direction: column;
70
- }
71
-
72
- .page-footer-wrapper{
73
- align-items: center;
74
- flex-grow: 0.2;
75
- background-color: #000;
76
- color: #c5c5c5;
77
- font-size: 70%;
78
- }
79
- @media (min-width:768px){
80
- html,body{
81
- height: 100%;
82
- }
83
- }
84
- </style>
85
- <!-- Custom CSS -->
86
- {{# cssRef }}
87
- <link rel="stylesheet" type="text/css" href="{{cssRef}}" />
88
- {{/ cssRef }}
89
- </head>
90
- <body>
91
- <section class="container">
92
- <div class="customer-logo-wrapper">
93
- <div class="customer-logo">
94
- <img src="{{customLogo}}" alt="Logo"/>
95
- </div>
96
- </div>
97
- <div class="page-title-wrapper">
98
- <div class="page-title">
99
- <h1>Access to this page has been denied.</h1>
100
- </div>
101
- </div>
102
- <div class="content-wrapper">
103
- <div class="content">
104
- <p>
105
- You have been blocked because we believe you are using automation tools to browse the website.
106
- </p>
107
- <p>
108
- Please note that Javascript and Cookies must be enabled on your browser to access the website.
109
- </p>
110
- <p>
111
- If you think you have been blocked by mistake, please contact the website administrator with the reference ID below.
112
- </p>
113
- <p>
114
- Reference ID: #{{refId}}
115
- </p>
116
- </div>
117
- </div>
118
- <div class="page-footer-wrapper">
119
- <div class="page-footer">
120
- <p>
121
- Powered by
122
- <a href="https://www.perimeterx.com/whywasiblocked">PerimeterX</a>
123
- , Inc.
124
- </p>
125
- </div>
126
- </div>
127
- </section>
128
- <!-- Px -->
129
- <script>
130
- (
131
- function (){
132
- window._pxAppId = '{{appId}}';
133
- var p = document.getElementsByTagName("script")[0], s = document.createElement("script");
134
-
135
- s.async = 1;
136
- s.src = '//client.perimeterx.net/{{appId}}/main.min.js';
137
- p.parentNode.insertBefore(s, p);
138
- } ()
139
- );
140
- </script>
141
- <!-- Custom Script -->
142
- {{# jsRef }}
143
- <script src="{{jsRef}}"></script>
144
- {{/ jsRef }}
145
- </body>
146
- </html>
@@ -1,191 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Access to this page has been denied.</title>
7
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
8
- <style>
9
- html, body {
10
- margin: 0;
11
- padding: 0;
12
- font-family: 'Open Sans', sans-serif;
13
- color: #000;
14
- }
15
-
16
- a {
17
- color: #c5c5c5;
18
- text-decoration: none;
19
- }
20
-
21
- .container {
22
- align-items: center;
23
- display: flex;
24
- flex: 1;
25
- justify-content: space-between;
26
- flex-direction: column;
27
- height: 100%;
28
- }
29
-
30
- .container > div {
31
- width: 100%;
32
- display: flex;
33
- justify-content: center;
34
- }
35
-
36
- .container > div > div {
37
- display: flex;
38
- width: 80%;
39
- }
40
-
41
- .customer-logo-wrapper {
42
- padding-top: 2rem;
43
- flex-grow: 0;
44
- background-color: #fff;
45
- visibility: {{logoVisibility}};
46
- }
47
-
48
- .customer-logo {
49
- border-bottom: 1px solid #000;
50
- }
51
-
52
- .customer-logo > img {
53
- padding-bottom: 1rem;
54
- max-height: 50px;
55
- max-width: 100%;
56
- }
57
-
58
- .page-title-wrapper {
59
- flex-grow: 2;
60
- }
61
-
62
- .page-title {
63
- flex-direction: column-reverse;
64
- }
65
-
66
- .content-wrapper {
67
- flex-grow: 5;
68
- }
69
-
70
- .content {
71
- flex-direction: column;
72
- }
73
-
74
- .page-footer-wrapper {
75
- align-items: center;
76
- flex-grow: 0.2;
77
- background-color: #000;
78
- color: #c5c5c5;
79
- font-size: 70%;
80
- }
81
-
82
- @media (min-width: 768px) {
83
- html, body {
84
- height: 100%;
85
- }
86
- }
87
- </style>
88
- <!-- Custom CSS -->
89
- {{# cssRef }}
90
- <link rel="stylesheet" type="text/css" href="{{ . }}"/>
91
- {{/ cssRef }}
92
- <script src="https://funcaptcha.com/fc/api/?onload=loadFunCaptcha" async defer></script>
93
- </head>
94
-
95
- <body>
96
- <section class="container">
97
- <div class="customer-logo-wrapper">
98
- <div class="customer-logo">
99
- <img src="{{customLogo}}" alt="Logo"/>
100
- </div>
101
- </div>
102
- <div class="page-title-wrapper">
103
- <div class="page-title">
104
- <h1>Please verify you are a human</h1>
105
- </div>
106
- </div>
107
- <div class="content-wrapper">
108
- <div class="content">
109
- <p>
110
- Please click "Verify" to continue
111
- </p>
112
- <div id="CAPTCHA"></div>
113
- <p>
114
- Access to this page has been denied because we believe you are using automation tools to browse the
115
- website.
116
- </p>
117
- <p>
118
- This may happen as a result of the following:
119
- </p>
120
- <ul>
121
- <li>
122
- Javascript is disabled or blocked by an extension (ad blockers for example)
123
- </li>
124
- <li>
125
- Your browser does not support cookies
126
- </li>
127
- </ul>
128
- <p>
129
- Please make sure that Javascript and cookies are enabled on your browser and that you are not blocking
130
- them from loading.
131
- </p>
132
- <p>
133
- Reference ID: #{{refId}}
134
- </p>
135
- </div>
136
- </div>
137
- <div class="page-footer-wrapper">
138
- <div class="page-footer">
139
- <p>
140
- Powered by
141
- <a href="https://www.perimeterx.com/whywasiblocked">PerimeterX</a>
142
- , Inc.
143
- </p>
144
- </div>
145
- </div>
146
- </section>
147
- <!-- Px -->
148
- <script>
149
- (
150
- function () {
151
- window._pxAppId = '{{appId}}';
152
- var p = document.getElementsByTagName("script")[0], s = document.createElement("script");
153
-
154
- s.async = 1;
155
- s.src = '//client.perimeterx.net/{{appId}}/main.min.js';
156
- p.parentNode.insertBefore(s, p);
157
- }()
158
- );
159
- </script>
160
- <!-- Captcha -->
161
- <script>
162
-
163
- function loadFunCaptcha() {
164
- var vid = '{{vid}}';
165
- var uuid = '{{uuid}}';
166
-
167
- new FunCaptcha({
168
- public_key: "19E4B3B8-6CBE-35CC-4205-FC79ECDDA765",
169
- target_html: "CAPTCHA",
170
- callback: function () {
171
- var expiryUtc = new Date(Date.now() + 1000 * 10).toUTCString();
172
- var pxCaptcha = "_pxCaptcha=" + btoa(JSON.stringify({r: document.getElementById("FunCaptcha-Token").value, u: uuid, v: vid}));
173
- var cookieParts = [
174
- pxCaptcha,
175
- "; expires=",
176
- expiryUtc,
177
- "; path=/"
178
- ];
179
-
180
- document.cookie = cookieParts.join("");
181
- location.reload();
182
- }
183
- });
184
- }
185
- </script>
186
- <!-- Custom Script -->
187
- {{# jsRef }}
188
- <script src="{{ . }}"></script>
189
- {{/ jsRef }}
190
- </body>
191
- </html>