gitlab-mail_room 0.0.19 → 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: 2e9602ef5d0f53b51c947485678b32f45b0d6099a2b9e10dea153358bc5023c4
4
- data.tar.gz: 05203d73f36e129d0f463537d2be619181c804a60aacbdf58d6a12ca6dbf8392
3
+ metadata.gz: d67e38380fdc5833ee32a9cacee0894a2f9533b869ada45847156a7d49e0130b
4
+ data.tar.gz: 51c4d4449a80f38d06b99d3fd0f62c9ddf3760f3f55ec7611887ab9e583dc77a
5
5
  SHA512:
6
- metadata.gz: b2860a2390178f2862d0ac3f139f1330e9502cfab0ea06d850feef7212c6575c0b97eddda0b958ad274038a819261d1e2984997a52b7e54e6c6b9d5707f6c51c
7
- data.tar.gz: 5b5f63868bfee8235d4be4f56e62d5d83be90ad3faa8dfa99776720176133de725defb143757058eccd32daee8ef75505560ee91523cc27c0876f3b2a60941cb
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
@@ -24,3 +24,6 @@ rspec:
24
24
  matrix:
25
25
  - RUBY_VERSION: [ "2.5", "2.6", "2.7", "3.0" ]
26
26
  <<: *test
27
+
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 ###
@@ -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.19"
3
+ VERSION = "0.0.20"
4
4
  end
@@ -43,7 +43,6 @@ describe MailRoom::Delivery::Sidekiq do
43
43
  expect(raw_client.options[:url]).to eq(redis_url)
44
44
  end
45
45
 
46
-
47
46
  it 'connection has correct values' do
48
47
  expect(redis.connection[:host]).to eq('localhost')
49
48
  expect(redis.connection[:db]).to eq(4)
@@ -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.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 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
@@ -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"
@@ -355,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
355
356
  - !ruby/object:Gem::Version
356
357
  version: '0'
357
358
  requirements: []
358
- rubygems_version: 3.3.5
359
+ rubygems_version: 3.1.6
359
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