Add SFP port mode to brocade plugin#6062
Add SFP port mode to brocade plugin#6062rmorandell-pgum wants to merge 6 commits intocentreon:developfrom
Conversation
| if (defined($self->{option_results}->{display_transform_src})) { | ||
| $self->{option_results}->{display_transform_dst} = '' if (!defined($self->{option_results}->{display_transform_dst})); | ||
|
|
||
| $self->{safe}->reval("\$assign_var =~ s{$self->{option_results}->{display_transform_src}}{$self->{option_results}->{display_transform_dst}}", |
There was a problem hiding this comment.
User-controlled display_transform_src/dst are interpolated into a string passed to Safe->reval, enabling code/regex injection. Avoid constructing/evaluating code from untrusted options.
Details
✨ AI Reasoning
The code builds a Perl substitution expression using user-provided options display_transform_src and display_transform_dst, then executes it via Safe->reval. This composes executable code strings from external input, which can lead to code injection or unexpected execution. Safe limits some operations but does not eliminate risks of crafted regular expressions or evaluation payloads that can alter program behavior. The problematic change is the addition of dynamic evaluation in get_display_value, which introduces a new execution path for untrusted input. This finding is directly tied to the changed lines where reval is invoked.
🔧 How do I fix it?
Use parameterized queries with placeholders, array-based command execution (no shell interpretation), or properly escaped arguments using vetted libraries. Avoid dynamic queries/commands built with user input concatenation.
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
The plugin has been extended to include a --list-sfp-ports mode and a --sfp-port option.
In addition, the standard SNMP modes --tcp-con, --udp-con, and --uptime have been added.
Type of change
How this pull request can be tested ?
The walk is from a ExtremeSLX9640 switch but is based on the brocade MIBs .1.3.6.1.4.1.1588
BROCADE-OPTICAL-MONITORING-MIB.mib.txt.
extremeSLX.-brocadesnmpwalk.txt.zip
Checklist
Centreon team (internal PR)
Description
PLEASE MAKE SURE THAT THE BRANCH PR INCLUDES JIRA TICKET ID
Please include a short resume of the changes and what is the purpose of this pull request.
Any relevant information should be added to help reviewers to understand what are the stakes
of the pull request.
Fixes # (issue)
If you are fixing a github Issue already existing, mention it here.
If you are fixing one or more JIRA ticket, mention it here too.
Type of change
How this pull request can be tested ?
Please describe the procedure to verify that the goal of the PR is matched.
Provide clear instructions so that it can be correctly tested.
Mention the automated tests included in this FOR (what they test like mode/option combinations).
Checklist
Summary by Aikido
🚀 New Features
⚡ Enhancements
🔧 Refactors
More info