Skip to content

Commit

Permalink
Include hidden warnings too on Jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
seqizz committed Sep 22, 2021
1 parent 821d75c commit 4546aa7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/check_plugin_vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@
import requests
from sys import exit

SCRIPT = (
'def warnings_monitor = new jenkins.security.UpdateSiteWarningsMonitor()\n' # NOQA E501 Don't wrap because of groovy code
'def plugin_vulnerabilities = warnings_monitor.getActivePluginWarningsByPlugin()\n' # NOQA E501 Don't wrap because of groovy code
'def critical_plugins = plugin_vulnerabilities.keySet()*.longName\n'
'print(new groovy.json.JsonBuilder(critical_plugins))'
)
SCRIPT = """
import jenkins.security.*
ExtensionList<UpdateSiteWarningsConfiguration> configurations = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class);
UpdateSiteWarningsConfiguration configuration = configurations.get(0);
problematic_plugins = []
current_warnings = configuration.getApplicableWarnings()
current_warnings.each {
if (it.type.name() == 'PLUGIN') {
problematic_plugins.add(it.component)
}
}
print(new groovy.json.JsonBuilder(problematic_plugins.unique()))
""" # NOQA E501 Don't wrap because of groovy code

IGNORE_FILE = '/etc/nagios-plugins/check_plugin_vulnerability_ignore'


Expand Down

0 comments on commit 4546aa7

Please sign in to comment.