new plugin for Stormagic SvSAN#6198
Conversation
| free => $free, | ||
| capacity => $capacity, | ||
| used => $used, | ||
| prct_used => defined($capacity) && $capacity > 0 ? $free * 100 / $capacity : undef, |
There was a problem hiding this comment.
prct_used is calculated from $free and prct_free from $used, so pool usage percentages are inverted and produce wrong output/threshold behavior.
Details
✨ AI Reasoning
The logic is computing pool usage statistics for output and thresholds. In this calculation block, the percentage assigned to used space is derived from free space, and the percentage assigned to free space is derived from used space. Since these values are later displayed and used for threshold checks under their current names, the code will systematically report inverted percentages.
🔧 How do I fix it?
Trace execution paths carefully. Ensure precondition checks happen before using values, validate ranges before checking impossible conditions, and don't check for states that the code has already ruled out.
Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info
| prct_used => defined($size) && $size > 0 ? $free * 100 / $size : undef, | ||
| prct_free => defined($size) && $size > 0 ? $used * 100 / $size : undef, |
There was a problem hiding this comment.
Cache percentages are inverted: prct_used uses $free and prct_free uses $used, causing incorrect cache usage values and alert evaluation.
| prct_used => defined($size) && $size > 0 ? $free * 100 / $size : undef, | |
| prct_free => defined($size) && $size > 0 ? $used * 100 / $size : undef, | |
| prct_used => defined($size) && $size > 0 ? $used * 100 / $size : undef, | |
| prct_free => defined($size) && $size > 0 ? $free * 100 / $size : undef, |
Details
✨ AI Reasoning
This block computes cache usage metrics. The assigned percentages are reversed relative to their variable names: the used percentage is based on free bytes and the free percentage is based on used bytes. That contradiction guarantees incorrect cache usage reporting and any checks that depend on these values will be evaluated against inverted data.
Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info
Community contributors
Description
Modes Available:
Type of change
How this pull request can be tested ?
stormagic-svsan.snmpwalk.txt
STORMAGIC-MIB.mib.txt
Checklist