securenative 0.1.29 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +49 -0
  3. data/.github/workflows/publish.yml +60 -0
  4. data/.github/workflows/test.yml +48 -0
  5. data/.gitignore +40 -0
  6. data/.rakeTasks +7 -0
  7. data/.rspec +3 -0
  8. data/Gemfile +11 -0
  9. data/Gemfile.lock +270 -0
  10. data/LICENSE +21 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/lib/securenative/api_manager.rb +34 -0
  15. data/lib/securenative/client.rb +75 -0
  16. data/lib/securenative/client_token.rb +14 -0
  17. data/lib/securenative/config/configuration_builder.rb +29 -0
  18. data/lib/securenative/config/configuration_manager.rb +57 -0
  19. data/lib/securenative/context.rb +65 -0
  20. data/lib/securenative/device.rb +12 -0
  21. data/lib/securenative/enums/api_route.rb +10 -0
  22. data/lib/securenative/enums/risk_level.rb +11 -0
  23. data/lib/securenative/errors/config_error.rb +4 -0
  24. data/lib/securenative/errors/http_error.rb +4 -0
  25. data/lib/securenative/errors/invalid_options_error.rb +4 -0
  26. data/lib/securenative/errors/invalid_uri_error.rb +6 -0
  27. data/lib/securenative/errors/parse_error.rb +4 -0
  28. data/lib/securenative/errors/sdk_Illegal_state_error.rb +4 -0
  29. data/lib/securenative/errors/sdk_error.rb +4 -0
  30. data/lib/securenative/event_manager.rb +156 -0
  31. data/lib/securenative/event_options.rb +35 -0
  32. data/lib/securenative/event_types.rb +25 -0
  33. data/lib/securenative/failover_strategy.rb +8 -0
  34. data/lib/securenative/frameworks/hanami.rb +46 -0
  35. data/lib/securenative/frameworks/rails.rb +48 -0
  36. data/lib/securenative/frameworks/sinatra.rb +46 -0
  37. data/lib/securenative/http_client.rb +47 -0
  38. data/lib/securenative/http_response.rb +14 -0
  39. data/lib/securenative/options.rb +23 -0
  40. data/lib/securenative/request_context.rb +20 -0
  41. data/lib/securenative/request_options.rb +14 -0
  42. data/lib/securenative/sdk_event.rb +44 -0
  43. data/lib/securenative/user_traits.rb +15 -0
  44. data/lib/securenative/utils/date_utils.rb +13 -0
  45. data/lib/securenative/utils/encryption_utils.rb +48 -0
  46. data/lib/securenative/utils/ip_utils.rb +25 -0
  47. data/lib/securenative/utils/log.rb +46 -0
  48. data/lib/securenative/utils/request_utils.rb +84 -0
  49. data/lib/securenative/utils/signature_utils.rb +18 -0
  50. data/lib/securenative/utils/utils.rb +13 -0
  51. data/lib/securenative/utils/version_utils.rb +15 -0
  52. data/lib/securenative/verify_result.rb +18 -0
  53. data/lib/securenative/version.rb +5 -0
  54. data/securenative.gemspec +33 -0
  55. metadata +55 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e77f21b6db9cbf2d39a0e135b87e61a56fea0d8658c3d1dee6f122ea1837d7f
4
- data.tar.gz: 83cb07f6de364d69fc32b56150904f33c466c814fdc9ed826bee5882953257db
3
+ metadata.gz: 37b0720aab5431b97f1b2313e9e1e88d6a3ce712ba342575c86884a5d3ed9f7c
4
+ data.tar.gz: 74258ad8d16b072378bda84119bb65831cb1441f186fcb49a893308d777249d6
5
5
  SHA512:
