Class: DCCSCR::Whitelist::UpdateAllowlistWithDCCSCR

Inherits:
Object
  • Object
show all
Defined in:
lib/dccscr/whitelist/update_allowlist_with_dccscr.rb

Overview

Service class to update a GitLab vulnerability-allowlist.yml with whitelisted_vulnerabilities from the dccscr-whitelist for a set of images.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(images: [], allow_filename: nil, local_filename: nil) ⇒ UpdateAllowlistWithDCCSCR

Returns a new instance of UpdateAllowlistWithDCCSCR.



13
14
15
16
17
# File 'lib/dccscr/whitelist/update_allowlist_with_dccscr.rb', line 13

def initialize(images: [], allow_filename: nil, local_filename: nil)
  @images = images
  @allow_filename = allow_filename || 'vulnerability-allowlist.yml'
  @local_filename = local_filename || 'local-vulnerability-allowlist.yml'
end

Instance Attribute Details

#allow_filenameObject (readonly)

Returns the value of attribute allow_filename.



11
12
13
# File 'lib/dccscr/whitelist/update_allowlist_with_dccscr.rb', line 11

def allow_filename
  @allow_filename
end

#imagesObject (readonly)

Returns the value of attribute images.



11
12
13
# File 'lib/dccscr/whitelist/update_allowlist_with_dccscr.rb', line 11

def images
  @images
end

#local_filenameObject (readonly)

Returns the value of attribute local_filename.



11
12
13
# File 'lib/dccscr/whitelist/update_allowlist_with_dccscr.rb', line 11

def local_filename
  @local_filename
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/dccscr/whitelist/update_allowlist_with_dccscr.rb', line 23

def run
  ll = load_gitlab_allowlist

  wl = load_dccscr_whitelist
  dl = allow_list_dccscr(wl)

  cl = combined_list(dl, ll)

  update_allow_list_file(cl)
end

#whitelistObject



19
20
21
# File 'lib/dccscr/whitelist/update_allowlist_with_dccscr.rb', line 19

def whitelist
  @_whitelist ||= DCCSCR::Whitelist.new
end