Skip to content

Fix Use of Kernel.open or IO.read or similar sinks with a non-constant value#83

Merged
hsbt merged 1 commit intorubygems:masterfrom
odaysec:patch-1
Aug 19, 2025
Merged

Fix Use of Kernel.open or IO.read or similar sinks with a non-constant value#83
hsbt merged 1 commit intorubygems:masterfrom
odaysec:patch-1

Conversation

@odaysec
Copy link
Contributor

@odaysec odaysec commented Aug 8, 2025

fix the problem, replace the call to open(path, 'wb') with File.open(path, 'wb'). This ensures that the file is opened for writing without invoking the potentially dangerous behavior of Kernel.open. No other changes are needed, as the rest of the code is compatible with File.open. The change should be made in the update_specs method, specifically on line 48 of lib/rubygems/mirror.rb. No new imports or method definitions are required.

References

Command Injection. Ruby on Rails Cheat Sheet: Command Injection
Command Injection in RDoc

@odaysec odaysec changed the title Update mirror.rb Fix Use of Kernel.open or IO.read or similar sinks with a non-constant value Aug 8, 2025
@hsbt
Copy link
Member

hsbt commented Aug 18, 2025

👍

@hsbt hsbt merged commit 44d6e89 into rubygems:master Aug 19, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants