lenjador 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d2c05e9a5e41ddcfb2274063ae0b5d75387a5657e9effb6440e1d0ac9aa10e2
4
- data.tar.gz: f5e80262d179b4320f7db1e2f1998b9a6160c57868a14dbf3d74d73420289e2a
3
+ metadata.gz: 26f40334235faaeecd2b8f1e960641c98d7926be963cb485d57b5db7476abd9d
4
+ data.tar.gz: 9417049506b81464afd16c050a72c0c9af8e4078c5b361aededb74c2fca2c117
5
5
  SHA512:
6
- metadata.gz: a051c066866a827ca68e7b207a5f37f73ce7eb73bc1a33afca8523f2b51d2c44f47bd3d7d87d07ac2e7498f03298ac5120d314718c906043cf17b5ed913c6711
7
- data.tar.gz: 212cc99147c9d533b82fb92594259ebf65eb49e9cf61e006d8460b874dec01e2cba6b4f15e898e3b199186c569fbcb488923e26ba05dc76a925292a9d1501f0f
6
+ metadata.gz: 1005262582ae1ec5bc03445af4346f6011a5e32c553cdd86469dbcf9d380d8114a995f53649bd398d09674e145e023821e6717b70914f04bf5f96b5ec5429b00
7
+ data.tar.gz: ed3a7f3f6afc47cc7e431217c1c103bd290d3a9bd51f2e8bc0a94e5fd8fa6cf8d6de538a89a4eb1834d5c938987aa0fbe2be23530b7e48761936a6e6e60c5a85
@@ -0,0 +1,20 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ with:
14
+ fetch-depth: 2
15
+ - name: Release Gem
16
+ uses: discourse/publish-rubygems-action@ec5415e2cc3509a5cc8c4eef9499cf3fb05f8391
17
+ env:
18
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
20
+ RELEASE_COMMAND: rake release
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,9 @@
1
+ # Contributing to lenjador
2
+
3
+ We currently do not accept any contributions from external sources.
4
+
5
+ The code is still open source and if you wish to add any changes, feel free to fork it and add changes to your fork.
6
+
7
+ Issues for any security-related bugs found are still welcome, but we offer no guarantees on whether or when they will be acted upon.
8
+
9
+ For any exceptional cases, please contact us at open-source@glia.com.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lenjador (2.2.1)
4
+ lenjador (2.2.2)
5
5
  lru_redux
6
6
  oj (~> 3.6)
7
7
 
data/README.md CHANGED
@@ -119,3 +119,7 @@ Logger output:
119
119
  ```
120
120
  Received request {password: "********", "info": {"phone": "+12055555555"}, "addresses": [{"host": "example.com","path": "****"}]}
121
121
  ```
