This upstream patch has been incorporated to fix the problem:
Fix ruby-mode.el local command injection vulnerability (bug#60268)
* lisp/progmodes/ruby-mode.el
(ruby-find-library-file): Fix local command injection vulnerability.
Origin: upstream, commit
22fb5ff5126dc8bb01edaa0252829d853afb284f
Bug: https://debbugs.gnu.org/60268
Bug-Debian: https://bugs.debian.org/
1031730
Forwarded: not-needed
(setq feature-name (read-string "Feature name: " init))))
(let ((out
(substring
- (shell-command-to-string (concat "gem which " feature-name))
+ (shell-command-to-string (concat "gem which " (shell-quote-argument feature-name)))
0 -1)))
(if (string-match-p "\\`ERROR" out)
(user-error "%s" out)