Skip to content

Conversation

@cdelafuente-r7
Copy link
Contributor

This reapplies the "Vulnerability Report Enhancement" PR. It has been reverted due to issue in Pro, but it came out to be related to something else.

This also bring a fix in metasploit-credential, see PR. This will need to be landed first before this one.

Original PR: #20424
Revert PR: #20777

@cdelafuente-r7 cdelafuente-r7 added enhancement rn-enhancement release notes enhancement labels Jan 20, 2026
This will bring the last fix related to the new Layered Services data model
@cdelafuente-r7 cdelafuente-r7 force-pushed the enh/MS-9930/vuln_report_with_creds branch from 19eb9d4 to dabfa48 Compare January 20, 2026 19:09
if opts[:sname]
opts[:name] = opts.delete(:sname)
end
opts[:name] = opts[:name].to_s.downcase if opts[:name]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: It looks like this would be fine moving forwards to have this value downcased, but would there be any issues with the historical data not being downcased? 👀

i.e. if modules previously had report_service(..., sname: 'Foo', ...), we'll end up with a new extra service being added for foo with this new code path? 🤔

A quick eyeball shows that this scenario might not be present, but thought I'd ask 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original code was already down-casing the service name in the loop that assigns the service attributes below. I added this line to make sure it is also down-cased when copying the value to the sopts hash and the DB query will follow the same "downcase" rule.

    opts.each { |k,v|
      if (service.attribute_names.include?(k.to_s))
        service[k] = ((v and k == :name) ? v.to_s.downcase : v)
      elsif !v.blank?
        dlog("Unknown attribute for Service: #{k}")
      end
    }

I believe it's fine, but I might be missing something.

Comment on lines 258 to 259
context "with some services" do
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this dead code? 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely, thanks for the heads up!

RSpec::Expectations.configuration.max_formatted_output_length = nil

db.cmd_services
expect(@output).to match_array [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker since this code is written now; but if it helps - I've introduced to match_table that I've found nice to use - it does cleaner diffing and is more copy/paste friendly

Example:

expect(@combined_output.join("\n")).to match_table <<~TABLE

Implementation:

https://github.com/rapid7/metasploit-framework/blob/537a1c53953a9b1622d0d280c2bf79575a7a7d8a/spec/support/matchers/match_table.rb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great! I updated it. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement rn-enhancement release notes enhancement

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants