gitlab-mail_room 0.0.17 → 0.0.20

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: 30098bb79ab0bfc80e56174d3f7d9d56f395fa09d50ae250b2abaee83a8bbb6e
4
- data.tar.gz: 3afee3c595728c60709d55e1a7f2c1801896d570beca581283db170809f9dd40
3
+ metadata.gz: d67e38380fdc5833ee32a9cacee0894a2f9533b869ada45847156a7d49e0130b
4
+ data.tar.gz: 51c4d4449a80f38d06b99d3fd0f62c9ddf3760f3f55ec7611887ab9e583dc77a
5
5
  SHA512:
6
- metadata.gz: 833188c07bd16eeaa7e3af353f7adb4047ace6db31a35c10702d990b7d9b68149c6c1c5f8ad80d5de042c29a2b6147d6141f62caf038f7051f281b8f29261be1
7
- data.tar.gz: 178d43f29844e004e2730e592049ae54cdbd8d8351b5516d66db5733d63e80a2a4d875bedd9c2344dee1efd52b125f5f60d4aa16e7dda23544809ef4520a1486
6
+ metadata.gz: d52fb679aa2b3395e91d4d0f055fc5fb7e709495c5172148a1439d2472ea45a47115824dcf2717aaaa7312679ef48614007ffd4d8d4358e671bb40b037177d72
7
+ data.tar.gz: a4e43c65a7bd5561e2731a0056299f4c2f68c31c4854a91291f3d47874bccbefe9048f4872aef7a82750a3e4afdad4c7ac59e0c79c667bbc1b83006c35f2440a
@@ -0,0 +1,9 @@
1
+ Please read me!
2
+
3
+ This repository supports our packaged release of `mail_room` that ships with GitLab. We strive to diverge as little as possible from the canonical upstream at https://www.github.com/tpitale/mail_room. If we do diverge, our patches are sent upstream for review and we carry them here to support the GitLab application.
4
+
5
+ You can raise an issue here if you're having an issue *specifically in the context of a GitLab installation*.
6
+
7
+ Otherwise, please direct any issues upstream to https://www.github.com/tpitale/mail_room.
8
+
9
+ Thank you for contributing!
data/.gitlab-ci.yml CHANGED
@@ -1,4 +1,5 @@
1
- # Cache gems in between builds
1
+ default:
2
+ image: "ruby:${RUBY_VERSION}"
2
3
 
3
4
  services:
4
5
  - redis:latest
@@ -9,24 +10,20 @@ services:
9
10
  - vendor/ruby
10
11
  variables:
11
12
  REDIS_URL: redis://redis:6379
12
- script:
13
- - bundle exec rspec spec
14
13
  before_script:
15
14
  - apt update && apt install -y libicu-dev
16
15
  - ruby -v # Print out ruby version for debugging
17
- # Uncomment next line if your rails app needs a JS runtime:
18
- # - apt-get update -q && apt-get install nodejs -yqq
19
- - gem install bundler --no-document # Bundler is not installed with the image
20
- - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
21
-
22
- rspec-2.6:
23
- image: "ruby:2.6"
24
- <<: *test
16
+ - gem install bundler --no-document # Bundler is not installed with the image
17
+ - bundle config set --local path 'vendor'
18
+ - bundle install -j $(nproc)
19
+ script:
20
+ - bundle exec rspec spec
25
21
 
26
- rspec-2.7:
27
- image: "ruby:2.7"
22
+ rspec:
23
+ parallel:
24
+ matrix:
25
+ - RUBY_VERSION: [ "2.5", "2.6", "2.7", "3.0" ]
28
26
  <<: *test
29
27
 
30
- rspec-3.0:
31
- image: "ruby:3.0"
32
- <<: *test
28
+ include:
29
+ - template: Security/Dependency-Scanning.gitlab-ci.yml
data/.rubocop_todo.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-04-26 06:46:39 UTC using RuboCop version 1.11.0.
3
+ # on 2022-03-15 06:29:40 UTC using RuboCop version 1.26.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 5
10
- # Cop supports --auto-correct.
10
+ # This cop supports safe auto-correction (--auto-correct).
11
11
  # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
12
  # Include: **/*.gemspec
13
13
  Gemspec/OrderedDependencies:
@@ -21,15 +21,15 @@ Gemspec/RequiredRubyVersion:
21
21
  Exclude:
22
22
  - 'mail_room.gemspec'
23
23
 
24
- # Offense count: 4
25
- # Cop supports --auto-correct.
24
+ # Offense count: 5
25
+ # This cop supports safe auto-correction (--auto-correct).
26
26
  Layout/BlockEndNewline:
27
27
  Exclude:
28
28
  - 'spec/lib/delivery/postback_spec.rb'
29
29
  - 'spec/lib/delivery/que_spec.rb'
30
30
 
31
31
  # Offense count: 5
32
- # Cop supports --auto-correct.
32
+ # This cop supports safe auto-correction (--auto-correct).
33
33
  # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
34
34
  # SupportedStyles: case, end
35
35
  Layout/CaseIndentation:
@@ -37,13 +37,13 @@ Layout/CaseIndentation:
37
37
  - 'lib/mail_room/mailbox.rb'
38
38
 
39
39
  # Offense count: 1
40
- # Cop supports --auto-correct.
40
+ # This cop supports safe auto-correction (--auto-correct).
41
41
  Layout/EmptyLineAfterMagicComment:
42
42
  Exclude:
43
43
  - 'mail_room.gemspec'
44
44
 
45
45
  # Offense count: 2
46
- # Cop supports --auto-correct.
46
+ # This cop supports safe auto-correction (--auto-correct).
47
47
  # Configuration parameters: EnforcedStyle.
48
48
  # SupportedStyles: around, only_before
49
49
  Layout/EmptyLinesAroundAccessModifier:
@@ -52,7 +52,7 @@ Layout/EmptyLinesAroundAccessModifier:
52
52
  - 'lib/mail_room/delivery/que.rb'
53
53
 
54
54
  # Offense count: 4
55
- # Cop supports --auto-correct.
55
+ # This cop supports safe auto-correction (--auto-correct).
56
56
  # Configuration parameters: EnforcedStyle.
57
57
  # SupportedStyles: empty_lines, no_empty_lines
58
58
  Layout/EmptyLinesAroundBlockBody:
@@ -62,15 +62,15 @@ Layout/EmptyLinesAroundBlockBody:
62
62
  - 'spec/lib/logger/structured_spec.rb'
63
63
 
64
64
  # Offense count: 1
65
- # Cop supports --auto-correct.
65
+ # This cop supports safe auto-correction (--auto-correct).
66
66
  # Configuration parameters: EnforcedStyle.
67
67
  # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
68
68
  Layout/EmptyLinesAroundClassBody:
69
69
  Exclude:
70
70
  - 'lib/mail_room/logger/structured.rb'
71
71
 
72
- # Offense count: 13
73
- # Cop supports --auto-correct.
72
+ # Offense count: 15
73
+ # This cop supports safe auto-correction (--auto-correct).
74
74
  # Configuration parameters: EnforcedStyle, IndentationWidth.
75
75
  # SupportedStyles: special_inside_parentheses, consistent, align_braces
76
76
  Layout/FirstHashElementIndentation:
@@ -80,7 +80,7 @@ Layout/FirstHashElementIndentation:
80
80
  - 'spec/lib/logger/structured_spec.rb'
81
81
 
82
82
  # Offense count: 5
83
- # Cop supports --auto-correct.
83
+ # This cop supports safe auto-correction (--auto-correct).
84
84
  # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
85
85
  # SupportedHashRocketStyles: key, separator, table
86
86
  # SupportedColonStyles: key, separator, table
@@ -90,22 +90,22 @@ Layout/HashAlignment:
90
90
  - 'lib/mail_room/delivery/sidekiq.rb'
91
91
 
92
92
  # Offense count: 2
93
- # Cop supports --auto-correct.
93
+ # This cop supports safe auto-correction (--auto-correct).
94
94
  # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
95
95
  Layout/LeadingCommentSpace:
96
96
  Exclude:
97
97
  - 'lib/mail_room/mailbox.rb'
98
98
  - 'spec/lib/arbitration/redis_spec.rb'
99
99
 
100
- # Offense count: 4
101
- # Cop supports --auto-correct.
100
+ # Offense count: 5
101
+ # This cop supports safe auto-correction (--auto-correct).
102
102
  Layout/MultilineBlockLayout:
103
103
  Exclude:
104
104
  - 'spec/lib/delivery/postback_spec.rb'
105
105
  - 'spec/lib/delivery/que_spec.rb'
106
106
 
107
107
  # Offense count: 3
108
- # Cop supports --auto-correct.
108
+ # This cop supports safe auto-correction (--auto-correct).
109
109
  # Configuration parameters: EnforcedStyle.
110
110
  # SupportedStyles: space, no_space
111
111
  Layout/SpaceAroundEqualsInParameterDefault:
@@ -115,14 +115,14 @@ Layout/SpaceAroundEqualsInParameterDefault:
115
115
  - 'lib/mail_room/mailbox.rb'
116
116
 
117
117
  # Offense count: 2
118
- # Cop supports --auto-correct.
118
+ # This cop supports safe auto-correction (--auto-correct).
119
119
  Layout/SpaceAroundKeyword:
120
120
  Exclude:
121
121
  - 'lib/mail_room/coordinator.rb'
122
122
  - 'lib/mail_room/mailbox_watcher.rb'
123
123
 
124
124
  # Offense count: 2
125
- # Cop supports --auto-correct.
125
+ # This cop supports safe auto-correction (--auto-correct).
126
126
  # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
127
127
  # SupportedStylesForExponentOperator: space, no_space
128
128
  Layout/SpaceAroundOperators:
@@ -131,7 +131,7 @@ Layout/SpaceAroundOperators:
131
131
  - 'spec/lib/arbitration/redis_spec.rb'
132
132
 
133
133
  # Offense count: 7
134
- # Cop supports --auto-correct.
134
+ # This cop supports safe auto-correction (--auto-correct).
135
135
  # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
136
136
  # SupportedStyles: space, no_space
137
137
  # SupportedStylesForEmptyBraces: space, no_space