122
+
123
+ ## Releasing a new version
124
+
125
+ A new version is created when a change is merged into the master branch that changes the version number in `lenjador.gemspec`. A Github Action will create a tag for the version and push the `.gem` file to [rubygems.org](https://rubygems.org)
data/lenjador.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = 'lenjador'
8
- gem.version = '2.2.1'
8
+ gem.version = '2.2.2'
9
9
  gem.authors = ['Salemove']
10
10
  gem.email = ['support@salemove.com']
11
11
  gem.description = "It's lenjadoric"
@@ -21,8 +21,11 @@ class Lenjador
21
21
  when Array
22
22
  process_array(data, pointer)
23
23
 
24
- else
24
+ when String, Numeric, Symbol, Date, Time, TrueClass, FalseClass, NilClass
25
25
  data
26
+
27
+ else
28
+ MASKED_VALUE
26
29
  end
27
30
  end
28
31
 
@@ -18,8 +18,11 @@ class Lenjador
18
18
  when Array
19
19
  process_array(data, pointer)
20
20
 
21
- else
21
+ when String, Numeric, Symbol, Date, Time, TrueClass, FalseClass, NilClass
22
22
  data
23
+
24
+ else
25
+ nil
23
26
  end
24
27
  end
25
28
 
@@ -147,10 +147,105 @@ RSpec.describe Lenjador::Preprocessors::Whitelist do
147
147
  end
148
148
 
149
149
  context 'when boolean present' do
150
- let(:data) { {bool: true} }
150
+ let(:pointers) { ['/bool'] }
151
+ let(:data) do
152
+ {
153
+ bool: true,
154
+ bool2: true
155
+ }
156
+ end
157
+
158
+ it 'masks only if not in whitelist' do
159
+ expect(processed_data).to eq({
160
+ bool: true,
161
+ bool2: '*****'
162
+ })
163
+ end
164
+ end
165
+
166
+ context 'when nil present' do
167
+ let(:pointers) { ['/nil'] }
168
+ let(:data) do
169
+ {
170
+ nil: nil,
171
+ nil2: nil
172
+ }
173
+ end
151
174
 
152
- it 'masks it with asteriks' do
153
- expect(processed_data).to eq(bool: '*****')
175
+ it 'masks only if not in whitelist' do
176
+ expect(processed_data).to eq({
177
+ nil: nil,
178
+ nil2: '*****'
179
+ })
180
+ end
181
+ end
182
+
183
+ context 'when numbers present' do
184
+ let(:data) do
185
+ {
186
+ integer: 1,
187
+ float: 2.03,
188
+ integer2: 3,
189
+ float2: 3.34324
190
+ }
191
+ end
192
+ let(:pointers) { ['/integer', '/float'] }
193
+
194
+ it 'masks only if not in whitelist' do
195
+ expect(processed_data).to eq({
196
+ integer: 1,
197
+ float: 2.03,
198
+ integer2: '*****',
199
+ float2: '*****'
200
+ })
201
+ end
202
+ end
203
+
204
+ context 'when symbol present' do
205
+ let(:data) do
206
+ {
207
+ symbol1: :symbol1,
208
+ symbol2: :symbol2
209
+ }
210
+ end
211
+ let(:pointers) { ['/symbol1'] }
212
+
213
+ it 'masks only if not in whitelist' do
214
+ expect(processed_data).to eq({
215
+ symbol1: :symbol1,
216
+ symbol2: '*****'
217
+ })
218
+ end
219
+ end
220
+
221
+ context 'when date time present' do
222
+ let(:data) do
223
+ {
224
+ date: Date.new(2023, 12, 12),
225
+ time: Time.new(2023, 12, 13),
226
+ datetime: DateTime.new(2023, 12, 14)
227
+ }
228
+ end
229
+ let(:pointers) { ['/date', '/time', '/datetime'] }
230
+
231
+ it 'shows dates' do
232
+ expect(processed_data).to eq({
233
+ date: Date.new(2023, 12, 12),
234
+ time: Time.new(2023, 12, 13),
235
+ datetime: DateTime.new(2023, 12, 14)
236
+ })
237
+ end
238
+ end
239
+
240
+ context 'when unsupported object present' do
241
+ let(:pointers) { ['/field'] }
242
+ let(:some_class) { OpenStruct.new(name: 'Rowdy', pin_code: '1234') }
243
+ let(:data) { {field: some_class} }
244
+
245
+ it 'masks the object' do
246
+ expect(processed_data).to eq(
247
+ field: '*****'
248
+ )
154
249
  end
155
250
  end
156
251
 
@@ -312,6 +407,103 @@ RSpec.describe Lenjador::Preprocessors::Whitelist do
312
407
  end
313
408
  end
314
409
 
410
+ context 'when boolean present' do
411
+ let(:pointers) { ['/bool'] }
412
+ let(:data) do
413
+ {
414
+ bool: true,
415
+ bool2: true
416
+ }
417
+ end
418
+
419
+ it 'prunes only if not in whitelist' do
420
+ expect(processed_data).to eq({
421
+ bool: true
422
+ })
423
+ end
424
+ end
425
+
426
+ context 'when nil present' do
427
+ let(:pointers) { ['/nil'] }
428
+ let(:data) do
429
+ {
430
+ nil: nil,
431
+ nil2: nil
432
+ }
433
+ end
434
+
435
+ it 'prunes only if not in whitelist' do
436
+ expect(processed_data).to eq({
437
+ nil: nil
438
+ })
439
+ end
440
+ end
441
+
442
+ context 'when numbers present' do
443
+ let(:data) do
444
+ {
445
+ integer: 1,
446
+ float: 2.03,
447
+ integer2: 3,
448
+ float2: 3.34324
449
+ }
450
+ end
451
+ let(:pointers) { ['/integer', '/float'] }
452
+
453
+ it 'prunes only if not in whitelist' do
454
+ expect(processed_data).to eq({
455
+ integer: 1,
456
+ float: 2.03
457
+ })
458
+ end
459
+ end
460
+
461
+ context 'when symbol present' do
462
+ let(:data) do
463
+ {
464
+ symbol1: :symbol1,
465
+ symbol2: :symbol2
466
+ }
467
+ end
468
+ let(:pointers) { ['/symbol1'] }
469
+
470
+ it 'prunes only if not in whitelist' do
471
+ expect(processed_data).to eq({
472
+ symbol1: :symbol1
473
+ })
474
+ end
475
+ end
476
+
477
+ context 'when date time present' do
478
+ let(:data) do
479
+ {
480
+ date: Date.new(2023, 12, 12),
481
+ time: Time.new(2023, 12, 13),
482
+ datetime: DateTime.new(2023, 12, 14)
483
+ }
484
+ end
485
+ let(:pointers) { ['/date', '/time', '/datetime'] }
486
+
487
+ it 'shows dates' do
488
+ expect(processed_data).to eq({
489
+ date: Date.new(2023, 12, 12),
490
+ time: Time.new(2023, 12, 13),
491
+ datetime: DateTime.new(2023, 12, 14)
492
+ })
493
+ end
494
+ end
495
+
496
+ context 'when unsupported object present' do
497
+ let(:pointers) { ['/class'] }
498
+ let(:some_class) { OpenStruct.new(name: 'Rowdy', pin_code: '1234') }
499
+
500
+ let(:data) { {class: some_class} }
501
+
502
+ it 'does not return the object' do
503
+ expect(processed_data).to eq({class: nil})
504
+ end
505
+ end
506
+
315
507
  def process(pointers, data)
316
508
  described_class.new(pointers: pointers, action: :prune).process(data)
317
509
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lenjador
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salemove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2023-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lru_redux
@@ -158,11 +158,13 @@ extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
160
  - ".github/workflows/ci.yml"
161
+ - ".github/workflows/publish.yml"
161
162
  - ".gitignore"
162
163
  - ".rspec"
163
164
  - ".rubocop.yml"
164
165
  - ".ruby-gemset"
165
166
  - ".ruby-version"
167
+ - CONTRIBUTING.md
166
168
  - Gemfile
167
169
  - Gemfile.lock
168
170
  - README.md
@@ -210,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
212
  - !ruby/object:Gem::Version
211
213
  version: '0'
212
214
  requirements: []
213
- rubygems_version: 3.1.2
215
+ rubygems_version: 3.1.6
214
216
  signing_key:
215
217
  specification_version: 4
216
218
  summary: What description said