Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include hidden warnings too on Jenkins #239

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/check_plugin_vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

This scripts checks the Jenkins Plugins for security issues

Copyright (c) 2021 InnoGames GmbH
Copyright (c) 2022 InnoGames GmbH
"""
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -28,12 +28,22 @@
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.UpdateSiteWarningsConfiguration
import jenkins.security.ExtensionList
import groovy.json.JsonBuilder
ExtensionList<UpdateSiteWarningsConfiguration> configurations = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class);
UpdateSiteWarningsConfiguration configuration = configurations.get(0);
def problematic_plugins = []
def current_warnings = configuration.getApplicableWarnings()
current_warnings.each {
if (it.type.name() == 'PLUGIN') {
problematic_plugins.add(it.component)
}
}
seqizz marked this conversation as resolved.
Show resolved Hide resolved
print(new JsonBuilder(problematic_plugins.unique()))
""" # NOQA E501 Don't wrap because of groovy code

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


Expand Down