@@ -141,8 +141,8 @@ Layout/SpaceBeforeBlockBraces:
141
141
  - 'spec/lib/crash_handler_spec.rb'
142
142
  - 'spec/lib/mailbox_spec.rb'
143
143
 
144
- # Offense count: 50
145
- # Cop supports --auto-correct.
144
+ # Offense count: 51
145
+ # This cop supports safe auto-correction (--auto-correct).
146
146
  # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
147
147
  # SupportedStyles: space, no_space
148
148
  # SupportedStylesForEmptyBraces: space, no_space
@@ -158,43 +158,41 @@ Layout/SpaceInsideBlockBraces:
158
158
  - 'spec/lib/imap/connection_spec.rb'
159
159
  - 'spec/lib/mailbox_watcher_spec.rb'
160
160
 
161
- # Offense count: 34
162
- # Cop supports --auto-correct.
161
+ # Offense count: 32
162
+ # This cop supports safe auto-correction (--auto-correct).
163
163
  # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
164
164
  # SupportedStyles: space, no_space, compact
165
165
  # SupportedStylesForEmptyBraces: space, no_space
166
166
  Layout/SpaceInsideHashLiteralBraces:
167
167
  Exclude:
168
- - 'lib/mail_room/arbitration/redis.rb'
169
168
  - 'lib/mail_room/mailbox.rb'
170
169
  - 'spec/lib/cli_spec.rb'
171
170
  - 'spec/lib/mailbox_spec.rb'
172
171
 
173
172
  # Offense count: 1
174
- # Cop supports --auto-correct.
173
+ # This cop supports safe auto-correction (--auto-correct).
175
174
  # Configuration parameters: EnforcedStyle.
176
- # SupportedStyles: space, no_space
175
+ # SupportedStyles: space, compact, no_space
177
176
  Layout/SpaceInsideParens:
178
177
  Exclude:
179
178
  - 'spec/lib/logger/structured_spec.rb'
180
179
 
181
180
  # Offense count: 1
182
- # Cop supports --auto-correct.
181
+ # This cop supports safe auto-correction (--auto-correct).
183
182
  # Configuration parameters: EnforcedStyle.
184
183
  # SupportedStyles: final_newline, final_blank_line
185
184
  Layout/TrailingEmptyLines:
186
185
  Exclude:
187
186
  - 'spec/lib/delivery/letter_opener_spec.rb'
188
187
 
189
- # Offense count: 7
190
- # Cop supports --auto-correct.
188
+ # Offense count: 4
189
+ # This cop supports safe auto-correction (--auto-correct).
191
190
  # Configuration parameters: AllowInHeredoc.
192
191
  Layout/TrailingWhitespace:
193
192
  Exclude:
194
193
  - 'lib/mail_room/coordinator.rb'
195
194
  - 'lib/mail_room/imap.rb'
196
195
  - 'spec/lib/coordinator_spec.rb'
197
- - 'spec/lib/delivery/postback_spec.rb'
198
196
 
199
197
  # Offense count: 5
200
198
  # Configuration parameters: AllowedMethods.
@@ -209,27 +207,27 @@ Lint/RescueException:
209
207
  - 'lib/mail_room/cli.rb'
210
208
 
211
209
  # Offense count: 1
212
- # Cop supports --auto-correct.
210
+ # This cop supports safe auto-correction (--auto-correct).
213
211
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
214
212
  Lint/UnusedMethodArgument:
215
213
  Exclude:
216
214
  - 'lib/mail_room/logger/structured.rb'
217
215
 
218
- # Offense count: 4
216
+ # Offense count: 5
219
217
  # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
220
218
  Metrics/AbcSize:
221
219
  Max: 27
222
220
 
223
- # Offense count: 27
221
+ # Offense count: 32
224
222
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
225
223
  # IgnoredMethods: refine
226
224
  Metrics/BlockLength:
227
- Max: 145
225
+ Max: 198
228
226
 
229
227
  # Offense count: 3
230
228
  # Configuration parameters: CountComments, CountAsOne.
231
229
  Metrics/ClassLength:
232
- Max: 151
230
+ Max: 169
233
231
 
234
232
  # Offense count: 1
235
233
  # Configuration parameters: IgnoredMethods.
@@ -252,29 +250,21 @@ Naming/AccessorMethodName:
252
250
  - 'lib/mail_room/configuration.rb'
253
251
 
254
252
  # Offense count: 1
255
- # Cop supports --auto-correct.
253
+ # This cop supports safe auto-correction (--auto-correct).
256
254
  Security/YAMLLoad:
257
255
  Exclude:
258
256
  - 'lib/mail_room/configuration.rb'
259
257
 
260
- # Offense count: 2
261
- # Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
262
- # SupportedStyles: inline, group
263
- Style/AccessModifierDeclarations:
264
- Exclude:
265
- - 'lib/mail_room/arbitration.rb'
266
- - 'lib/mail_room/delivery.rb'
267
-
268
258
  # Offense count: 1
269
- # Cop supports --auto-correct.
259
+ # This cop supports safe auto-correction (--auto-correct).
270
260
  # Configuration parameters: EnforcedStyle.
