Skip to content

Be more specific in pinning ActionView and pin railties to prevent er…#21453

Open
bwatters-r7 wants to merge 1 commit into
rapid7:masterfrom
bwatters-r7:fix/pin-railties
Open

Be more specific in pinning ActionView and pin railties to prevent er…#21453
bwatters-r7 wants to merge 1 commit into
rapid7:masterfrom
bwatters-r7:fix/pin-railties

Conversation

@bwatters-r7
Copy link
Copy Markdown
Contributor

@bwatters-r7 bwatters-r7 commented May 13, 2026

WARNING- I don't know what I'm doing.....

When updating the rex-arch gem, my install also updated Actionview to 7.3.2.1, which is a problem because there's a monkeypatch in config/application.rb that raises an exception if ActionView is not 7.2.2.2:

require 'action_view'
# Monkey patch https://github.com/rails/rails/blob/v7.2.2.1/actionview/lib/action_view/helpers/tag_helper.rb#L51
# Might be fixed by 8.x https://github.com/rails/rails/blob/v8.0.2/actionview/lib/action_view/helpers/tag_helper.rb#L51C1-L52C1
raise unless ActionView::VERSION::STRING == '7.2.2.2' # A developer will need to ensure this is still required when bumping rails                                                                                                       

Unfortunately, it seems like there's a lot of codependence going on around that, but it all seems to work if we also tag railties to the RAILS_VERSION, but we need to be more specific on the RAILS_VERSION, too.

This fix works for me, but someone with a better understanding of the dependencies here will need to make sure this is right.

Before:

  1. Check out master branch
  2. bundle update
  3. Run ./msfconsole`
[ruby-3.3.8@metasploit-framework](upstream-master) tmoose@ubuntu-dev2024:~/rapid7/metasploit-framework$ ./msfconsole
/home/tmoose/rapid7/metasploit-framework/config/application.rb:10:in `<top (required)>': unhandled exception
	from /home/tmoose/.rvm/rubies/ruby-3.3.8/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
	from /home/tmoose/.rvm/rubies/ruby-3.3.8/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
	from /home/tmoose/.rvm/gems/ruby-3.3.8@metasploit-framework/gems/bootsnap-1.24.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in `require'
	from /home/tmoose/rapid7/metasploit-framework/config/environment.rb:2:in `<top (required)>'
	from /home/tmoose/.rvm/rubies/ruby-3.3.8/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
	from /home/tmoose/.rvm/rubies/ruby-3.3.8/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
	from /home/tmoose/.rvm/gems/ruby-3.3.8@metasploit-framework/gems/bootsnap-1.24.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in `require'
	from /home/tmoose/rapid7/metasploit-framework/lib/msfenv.rb:28:in `<top (required)>'
	from /home/tmoose/.rvm/rubies/ruby-3.3.8/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
	from /home/tmoose/.rvm/rubies/ruby-3.3.8/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
	from /home/tmoose/.rvm/gems/ruby-3.3.8@metasploit-framework/gems/bootsnap-1.24.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:33:in `require'
	from ./msfconsole:21:in `<main>'
  1. Cry

Fixed:

  1. Check out this branch
  2. bundle update
  3. run ./msfconsole
  4. Hack the planet

@adfoster-r7
Copy link
Copy Markdown
Contributor

Needs a rebase and gemile.lock update

diff --git a/Gemfile.lock b/Gemfile.lock
index 95095d055f6..81dfea1d716 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,9 +4,9 @@ PATH
     metasploit-framework (6.4.133)
       aarch64
       abbrev
-      actionpack (~> 7.2.0)
-      activerecord (~> 7.2.0)
-      activesupport (~> 7.2.0)
+      actionpack (~> 7.2.2.2)
+      activerecord (~> 7.2.2.2)
+      activesupport (~> 7.2.2.2)
       aws-sdk-ec2
       aws-sdk-ec2instanceconnect
       aws-sdk-iam
@@ -74,7 +74,7 @@ PATH
       pg
       puma
       rack (~> 2.2)
-      railties
+      railties (~> 7.2.2.2)
       rasn1 (= 0.14.0)
       rb-readline
       recog

@adfoster-r7 adfoster-r7 self-assigned this May 29, 2026
@bwatters-r7
Copy link
Copy Markdown
Contributor Author

I think Giuthub got big mad at updating the lock file?

Run `bundle install` elsewhere and add the updated Gemfile to version control.
If this is a development machine, remove the Gemfile.lock freeze by running
`bundle config set frozen false`.
Error: The process '/opt/hostedtoolcache/Ruby/3.2.11/x64/bin/bundle' failed with exit code 16

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants