Skip to content

Commit

Permalink
Update generate_alert_pages.js script
Browse files Browse the repository at this point in the history
`getExampleAlerts` is a public method for most scan rules and reflection
is not needed to access it.

The reason this change was needed is that reflection was failing for
`PassiveScriptScanRule`s. This is probably because we are using
`ByteBuddy` to dynamically create a unique class for each passive script
but I haven't checked in detail.

Signed-off-by: ricekot <[email protected]>
  • Loading branch information
ricekot committed Jul 2, 2024
1 parent 655e501 commit b45111b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/generate_alert_pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ function getPrivateMethod(obj, methods, key, defaultVal) {
function printPscanRule(plugin) {
plugin.setHelper(passiveScanData);

var examples = getPrivateMethod(plugin, ['getExampleAlerts'], '', null);
try {
var examples = plugin.getExampleAlerts()
} catch (e) {
var examples = getPrivateMethod(plugin, ['getExampleAlerts'], '', null);
}

if (examples == null || examples.length == 0) {
var alert = new Alert(plugin.getPluginId());
Expand Down

0 comments on commit b45111b

Please sign in to comment.