271
261
  # SupportedStyles: prefer_alias, prefer_alias_method
272
262
  Style/Alias:
273
263
  Exclude:
274
264
  - 'lib/mail_room/coordinator.rb'
275
265
 
276
- # Offense count: 14
277
- # Cop supports --auto-correct.
266
+ # Offense count: 16
267
+ # This cop supports safe auto-correction (--auto-correct).
278
268
  # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
279
269
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
280
270
  # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
@@ -288,6 +278,7 @@ Style/BlockDelimiters:
288
278
  - 'spec/lib/delivery/sidekiq_spec.rb'
289
279
 
290
280
  # Offense count: 12
281
+ # Configuration parameters: AllowedConstants.
291
282
  Style/Documentation:
292
283
  Exclude:
293
284
  - 'spec/**/*'
@@ -306,7 +297,7 @@ Style/Documentation:
306
297
  - 'lib/mail_room/microsoft_graph/connection.rb'
307
298
 
308
299
  # Offense count: 2
309
- # Cop supports --auto-correct.
300
+ # This cop supports safe auto-correction (--auto-correct).
310
301
  # Configuration parameters: EnforcedStyle.
311
302
  # SupportedStyles: compact, expanded
312
303
  Style/EmptyMethod:
@@ -315,27 +306,27 @@ Style/EmptyMethod:
315
306
  - 'lib/mail_room/delivery/noop.rb'
316
307
 
317
308
  # Offense count: 1
318
- # Cop supports --auto-correct.
309
+ # This cop supports safe auto-correction (--auto-correct).
319
310
  Style/Encoding:
320
311
  Exclude:
321
312
  - 'mail_room.gemspec'
322
313
 
323
314
  # Offense count: 2
324
- # Cop supports --auto-correct.
315
+ # This cop supports safe auto-correction (--auto-correct).
325
316
  Style/ExpandPathArguments:
326
317
  Exclude:
327
318
  - 'mail_room.gemspec'
328
319
  - 'spec/spec_helper.rb'
329
320
 
330
- # Offense count: 38
331
- # Cop supports --auto-correct.
321
+ # Offense count: 39
322
+ # This cop supports safe auto-correction (--auto-correct).
332
323
  # Configuration parameters: EnforcedStyle.
333
324
  # SupportedStyles: always, always_true, never
334
325
  Style/FrozenStringLiteralComment:
335
326
  Enabled: false
336
327
 
337
328
  # Offense count: 5
338
- # Cop supports --auto-correct.
329
+ # This cop supports safe auto-correction (--auto-correct).
339
330
  Style/GlobalStdStream:
340
331
  Exclude:
341
332
  - 'lib/mail_room/crash_handler.rb'
@@ -352,21 +343,22 @@ Style/GuardClause:
352
343
  - 'lib/mail_room/mailbox_watcher.rb'
353
344
 
354
345
  # Offense count: 1
355
- # Cop supports --auto-correct.
356
- # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
346
+ # This cop supports safe auto-correction (--auto-correct).
347
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
357
348
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
349
+ # SupportedShorthandSyntax: always, never, either
358
350
  Style/HashSyntax:
359
351
  Exclude:
360
352
  - 'spec/lib/microsoft_graph/connection_spec.rb'
361
353
 
362
354
  # Offense count: 1
363
- # Cop supports --auto-correct.
355
+ # This cop supports safe auto-correction (--auto-correct).
364
356
  Style/IfUnlessModifier:
365
357
  Exclude:
366
358
  - 'lib/mail_room/mailbox_watcher.rb'
367
359
 
368
360
  # Offense count: 5
369
- # Cop supports --auto-correct.
361
+ # This cop supports safe auto-correction (--auto-correct).
370
362
  # Configuration parameters: EnforcedStyle.
371
363
  # SupportedStyles: literals, strict
372
364
  Style/MutableConstant:
@@ -377,7 +369,7 @@ Style/MutableConstant:
377
369
  - 'spec/spec_helper.rb'
378
370
 
379
371
  # Offense count: 1
380
- # Cop supports --auto-correct.
372
+ # This cop supports unsafe auto-correction (--auto-correct-all).
381
373
  # Configuration parameters: EnforcedStyle, IgnoredMethods.
382
374
  # SupportedStyles: predicate, comparison
383
375
  Style/NumericPredicate:
@@ -386,7 +378,7 @@ Style/NumericPredicate:
386
378
  - 'lib/mail_room/imap/connection.rb'
387
379
 
388
380
  # Offense count: 2
389
- # Cop supports --auto-correct.
381
+ # This cop supports unsafe auto-correction (--auto-correct-all).
390
382
  # Configuration parameters: EnforcedStyle.
391
383
  # SupportedStyles: short, verbose
392
384
  Style/PreferredHashMethods:
@@ -395,7 +387,7 @@ Style/PreferredHashMethods:
395
387
  - 'lib/mail_room/mailbox.rb'
396
388
 
397
389
  # Offense count: 1
398
- # Cop supports --auto-correct.
390
+ # This cop supports safe auto-correction (--auto-correct).
399
391
  # Configuration parameters: EnforcedStyle, AllowedCompactTypes.
