dependaboat 0.2.0 → 0.3.0

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: 14a88024f9d6d27f1365bfbfe5575ffaf2d8f0b4e84b04eccbe1ae70489da90b
4
- data.tar.gz: a5b7200f42a6658de3e5903c6f408097588bd486b1c09452b2762936f34ca691
3
+ metadata.gz: da50e06178dc26bfe2e3daf101ec72d5ab0b73d88dbf2849d1a5613364201182
4
+ data.tar.gz: 10f7a9d28275547c050a68bcd921b3a88296892368c33b66679760e563d79e75
5
5
  SHA512:
6
- metadata.gz: edaddab17c68a16780fd21f7a5318fea7c23d09aad516bcc5bd5b957249ce7d78e344ba9ad12d6bfff6e1d45e2340ed835a890c32e437927c1b380b2bd255e03
7
- data.tar.gz: 416daac0c5e9d9e125649c193022c8f7eef01843f3d42013a408c8bb729bc5810ba75e6273ae8226948fee8dd4a35447454fc7aef6a3e96a4be67099964106fc
6
+ metadata.gz: 826279a76087a2615ff3d78708177840ba44473cb55a39e1eb0d55cf673649d556ee114cfe90918b5ca0995abd144a666497b7fde0109536b0dc4ff8e8f1a15c
7
+ data.tar.gz: '0157953412ab5f62a4c0abb125d9faecfb078926ddb991a6b5a97dbd643f77018a9a7e3f025897d42a8f031c9fe176905c38657c2b6491a2a3c7f2d793c4d39e'
@@ -50,17 +50,29 @@ module Dependaboat
50
50
 
51
51
  @alerts.each do |alert|
52
52
  process_alert(alert)
53
- sleep 1 # Rate limiting
53
+ sleep 2 # Rate limiting
54
54
  end
55
55
  end
56
56
 
57
57
  def process_alert(alert)
58
- return if issue_exists?(alert)
59
-
60
- alert_details = extract_alert_details(alert)
61
- create_github_issue(alert, alert_details)
62
- rescue StandardError => e
63
- logger.error "Error processing alert ##{alert.number}: #{e.message}"
58
+ retry_count = 0
59
+ begin
60
+ return if issue_exists?(alert)
61
+ alert_details = extract_alert_details(alert)
62
+ create_github_issue(alert, alert_details)
63
+ rescue GHX::RateLimitExceededError => e
64
+ logger.error "Rate limit exceeded!"
65
+ retry_count += 1
66
+ if retry_count < 4
67
+ logger.info "Slowing down and retrying..."
68
+ sleep 15 * retry_count
69
+ retry
70
+ else
71
+ logger.error "3 Retries failed. Moving on."
72
+ end
73
+ rescue => e
74
+ logger.error "Error processing alert ##{alert.number}: #{e.message}"
75
+ end
64
76
  end
65
77
 
66
78
  def issue_exists?(alert)
@@ -76,7 +88,11 @@ module Dependaboat
76
88
  alert_severity = alert.security_vulnerability.severity.capitalize
77
89
  alert_package_name = alert.security_vulnerability.package.name
78
90
  alert_package_ecosystem = alert.security_vulnerability.package.ecosystem
79
- alert_created_at = alert.created_at.to_date rescue Date.today
91
+ alert_created_at = begin
92
+ alert.created_at.to_date
93
+ rescue
94
+ Date.today
95
+ end
80
96
 
81
97
  remediation_deadline = alert_created_at + config.dig("remediation_sla", alert_severity.downcase)
82
98
 
@@ -210,7 +226,9 @@ module Dependaboat
210
226
  end
211
227
 
212
228
  def process_templateable_string(s, map)
213
- map.reduce(s.dup) { |str, (key, value)| str.gsub!("{{#{key}}}", value.to_s); str }
229
+ map.each_with_object(s.dup) { |(key, value), str|
230
+ str.gsub!("{{#{key}}}", value.to_s)
231
+ }
214
232
  end
215
233
 
216
234
  def dry_run?
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dependaboat
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependaboat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CompanyCam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ghx