6
- metadata.gz: d00171651e6ce7dfc04986e9a729665a8c1033ee140a4316dbc7f5449c2769a5773ed60cc1097e958aca35973b6450b0c95a74d6b2c3253e0d672acfa76413e1
7
- data.tar.gz: 4a4ecc7175d42feacd4b9e46279532f988c133b0d802d032468ebde2078a2b110291a27ebb0753e300c7f36dc1d3209906df027a84e1f65ea6fec7408a637a0f
6
+ metadata.gz: bb0ce8d22b7b1ce832c49a3690856312b298cc8cc55046ebe966cf7ddb410079ae5d13cc93a4fd25b4a111fd971ec7be9782f92b5716103bba2842ce72607d8e
7
+ data.tar.gz: 17dece79e7f8dabed7fd270d1da3d7cc50f94691bfed65324e45b961ac8bd0a33371d4390f941cb3fa460e24a72fb86487a466ceaff91ec6d23595fc6cb6b9a8
@@ -0,0 +1,49 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ - dev
8
+ - dev-*
9
+
10
+ jobs:
11
+ test:
12
+ name: CI
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ matrix:
16
+ os: [ubuntu-latest]
17
+ steps:
18
+ - uses: actions/checkout@v1
19
+ - uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: 2.6.x
22
+ - name: Install dependencies
23
+ run: |
24
+ gem install bundler
25
+ bundler install
26
+ - name: Run tests
27
+ run: bundle exec rspec spec --pattern **/spec_*.rb
28
+
29
+ - name: Notify slack success
30
+ if: success()
31
+ env:
32
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
33
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
34
+ with:
35
+ message_id: ${{ steps.slack.outputs.message_id }}
36
+ channel: github-actions
37
+ status: SUCCESS
38
+ color: good
39
+
40
+ - name: Notify slack fail
41
+ if: failure()
42
+ env:
43
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
44
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
45
+ with:
46
+ message_id: ${{ steps.slack.outputs.message_id }}
47
+ channel: github-actions
48
+ status: FAILED
49
+ color: danger
@@ -0,0 +1,60 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ deploy:
9
+ name: Publish
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Notify slack success
13
+ if: success()
14
+ id: slack # IMPORTANT: reference this step ID value in future Slack steps
15
+ env:
16
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
17
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
18
+ with:
19
+ channel: github-actions
20
+ status: STARTING
21
+ color: warning
22
+
23
+ - uses: actions/checkout@v2
24
+ - name: Set up Ruby 2.6
25
+ uses: actions/setup-ruby@v1
26
+ with:
27
+ version: 2.6.x
28
+
29
+ - name: Publish to RubyGems
30
+ run: |
31
+ mkdir -p $HOME/.gem
32
+ touch $HOME/.gem/credentials
33
+ chmod 0600 $HOME/.gem/credentials
34
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
35
+ gem build *.gemspec
36
+ gem push *.gem
37
+ env:
38
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
39
+
40
+ - name: Notify slack success
41
+ if: success()
42
+ env:
43
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
44
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
45
+ with:
46
+ message_id: ${{ steps.slack.outputs.message_id }}
47
+ channel: github-actions
48
+ status: SUCCESS
49
+ color: good
50
+
51
+ - name: Notify slack fail
52
+ if: failure()
53
+ env:
54
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
55
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
56
+ with:
57
+ message_id: ${{ steps.slack.outputs.message_id }}
58
+ channel: github-actions
59
+ status: FAILED
60
+ color: danger
@@ -0,0 +1,48 @@
1
+ name: Testing
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ - '!master'
8
+
9
+ jobs:
10
+ test:
11
+ name: Testing
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ os: [ubuntu-latest]
16
+ steps:
17
+ - uses: actions/checkout@v1
18
+ - uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6.x
21
+ - name: Install dependencies
22
+ run: |
23
+ gem install bundler
24
+ bundler install
25
+ - name: Run tests
26
+ run: bundle exec rspec spec --pattern **/spec_*.rb
27
+
28
+ - name: Notify slack success
29
+ if: success()
30
+ env:
31
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
32
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
33
+ with:
34
+ message_id: ${{ steps.slack.outputs.message_id }}
35
+ channel: github-actions
36
+ status: SUCCESS
37
+ color: good
38
+
39
+ - name: Notify slack fail
40
+ if: failure()
41
+ env:
42
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
43
+ uses: voxmedia/github-action-slack-notify-build@v1.1.1
44
+ with:
45
+ message_id: ${{ steps.slack.outputs.message_id }}
46
+ channel: github-actions
47
+ status: FAILED
48
+ color: danger
@@ -0,0 +1,40 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+ .idea
13
+ *.iml
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ # Ignore Byebug command history file.
18
+ .byebug_history
19
+
20
+ ## Documentation cache and generated files:
21
+ /.yardoc/
22
+ /_yardoc/
23
+ /doc/
24
+ /rdoc/
25
+
26
+ ## Environment normalization:
27
+ /.bundle/
28
+ /vendor/bundle
29
+ /lib/bundler/man/
30
+
31
+ # for a library or gem, you might want to ignore these files since the code is
32
+ # intended to run in multiple environments; otherwise, check them in:
33
+ # Gemfile.lock
34
+ # .ruby-version
35
+ # .ruby-gemset
36
+
37
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
38
+ .rvmrc
39
+ .DS_Store
40
+ .rspec_status
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+ gem "rspec"
5
+ gem "rake"
6
+ gem "simplecov", :require => false, :group => :test
7
+ gem "codecov", :require => false, :group => :test
8
+ gem "webmock", :require => false, :group => :test
9
+ gem "rails", :require => false, :group => :test
10
+ gem "hanami", :require => false, :group => :test
11
+ gem "sinatra", :require => false, :group => :test
@@ -0,0 +1,270 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ securenative (0.1.30)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (6.0.3.3)
10
+ actionpack (= 6.0.3.3)
11
+ nio4r (~> 2.0)
12
+ websocket-driver (>= 0.6.1)
13
+ actionmailbox (6.0.3.3)
14
+ actionpack (= 6.0.3.3)
15
+ activejob (= 6.0.3.3)
16
+ activerecord (= 6.0.3.3)
17
+ activestorage (= 6.0.3.3)
18
+ activesupport (= 6.0.3.3)
19
+ mail (>= 2.7.1)
20
+ actionmailer (6.0.3.3)
21
+ actionpack (= 6.0.3.3)
22
+ actionview (= 6.0.3.3)
23
+ activejob (= 6.0.3.3)
24
+ mail (~> 2.5, >= 2.5.4)
25
+ rails-dom-testing (~> 2.0)
26
+ actionpack (6.0.3.3)
27
+ actionview (= 6.0.3.3)
28
+ activesupport (= 6.0.3.3)
29
+ rack (~> 2.0, >= 2.0.8)
30
+ rack-test (>= 0.6.3)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
33
+ actiontext (6.0.3.3)
34
+ actionpack (= 6.0.3.3)
35
+ activerecord (= 6.0.3.3)
36
+ activestorage (= 6.0.3.3)
37
+ activesupport (= 6.0.3.3)
38
+ nokogiri (>= 1.8.5)
39
+ actionview (6.0.3.3)
40
+ activesupport (= 6.0.3.3)
41
+ builder (~> 3.1)
42
+ erubi (~> 1.4)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
45
+ activejob (6.0.3.3)
46
+ activesupport (= 6.0.3.3)
47
+ globalid (>= 0.3.6)
48
+ activemodel (6.0.3.3)
49
+ activesupport (= 6.0.3.3)
50
+ activerecord (6.0.3.3)
51
+ activemodel (= 6.0.3.3)
52
+ activesupport (= 6.0.3.3)
53
+ activestorage (6.0.3.3)
54
+ actionpack (= 6.0.3.3)
55
+ activejob (= 6.0.3.3)
56
+ activerecord (= 6.0.3.3)
57
+ marcel (~> 0.3.1)
58
+ activesupport (6.0.3.3)
59
+ concurrent-ruby (~> 1.0, >= 1.0.2)
60
+ i18n (>= 0.7, < 2)
61
+ minitest (~> 5.1)
62
+ tzinfo (~> 1.1)
63
+ zeitwerk (~> 2.2, >= 2.2.2)
64
+ addressable (2.7.0)
65
+ public_suffix (>= 2.0.2, < 5.0)
66
+ builder (3.2.4)
67
+ codecov (0.2.11)
68
+ json
69
+ simplecov
70
+ concurrent-ruby (1.1.7)
71
+ crack (0.4.4)
72
+ crass (1.0.6)
73
+ diff-lcs (1.4.4)
74
+ docile (1.3.2)
75
+ dry-configurable (0.11.6)
76
+ concurrent-ruby (~> 1.0)
77
+ dry-core (~> 0.4, >= 0.4.7)
78
+ dry-equalizer (~> 0.2)
79
+ dry-container (0.7.2)
80
+ concurrent-ruby (~> 1.0)
81
+ dry-configurable (~> 0.1, >= 0.1.3)
82
+ dry-core (0.4.9)
83
+ concurrent-ruby (~> 1.0)
84
+ dry-equalizer (0.3.0)
85
+ dry-logic (0.4.2)
86
+ dry-container (~> 0.2, >= 0.2.6)
87
+ dry-core (~> 0.2)
88
+ dry-equalizer (~> 0.2)
89
+ dry-types (0.12.3)
90
+ concurrent-ruby (~> 1.0)
91
+ dry-configurable (~> 0.1)
92
+ dry-container (~> 0.3)
93
+ dry-core (~> 0.2, >= 0.2.1)
94
+ dry-equalizer (~> 0.2)
95
+ dry-logic (~> 0.4, >= 0.4.2)
96
+ inflecto (~> 0.0.0, >= 0.0.2)
97
+ dry-validation (0.11.2)
98
+ concurrent-ruby (~> 1.0)
99
+ dry-configurable (~> 0.1, >= 0.1.3)
100
+ dry-core (~> 0.2, >= 0.2.1)
101
+ dry-equalizer (~> 0.2)
102
+ dry-logic (~> 0.4.2)
103
+ dry-types (~> 0.12.0)
104
+ erubi (1.9.0)
105
+ globalid (0.4.2)
106
+ activesupport (>= 4.2.0)
107
+ hanami (1.3.3)
108
+ bundler (>= 1.6, < 3)
109
+ concurrent-ruby (~> 1.0)
110
+ hanami-assets (~> 1.3)
111
+ hanami-cli (~> 0.3)
112
+ hanami-controller (~> 1.3)
113
+ hanami-helpers (~> 1.3)
114
+ hanami-mailer (~> 1.3)
115
+ hanami-router (~> 1.3)
116
+ hanami-utils (~> 1.3)
117
+ hanami-validations (>= 1.3, < 3)
118
+ hanami-view (~> 1.3)
119
+ hanami-assets (1.3.4)
120
+ hanami-helpers (~> 1.3)
121
+ hanami-utils (~> 1.3)
122
+ tilt (~> 2.0, >= 2.0.2)
123
+ hanami-cli (0.3.1)
124
+ concurrent-ruby (~> 1.0)
125
+ hanami-utils (~> 1.3)
126
+ hanami-controller (1.3.3)
127
+ hanami-utils (~> 1.3)
128
+ rack (~> 2.0)
129
+ hanami-helpers (1.3.3)
130
+ hanami-utils (~> 1.3)
131
+ hanami-mailer (1.3.2)
132
+ hanami-utils (~> 1.3)
133
+ mail (~> 2.6)
134
+ tilt (~> 2.0, >= 2.0.1)
135
+ hanami-router (1.3.2)
136
+ hanami-utils (~> 1.3)
137
+ http_router (= 0.11.2)
138
+ rack (~> 2.0)
139
+ hanami-utils (1.3.6)
140
+ concurrent-ruby (~> 1.0)
141
+ transproc (~> 1.0)
142
+ hanami-validations (1.3.6)
143
+ dry-logic (~> 0.4.2, < 0.5)
144
+ dry-validation (~> 0.11, < 0.12)
145
+ hanami-utils (~> 1.3)
146
+ hanami-view (1.3.3)
147
+ hanami-utils (~> 1.3)
148
+ tilt (~> 2.0, >= 2.0.1)
149
+ hashdiff (1.0.1)
150
+ http_router (0.11.2)
151
+ rack (>= 1.0.0)
152
+ url_mount (~> 0.2.1)
153
+ i18n (1.8.5)
154
+ concurrent-ruby (~> 1.0)
155
+ inflecto (0.0.2)
156
+ json (2.3.1)
157
+ loofah (2.7.0)
158
+ crass (~> 1.0.2)
159
+ nokogiri (>= 1.5.9)
160
+ mail (2.7.1)
161
+ mini_mime (>= 0.1.1)
162
+ marcel (0.3.3)
163
+ mimemagic (~> 0.3.2)
164
+ method_source (1.0.0)
165
+ mimemagic (0.3.5)
166
+ mini_mime (1.0.2)
167
+ mini_portile2 (2.4.0)
168
+ minitest (5.14.2)
169
+ mustermann (1.1.1)
170
+ ruby2_keywords (~> 0.0.1)
171
+ nio4r (2.5.4)
172
+ nokogiri (1.10.10)
173
+ mini_portile2 (~> 2.4.0)
174
+ public_suffix (4.0.6)
175
+ rack (2.2.3)
176
+ rack-protection (2.1.0)
177
+ rack
178
+ rack-test (1.1.0)
179
+ rack (>= 1.0, < 3)
180
+ rails (6.0.3.3)
181
+ actioncable (= 6.0.3.3)
182
+ actionmailbox (= 6.0.3.3)
183
+ actionmailer (= 6.0.3.3)
184
+ actionpack (= 6.0.3.3)
185
+ actiontext (= 6.0.3.3)
186
+ actionview (= 6.0.3.3)
187
+ activejob (= 6.0.3.3)
188
+ activemodel (= 6.0.3.3)
189
+ activerecord (= 6.0.3.3)
190
+ activestorage (= 6.0.3.3)
191
+ activesupport (= 6.0.3.3)
192
+ bundler (>= 1.3.0)
193
+ railties (= 6.0.3.3)
194
+ sprockets-rails (>= 2.0.0)
195
+ rails-dom-testing (2.0.3)
196
+ activesupport (>= 4.2.0)
197
+ nokogiri (>= 1.6)
198
+ rails-html-sanitizer (1.3.0)
199
+ loofah (~> 2.3)
200
+ railties (6.0.3.3)
201
+ actionpack (= 6.0.3.3)
202
+ activesupport (= 6.0.3.3)
203
+ method_source
204
+ rake (>= 0.8.7)
205
+ thor (>= 0.20.3, < 2.0)
206
+ rake (13.0.1)
207
+ rspec (3.9.0)
208
+ rspec-core (~> 3.9.0)
209
+ rspec-expectations (~> 3.9.0)
210
+ rspec-mocks (~> 3.9.0)
211
+ rspec-core (3.9.3)
212
+ rspec-support (~> 3.9.3)
213
+ rspec-expectations (3.9.2)
214
+ diff-lcs (>= 1.2.0, < 2.0)
215
+ rspec-support (~> 3.9.0)
216
+ rspec-mocks (3.9.1)
217
+ diff-lcs (>= 1.2.0, < 2.0)
218
+ rspec-support (~> 3.9.0)
219
+ rspec-support (3.9.3)
220
+ ruby2_keywords (0.0.2)
221
+ simplecov (0.19.0)
222
+ docile (~> 1.1)
223
+ simplecov-html (~> 0.11)
224
+ simplecov-html (0.12.3)
225
+ sinatra (2.1.0)
226
+ mustermann (~> 1.0)
227
+ rack (~> 2.2)
228
+ rack-protection (= 2.1.0)
229
+ tilt (~> 2.0)
230
+ sprockets (4.0.2)
231
+ concurrent-ruby (~> 1.0)
232
+ rack (> 1, < 3)
233
+ sprockets-rails (3.2.2)
234
+ actionpack (>= 4.0)
235
+ activesupport (>= 4.0)
236
+ sprockets (>= 3.0.0)
237
+ thor (1.0.1)
238
+ thread_safe (0.3.6)
239
+ tilt (2.0.10)
240
+ transproc (1.1.1)
241
+ tzinfo (1.2.7)
242
+ thread_safe (~> 0.1)
243
+ url_mount (0.2.1)
244
+ rack
245
+ webmock (3.9.1)
246
+ addressable (>= 2.3.6)
247
+ crack (>= 0.3.2)
248
+ hashdiff (>= 0.4.0, < 2.0.0)
249
+ websocket-driver (0.7.3)
250
+ websocket-extensions (>= 0.1.0)
251
+ websocket-extensions (0.1.5)
252
+ zeitwerk (2.4.0)
253
+
254
+ PLATFORMS
255
+ ruby
256
+
257
+ DEPENDENCIES
258
+ bundler (~> 2.0)
259
+ codecov
260
+ hanami
261
+ rails
262
+ rake
263
+ rspec
264
+ securenative!
265
+ simplecov
266
+ sinatra
267
+ webmock
268
+
269
+ BUNDLED WITH
270
+ 2.1.4