400
392
  # SupportedStyles: compact, exploded
401
393
  Style/RaiseArgs:
@@ -403,13 +395,13 @@ Style/RaiseArgs:
403
395
  - 'lib/mail_room/logger/structured.rb'
404
396
 
405
397
  # Offense count: 2
406
- # Cop supports --auto-correct.
398
+ # This cop supports safe auto-correction (--auto-correct).
407
399
  Style/RedundantPercentQ:
408
400
  Exclude:
409
401
  - 'mail_room.gemspec'
410
402
 
411
403
  # Offense count: 7
412
- # Cop supports --auto-correct.
404
+ # This cop supports safe auto-correction (--auto-correct).
413
405
  Style/RedundantSelf:
414
406
  Exclude:
415
407
  - 'lib/mail_room/configuration.rb'
@@ -418,7 +410,7 @@ Style/RedundantSelf:
418
410
  - 'lib/mail_room/mailbox_watcher.rb'
419
411
 
420
412
  # Offense count: 1
421
- # Cop supports --auto-correct.
413
+ # This cop supports safe auto-correction (--auto-correct).
422
414
  # Configuration parameters: EnforcedStyle.
423
415
  # SupportedStyles: implicit, explicit
424
416
  Style/RescueStandardError:
@@ -426,7 +418,7 @@ Style/RescueStandardError:
426
418
  - 'lib/mail_room/configuration.rb'
427
419
 
428
420
  # Offense count: 1
429
- # Cop supports --auto-correct.
421
+ # This cop supports safe auto-correction (--auto-correct).
430
422
  # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
431
423
  # AllowedMethods: present?, blank?, presence, try, try!
432
424
  Style/SafeNavigation:
@@ -434,28 +426,29 @@ Style/SafeNavigation:
434
426
  - 'lib/mail_room/mailbox_watcher.rb'
435
427
 
436
428
  # Offense count: 1
437
- # Cop supports --auto-correct.
438
- # Configuration parameters: EnforcedStyle.
429
+ # This cop supports safe auto-correction (--auto-correct).
430
+ # Configuration parameters: RequireEnglish, EnforcedStyle.
439
431
  # SupportedStyles: use_perl_names, use_english_names
440
432
  Style/SpecialGlobalVars:
441
433
  Exclude:
442
434
  - 'mail_room.gemspec'
443
435
 
444
436
  # Offense count: 1
445
- # Cop supports --auto-correct.
437
+ # This cop supports unsafe auto-correction (--auto-correct-all).
438
+ # Configuration parameters: Mode.
446
439
  Style/StringConcatenation:
447
440
  Exclude:
448
441
  - 'lib/mail_room/logger/structured.rb'
449
442
 
450
- # Offense count: 135
451
- # Cop supports --auto-correct.
443
+ # Offense count: 140
444
+ # This cop supports safe auto-correction (--auto-correct).
452
445
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
453
446
  # SupportedStyles: single_quotes, double_quotes
454
447
  Style/StringLiterals:
455
448
  Enabled: false
456
449
 
457
450
  # Offense count: 4
458
- # Cop supports --auto-correct.
451
+ # This cop supports safe auto-correction (--auto-correct).
459
452
  # Configuration parameters: EnforcedStyle, MinSize.
460
453
  # SupportedStyles: percent, brackets
461
454
  Style/SymbolArray:
@@ -464,7 +457,7 @@ Style/SymbolArray:
464
457
  - 'spec/lib/logger/structured_spec.rb'
465
458
 
466
459
  # Offense count: 2
467
- # Cop supports --auto-correct.
460
+ # This cop supports safe auto-correction (--auto-correct).
468
461
  # Configuration parameters: EnforcedStyleForMultiline.
469
462
  # SupportedStylesForMultiline: comma, consistent_comma, no_comma
470
463
  Style/TrailingCommaInHashLiteral:
@@ -473,29 +466,29 @@ Style/TrailingCommaInHashLiteral:
473
466
  - 'spec/spec_helper.rb'
474
467
 
475
468
  # Offense count: 1
476
- # Cop supports --auto-correct.
469
+ # This cop supports safe auto-correction (--auto-correct).
477
470
  Style/WhileUntilDo:
478
471
  Exclude:
479
472
  - 'lib/mail_room/mailbox_watcher.rb'
480
473
 
481
474
  # Offense count: 2
482
- # Cop supports --auto-correct.
475
+ # This cop supports safe auto-correction (--auto-correct).
483
476
  Style/WhileUntilModifier:
484
477
  Exclude:
485
478
  - 'lib/mail_room/coordinator.rb'
486
479
  - 'lib/mail_room/mailbox_watcher.rb'
487
480
 
488
481
  # Offense count: 3
489
- # Cop supports --auto-correct.
482
+ # This cop supports safe auto-correction (--auto-correct).
490
483
  # Configuration parameters: WordRegex.
491
484
  # SupportedStyles: percent, brackets
492
485
  Style/WordArray:
493
486
  EnforcedStyle: percent
494
487
  MinSize: 3
495
488
 
496
- # Offense count: 6
497
- # Cop supports --auto-correct.
498
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
489
+ # Offense count: 7
490
+ # This cop supports safe auto-correction (--auto-correct).
491
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
499
492
  # URISchemes: http, https
