How to Specify Conditions in Vulnerability Calculation Rule Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 06:40 PM
We would like to calculate the value of the [Risk score] column of Vulnerable Items[sn_vul_vulnerable_item] using the Vulnerability Calculator Rules[sn_vul_calculator].
We want to calculate it.
We would like to set the conditions and values in the [When this condition is met] and [Set these values] tabs in the script,
We would like to know the sample code that should be set in each tab.
The current settings are as follows.
In this state, when I press the “Calculate Risk Score” link of an existing record of a Vulnerable Items TBL that matches the criteria, the [Risk score] and [Risk rating] columns are updated with the specified values,
However, when I try to create a new Vulnerable Items record, the following message appears and the record cannot be created.
○Setting details> [Set these values]
-----------------------------------------------------------------------------------------------
var item = new GlideRecord("sn_vul_vulnerable_item");
item.addQuery("vulnerability.exploit", "1");
item.addQuery("vulnerability.id", "TEN-118918");
current.setValue("risk_score", 100);
var weight = current.risk_score * 0.2;
current.setValue("risk_score",weight);
current.updateMultiple();
-----------------------------------------------------------------------------------------------
○Message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 07:52 PM
// Set the Risk Score based on vulnerability_score current.risk_score = current.vulnerability_score; // Set Risk Rating based on the risk score if (current.risk_score >= 9) { current.risk_rating = 'Critical'; } else if (current.risk_score >= 7) { current.risk_rating = 'High'; } else if (current.risk_score >= 4) { current.risk_rating = 'Medium'; } else { current.risk_rating = 'Low'; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 11:14 PM
Thanks for the reply.
I understand about the scripts to set risk_score and risk_rating.
Do you know why the following error message appears when creating a new vulnerability items?