[WIP] Upgrade framework to rails 8.0#21308
Draft
dwelch-r7 wants to merge 3 commits intorapid7:masterfrom
Draft
Conversation
672ab3a to
ccabb2e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is an initial, WIP upgrade pass to move the metasploit-framework Rails stack to Rails 8.0 and unblock dependency resolution/CI on the new Rails + Rack versions.
Changes:
- Bump Rails constraints to
~> 8.0.0and refresh gem dependency constraints/lockfile for Rack 3 + Sinatra 4. - Update web service apps for Sinatra 4 defaults (host authorization) and Rack 3 header normalization.
- Adjust JSON-RPC request specs to explicitly send JSON content type.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/api/json_rpc_spec.rb | Adds JSON content-type headers to Rack::Test JSON-RPC requests. |
| metasploit-framework.gemspec | Pins/adjusts runtime deps for Rails 8 compatibility (Rack 3, Sinatra 4, updated metasploit-* gems). |
| lib/msf/core/web_services/servlet_helper.rb | Normalizes response header keys for Rack 3. |
| lib/msf/core/web_services/metasploit_api_app.rb | Disables Sinatra 4 host authorization middleware behavior via settings. |
| lib/msf/core/web_services/json_rpc_exception_handling.rb | Normalizes JSON error response header keys. |
| lib/msf/core/web_services/json_rpc_app.rb | Disables Sinatra 4 host authorization middleware behavior via settings. |
| lib/msf/core/web_services/http_db_manager_service.rb | Switches web service handler from Thin to Puma and rewrites SSL handling. |
| lib/metasploit/framework/rails_version_constraint.rb | Updates Rails version constraint constant to ~> 8.0.0. |
| db/schema.rb | Regenerates schema for ActiveRecord 8.0 output changes. |
| config/application.rb | Updates Rails defaults to 8.0 and revises ActionView TagBuilder monkey patch for Rails 7 vs 8. |
| Gemfile.lock | Updates locked gems for Rails 8 / Rack 3 / Sinatra 4 resolution. |
| .github/workflows/shared_gem_verify_rails.yml | Adds ~> 8.0.0 to the Rails matrix used in shared gem verification. |
Comment on lines
+42
to
+46
| code_generator.class_eval do |batch| | ||
| batch << "\n" << | ||
| "def #{method_name}(content = nil, escape: true, **options, &block)" << | ||
| " tag_string(#{name.inspect}, content, options, escape: escape, &block)" << | ||
| "end" |
Comment on lines
+46
to
+56
| if opts[:ssl] | ||
| print_good('SSL Enabled') | ||
| ssl_opts = opts[:ssl_opts] || {} | ||
| key = ssl_opts[:private_key_file] | ||
| cert = ssl_opts[:cert_chain_file] | ||
| verify = ssl_opts[:verify_peer] ? 'peer' : 'none' | ||
|
|
||
| ssl_uri = "ssl://#{host}:#{port}?key=#{key}&cert=#{cert}&verify_mode=#{verify}" | ||
| puma_opts[:Host] = ssl_uri | ||
| puma_opts.delete(:Port) | ||
| else |
adfoster-r7
reviewed
Apr 15, 2026
| rubyntlm | ||
| rubyzip | ||
| sinatra (~> 3.2) | ||
| sinatra (~> 4.0) |
Contributor
There was a problem hiding this comment.
Do we need to bump sinatra for rails 8, or is this worth splitting out?
Contributor
Author
There was a problem hiding this comment.
Rails 8 requires a minimum of Rack 3 which requires sinatra 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade framework to rails 8.0, initial PR to run through CI, do not merge