500
493
  Layout/LineLength:
501
494
  Max: 177
data/README.md CHANGED
@@ -134,6 +134,8 @@ You will also need to install `faraday` or `letter_opener` if you use the `postb
134
134
  :client_id: ABCDE
135
135
  :client_secret: YOUR-SECRET-HERE
136
136
  :poll_interval: 60
137
+ :azure_ad_endpoint: https://login.microsoftonline.com
138
+ :graph_endpoint: https://graph.microsoft.com
137
139
  :delivery_method: sidekiq
138
140
  :delivery_options:
139
141
  :redis_url: redis://localhost:6379
@@ -232,6 +234,25 @@ Fill in `inbox_options` with these values:
232
234
  By default, MailRoom will poll for new messages every 60 seconds. `poll_interval` configures the number of
233
235
  seconds to poll. Setting the value to 0 or under will default to 60 seconds.
234
236
 
237
+ ### Alternative Azure cloud deployments
238
+
239
+ MailRoom will default to using the standard Azure HTTPS endpoints. To
240
+ configure MailRoom with Microsoft Cloud for US Government or other
241
+ [national cloud deployments](https://docs.microsoft.com/en-us/graph/deployments), set
242
+ the `azure_ad_endpoint` and `graph_endpoint` accordingly. For example,
243
+ for Microsoft Cloud for US Government:
244
+
245
+ ```yaml
246
+ :inbox_method: microsoft_graph
247
+ :inbox_options:
248
+ :tenant_id: 12345
249
+ :client_id: ABCDE
250
+ :client_secret: YOUR-SECRET-HERE
251
+ :poll_interval: 60
252
+ :azure_ad_endpoint: https://login.microsoftonline.us
253
+ :graph_endpoint: https://graph.microsoft.us
254
+ ```
255
+
235
256
  ## delivery_method ##
236
257
 
237
258
  ### postback ###
@@ -31,7 +31,7 @@ module MailRoom
31
31
  # Any subsequent failure in the instance which gets the lock will be dealt
32
32
  # with by the expiration, at which time another instance can pick up the
33
33
  # message and try again.
34
- client.set(key, 1, {nx: true, ex: expiration})
34
+ client.set(key, 1, nx: true, ex: expiration)
35
35
  end
36
36
 
37
37
  private
data/lib/mail_room/jwt.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'faraday'
4
4
  require 'securerandom'
5
+ require 'jwt'
6
+ require 'base64'
5
7
 
6
8
  module MailRoom
7
9
  # Responsible for validating and generating JWT token
@@ -6,7 +6,6 @@ require 'oauth2'
6
6
  module MailRoom
7
7
  module MicrosoftGraph
8
8
  class Connection < MailRoom::Connection
9
- SCOPE = 'https://graph.microsoft.com/.default'
10
9
  NEXT_PAGE_KEY = '@odata.nextLink'
11
10
  DEFAULT_POLL_INTERVAL_S = 60
12
11
 
@@ -76,12 +75,12 @@ module MailRoom
76
75
  def setup
77
76
  @mailbox.logger.info({ context: @mailbox.context, action: 'Retrieving OAuth2 token...' })
78
77
 
79
- @token = client.client_credentials.get_token({ scope: SCOPE })
78
+ @token = client.client_credentials.get_token({ scope: scope })
80
79
  end
81
80
 
82
81
  def client
83
82
  @client ||= OAuth2::Client.new(client_id, client_secret,
84
- site: 'https://login.microsoftonline.com',
83
+ site: azure_ad_endpoint,
85
84
  authorize_url: "/#{tenant_id}/oauth2/v2.0/authorize",
86
85
  token_url: "/#{tenant_id}/oauth2/v2.0/token",
87
86
  auth_scheme: :basic_auth)
@@ -207,7 +206,7 @@ module MailRoom
207
206
  end
208
207
 
209
208
  def base_url
210
- "https://graph.microsoft.com/v1.0/users/#{mailbox.email}/mailFolders/#{mailbox.name}/messages"
209
+ "#{graph_endpoint}/v1.0/users/#{mailbox.email}/mailFolders/#{mailbox.name}/messages"
211
210
  end
212
211
 
213
212
  def unread_messages_url
@@ -216,7 +215,7 @@ module MailRoom
216
215
 
217
216
  def msg_url(id)
218
217
  # Attempting to use the base_url fails with "The OData request is not supported"
219
- "https://graph.microsoft.com/v1.0/users/#{mailbox.email}/messages/#{id}"
218
+ "#{graph_endpoint}/v1.0/users/#{mailbox.email}/messages/#{id}"
220
219
  end
221
220
 
222
221
  def rfc822_msg_url(id)
@@ -227,6 +226,18 @@ module MailRoom
227
226
  def log_exception(message, exception)
228
227
  @mailbox.logger.warn({ context: @mailbox.context, message: message, exception: exception.to_s })
229
228
  end
229
+
230
+ def scope
231
+ "#{graph_endpoint}/.default"
232
+ end
233
+
234
+ def graph_endpoint
235
+ inbox_options[:graph_endpoint] || 'https://graph.microsoft.com'
236
+ end
237
+
238
+ def azure_ad_endpoint
239
+ inbox_options[:azure_ad_endpoint] || 'https://login.microsoftonline.com'
240
+ end
230
241
  end
231
242
  end
232
243
  end
@@ -1,4 +1,4 @@
1
1
  module MailRoom
2
2
  # Current version of gitlab-mail_room gem
3
- VERSION = "0.0.17"
3
+ VERSION = "0.0.20"
4
4
  end
data/mail_room.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
35
35
  gem.add_development_dependency "faraday"
36
36
  gem.add_development_dependency "mail"
37
37
  gem.add_development_dependency "letter_opener"
38
- gem.add_development_dependency "redis", "~> 3.3.1"
38
+ gem.add_development_dependency "redis", "~> 4"
39
39
  gem.add_development_dependency "redis-namespace"
40
40
  gem.add_development_dependency "pg"
41
41
  gem.add_development_dependency "charlock_holmes"
@@ -15,6 +15,7 @@ describe MailRoom::Arbitration::Redis do
15
15
 
16
16
  # Private, but we don't care.
17
17
  let(:redis) { subject.send(:client) }
18
+ let(:raw_client) { redis._client }
18
19
 
19
20
  describe '#deliver?' do
20
21
  context "when called the first time" do
@@ -95,7 +96,7 @@ describe MailRoom::Arbitration::Redis do
95
96
  it 'client has same specified url' do
96
97
  subject.deliver?(123)
97
98
 
98
- expect(redis.client.options[:url]).to eq redis_url
99
+ expect(raw_client.options[:url]).to eq redis_url
99
100
  end
100
101
 
101
102
  it 'client is a instance of Redis class' do
@@ -137,10 +138,10 @@ describe MailRoom::Arbitration::Redis do
137
138
  before { ::Redis::Client::Connector::Sentinel.any_instance.stubs(:resolve).returns(sentinels) }
138
139
 
139
140
  it 'client has same specified sentinel params' do
140
- expect(redis.client.instance_variable_get(:@connector)).to be_a Redis::Client::Connector::Sentinel
141
- expect(redis.client.options[:host]).to eq('sentinel-master')
142
- expect(redis.client.options[:password]).to eq('mypassword')
143
- expect(redis.client.options[:sentinels]).to eq(sentinels)
141
+ expect(raw_client.instance_variable_get(:@connector)).to be_a Redis::Client::Connector::Sentinel
142
+ expect(raw_client.options[:host]).to eq('sentinel-master')
143
+ expect(raw_client.options[:password]).to eq('mypassword')
144
+ expect(raw_client.options[:sentinels]).to eq(sentinels)
144
145
  end
145
146
  end
146
147
  end
@@ -4,6 +4,7 @@ require 'mail_room/delivery/sidekiq'
4
4
  describe MailRoom::Delivery::Sidekiq do
5
5
  subject { described_class.new(options) }
6
6
  let(:redis) { subject.send(:client) }
7
+ let(:raw_client) { redis._client }
7
8
  let(:options) { MailRoom::Delivery::Sidekiq::Options.new(mailbox) }
8
9
 
9
10
  describe '#options' do
@@ -20,7 +21,7 @@ describe MailRoom::Delivery::Sidekiq do
20
21
 
21
22
  context 'with simple redis url' do
22
23
  it 'client has same specified redis_url' do
23
- expect(redis.client.options[:url]).to eq(redis_url)
24
+ expect(raw_client.options[:url]).to eq(redis_url)
24
25
  end
25
26
 
26
27
  it 'client is a instance of RedisNamespace class' do
@@ -39,10 +40,9 @@ describe MailRoom::Delivery::Sidekiq do
39
40
  end
40
41
 
41
42
  it 'client has correct redis_url' do
42
- expect(redis.client.options[:url]).to eq(redis_url)
43
+ expect(raw_client.options[:url]).to eq(redis_url)
43
44
  end
44
45
 
45
-
46
46
  it 'connection has correct values' do
47
47
  expect(redis.connection[:host]).to eq('localhost')
48
48
  expect(redis.connection[:db]).to eq(4)
@@ -87,10 +87,10 @@ describe MailRoom::Delivery::Sidekiq do
87
87
  before { ::Redis::Client::Connector::Sentinel.any_instance.stubs(:resolve).returns(sentinels) }
88
88
 
89
89
  it 'client has same specified sentinel params' do
90
- expect(redis.client.instance_variable_get(:@connector)).to be_a Redis::Client::Connector::Sentinel
91
- expect(redis.client.options[:host]).to eq('sentinel-master')
92
- expect(redis.client.options[:password]).to eq('mypassword')
93
- expect(redis.client.options[:sentinels]).to eq(sentinels)
90
+ expect(raw_client.instance_variable_get(:@connector)).to be_a Redis::Client::Connector::Sentinel
91
+ expect(raw_client.options[:host]).to eq('sentinel-master')
92
+ expect(raw_client.options[:password]).to eq('mypassword')
93
+ expect(raw_client.options[:sentinels]).to eq(sentinels)
94
94
  end
95
95
  end
96
96
 
@@ -14,8 +14,10 @@ describe MailRoom::MicrosoftGraph::Connection do
14
14
  }.merge(REQUIRED_MICROSOFT_GRAPH_DEFAULTS)
15
15
  end
16
16
  let(:mailbox) { build_mailbox(options) }
17
- let(:base_url) { 'https://graph.microsoft.com/v1.0/users/user@example.com/mailFolders/inbox/messages' }
18
- let(:message_base_url) { 'https://graph.microsoft.com/v1.0/users/user@example.com/messages' }
17
+ let(:graph_endpoint) { 'https://graph.microsoft.com' }
18
+ let(:azure_ad_endpoint) { 'https://login.microsoftonline.com' }
19
+ let(:base_url) { "#{graph_endpoint}/v1.0/users/user@example.com/mailFolders/inbox/messages" }
20
+ let(:message_base_url) { "#{graph_endpoint}/v1.0/users/user@example.com/messages" }
19
21
 
20
22
  let(:connection) { described_class.new(mailbox) }
21
23
  let(:uid) { 1 }
@@ -25,7 +27,7 @@ describe MailRoom::MicrosoftGraph::Connection do
25
27
  let(:unread_messages_body) { '' }
26
28
  let(:status) { 200 }
27
29
  let!(:stub_token) do
28
- stub_request(:post, "https://login.microsoftonline.com/#{tenant_id}/oauth2/v2.0/token").to_return(
30
+ stub_request(:post, "#{azure_ad_endpoint}/#{tenant_id}/oauth2/v2.0/token").to_return(
29
31
  body: { 'access_token' => access_token, 'refresh_token' => refresh_token, 'expires_in' => expires_in }.to_json,
30
32
  headers: { 'Content-Type' => 'application/json' }
31
33
  )
@@ -102,7 +104,7 @@ describe MailRoom::MicrosoftGraph::Connection do
102
104
  end
103
105
  end
104
106
 
105
- context 'with a single message' do
107
+ shared_examples 'with a single message' do
106
108
  let(:message_id) { SecureRandom.hex }
107
109
  let(:unread_messages_body) { { value: ['id' => message_id] } }
108
110
  let(:message_url) { "#{message_base_url}/#{message_id}" }
@@ -134,9 +136,38 @@ describe MailRoom::MicrosoftGraph::Connection do
134
136
  end
135
137
  end
136
138
 
139
+ context 'with default Azure settings' do
140
+ before do
141
+ puts options
142
+ end
143
+ it_behaves_like 'with a single message'
144
+ end
145
+
146
+ # https://docs.microsoft.com/en-us/graph/deployments
147
+ context 'with an alternative Azure deployment' do
148
+ let(:graph_endpoint) { 'https://graph.microsoft.us' }
149
+ let(:azure_ad_endpoint) { 'https://login.microsoftonline.us' }
150
+ let(:options) do
151
+ {
152
+ inbox_method: :microsoft_graph,
153
+ delete_after_delivery: true,
154
+ expunge_deleted: true,
155
+ inbox_options: {
156
+ tenant_id: '98776',
157
+ client_id: '12345',
158
+ client_secret: 'MY-SECRET',
159
+ graph_endpoint: 'https://graph.microsoft.us',
160
+ azure_ad_endpoint: 'https://login.microsoftonline.us'
161
+ }
162
+ }
163
+ end
164
+
165
+ it_behaves_like 'with a single message'
166
+ end
167
+
137
168
  context 'with multiple pages of messages' do
138
169
  let(:message_ids) { [SecureRandom.hex, SecureRandom.hex] }
139
- let(:next_page_url) { 'https://graph.microsoft.com/v1.0/nextPage' }
170
+ let(:next_page_url) { "#{graph_endpoint}/v1.0/nextPage" }
140
171
  let(:unread_messages_body) { { value: ['id' => message_ids.first], '@odata.nextLink' => next_page_url } }
141
172
  let(:message_body) { 'hello world' }
142
173
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-mail_room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-30 00:00:00.000000000 Z
11
+ date: 2022-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-imap
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 3.3.1
201
+ version: '4'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 3.3.1
208
+ version: '4'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: redis-namespace
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -272,6 +272,7 @@ extra_rdoc_files: []
272
272
  files:
273
273
  - ".gitignore"
274
274
  - ".gitlab-ci.yml"
275
+ - ".gitlab/issue_templates/Default.md"
275
276
  - ".gitlab/issue_templates/Release.md"
276
277
  - ".rubocop.yml"
277
278
  - ".rubocop_todo.yml"
@@ -340,7 +341,7 @@ files:
340
341
  homepage: http://github.com/tpitale/mail_room
341
342
  licenses: []
342
343
  metadata: {}
343
- post_install_message:
344
+ post_install_message:
344
345
  rdoc_options: []
345
346
  require_paths:
346
347
  - lib
@@ -356,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
357
  version: '0'
357
358
  requirements: []
358
359
  rubygems_version: 3.1.6
359
- signing_key:
360
+ signing_key:
360
361
  specification_version: 4
361
362
  summary: mail_room will proxy email (gmail) from IMAP to a callback URL, logger, or
362
363
  letter_opener