perimeter_x 1.0.4 → 1.0.5.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -3
  3. data/Dockerfile +2 -4
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +2 -44
  6. data/LICENSE.txt +12 -9
  7. data/Rakefile +2 -9
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/changelog.md +0 -12
  11. data/examples/home_controller.rb.dist +23 -0
  12. data/lib/perimeter_x.rb +33 -109
  13. data/lib/perimeterx/configuration.rb +17 -24
  14. data/lib/perimeterx/internal/perimeter_x_context.rb +57 -66
  15. data/lib/perimeterx/internal/perimeter_x_risk_client.rb +29 -0
  16. data/lib/perimeterx/internal/perimeter_x_s2s_validator.rb +68 -0
  17. data/lib/perimeterx/utils/px_http_client.rb +26 -47
  18. data/lib/perimeterx/utils/px_logger.rb +6 -12
  19. data/lib/perimeterx/version.rb +2 -2
  20. data/perimeter_x.gemspec +1 -6
  21. data/readme.md +34 -216
  22. metadata +10 -89
  23. data/examples/app/controllers/home_controller.rb +0 -9
  24. data/examples/app/views/home/index.html.erb.dist +0 -20
  25. data/examples/config/initializers/perimeterx.rb.dist +0 -8
  26. data/lib/perimeterx/internal/clients/perimeter_x_activity_client.rb +0 -92
  27. data/lib/perimeterx/internal/clients/perimeter_x_risk_client.rb +0 -28
  28. data/lib/perimeterx/internal/exceptions/px_cookie_decryption_exception.rb +0 -5
  29. data/lib/perimeterx/internal/perimeter_x_cookie.rb +0 -140
  30. data/lib/perimeterx/internal/perimeter_x_cookie_v1.rb +0 -42
  31. data/lib/perimeterx/internal/perimeter_x_cookie_v3.rb +0 -37
  32. data/lib/perimeterx/internal/validators/perimeter_x_captcha_validator.rb +0 -65
  33. data/lib/perimeterx/internal/validators/perimeter_x_cookie_validator.rb +0 -70
  34. data/lib/perimeterx/internal/validators/perimeter_x_s2s_validator.rb +0 -114
  35. data/lib/perimeterx/utils/px_constants.rb +0 -44
  36. data/lib/perimeterx/utils/px_template_factory.rb +0 -31
  37. data/lib/perimeterx/utils/templates/block.mustache +0 -146
  38. data/lib/perimeterx/utils/templates/captcha.mustache +0 -185
  39. /data/examples/{config/routes.rb → routes.rb} +0 -0
@@ -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">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,185 +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
-
80
- @media (min-width:768px){
81
- html,body{
82
- height: 100%;
83
- }
84
- }
85
- </style>
86
- <!-- Custom CSS -->
87
- {{#cssRef}}
88
- <link rel="stylesheet" type="text/css" href="{{cssRef}}" />
89
- {{/cssRef}}
90
- <script src="https://www.google.com/recaptcha/api.js" async defer></script>
91
- </head>
92
-
93
- <body>
94
- <section class="container">
95
- <div class="customer-logo-wrapper">
96
- <div class="customer-logo">
97
- <img src="{{customLogo}}" alt="Logo"/>
98
- </div>
99
- </div>
100
- <div class="page-title-wrapper">
101
- <div class="page-title">
102
- <h1>Please verify you are a human</h1>
103
- </div>
104
- </div>
105
- <div class="content-wrapper">
106
- <div class="content">
107
- <p>
108
- Please click "I am not a robot" to continue
109
- </p>
110
- <div class="g-recaptcha" data-sitekey="6Lcj-R8TAAAAABs3FrRPuQhLMbp5QrHsHufzLf7b" data-callback="handleCaptcha" data-theme="dark">
111
- </div>
112
- <p>
113
- Access to this page has been denied because we believe you are using automation tools to browse the website.
114
- </p>
115
- <p>
116
- This may happen as a result of the following:
117
- </p>
118
- <ul>
119
- <li>
120
- Javascript is disabled or blocked by an extension (ad blockers for example)
121
- </li>
122
- <li>
123
- Your browser does not support cookies
124
- </li>
125
- </ul>
126
- <p>
127
- Please make sure that Javascript and cookies are enabled on your browser and that you are not blocking them from loading.
128
- </p>
129
- <p>
130
- Reference ID: #{{refId}}
131
- </p>
132
- </div>
133
- </div>
134
- <div class="page-footer-wrapper">
135
- <div class="page-footer">
136
- <p>
137
- Powered by
138
- <a href="https://www.perimeterx.com">PerimeterX</a>
139
- , Inc.
140
- </p>
141
- </div>
142
- </div>
143
- </section>
144
- <!-- Px -->
145
- <script>
146
- (
147
- function (){
148
- window._pxAppId = '{{appId}}';
149
- var p = document.getElementsByTagName("script")[0], s = document.createElement("script");
150
-
151
- s.async = 1;
152
- s.src = '//client.perimeterx.net/{{appId}}/main.min.js';
153
- p.parentNode.insertBefore(s, p);
154
- } ()
155
- );
156
- </script>
157
- <!-- Captcha -->
158
- <script>
159
- window.px_vid = '{{vid}}';
160
- function handleCaptcha(response){
161
- var vid = '{{vid}}';
162
- var uuid = '{{uuid}}';
163
- var name = "_pxCaptcha";
164
-
165
- var expiryUtc = new Date(Date.now()+1000*10).toUTCString();
166
-
167
- var cookieParts = [
168
- name,
169
- "=",
170
- response+":"+vid+":"+uuid,
171
- "; expires=",
172
- expiryUtc,
173
- "; path=/"
174
- ];
175
-
176
- document.cookie = cookieParts.join("");
177
- location.reload();
178
- }
179
- </script>
180
- <!-- Custom Script -->
181
- {{#jsRef}}
182
- <script src="{{jsRef}}"></script>
183
- {{/jsRef}}
184
- </body>
185
- </html>
File without changes