Method initialize
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Apache NiFi H2 Connection String Remote Code Execution',
Method exploit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
# Check whether login is required and set/fetch token
if supports_login?
validate_config
@token = if datastore['BEARER-TOKEN'].to_s.empty?
Method configure_dbconpool
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure_dbconpool
# our base64ed payload can't have = in it, so we'll pad out with spaces to remove them
b64_pe = ::Base64.strict_encode64(payload.encoded)
equals_count = b64_pe.count('=')
if equals_count > 0
Method configure_processor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure_processor
vprint_status("Configuring processor #{@processor}")
body = {
# "disconnectedNodeAcknowledged"=> false,
'component' => {
Method exploit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def exploit
# Check whether login is required and set/fetch token
if supports_login?
validate_config
@token = if datastore['BEARER-TOKEN'].to_s.empty?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method configure_dbconpool
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def configure_dbconpool
# our base64ed payload can't have = in it, so we'll pad out with spaces to remove them
b64_pe = ::Base64.strict_encode64(payload.encoded)
equals_count = b64_pe.count('=')
if equals_count > 0
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check
# see apache_nifi_processor_rce check method for details on why this is difficult
@cleanup_required = false
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"