[ruby-core:127318] [Ruby Misc#22502] Clarify whether compiling an untrusted string into a Regexp is supported
Issue #22502 has been reported by k0kubun (Takashi Kokubun). ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502 * Author: k0kubun (Takashi Kokubun) * Status: Open ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by jeremyevans0 (Jeremy Evans). IMO, creating a Regexp from an untrusted string should be unsupported. Ruby's Regexp was not designed to be used with untrusted input. Users that want to create regular expressions from untrusted input should use a regular expression engine designed for such a use case, such as re2. ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-119748 * Author: k0kubun (Takashi Kokubun) * Status: Open ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by byroot (Jean Boussier). I second what Jeremy said, for the currently released versions I don't think we can reasonably claim that `Regexp.new` can safely accept untrusted input. However if the relevant maintainers wish to make this a goal, then it's up to them, but it should only apply to future Ruby versions. ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-119761 * Author: k0kubun (Takashi Kokubun) * Status: Open ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by duerst (Martin Dürst). I think we should use "security in depth" here, and not treat this as an exclusive OR. We should be very clear that it may be unsafe to create a Regexp from untrusted input. We can fix (and should) fix the documentation as quickly as possible. But we also should try very hard to avoid any bugs when creating Regexps from arbitrary input. I don't know much about the costs and benefits of CVEs, but in doubt, I think we should request them. ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-119762 * Author: k0kubun (Takashi Kokubun) * Status: Open ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by sorah (Sorah Fukumori). 1. Assigning vuln identifier such as CVE/GHSA: Can be done retroactively if we don't want to increase burden for dealing with security issues 2. Threat model: It is still not the common sense that passing untrusted input to regexp compiler (at least, there's other engines that claims it's safe). Such common sense cannot be changed in short term. If we want to change, we need to deprecate interpolation in Regexp literal, and make Regexp.new hard to use, or more self-indicate that is something unsafe. ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-119876 * Author: k0kubun (Takashi Kokubun) * Status: Open ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by vo.x (Vit Ondruch). The glibc has for example this policy about RegExps: https://sourceware.org/git/?p=glibc.git;a=blob;f=SECURITY.md#l59 ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-119882 * Author: k0kubun (Takashi Kokubun) * Status: Open ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by k0kubun (Takashi Kokubun). Status changed from Open to Closed At the dev-meeting on Nov 12th, @matz agreed that he will write the conclusion as a comment on this ticket. See also: [the meeting log](https://github.com/ruby/dev-meeting-log/blob/master/2026/DevMeeting-2026-11-...).
Request CVEs for the recent fixes
As per the policy decided by Matz, all these recent issues are now considered as vulnerabilities in Ruby itself. We have published GitHub Security Advisories for these issues, which we used for requesting CVEs: * https://github.com/ruby/ruby/security/advisories/GHSA-gfj3-8wj9-qx8p * https://github.com/ruby/ruby/security/advisories/GHSA-22mf-ggw7-pxfx * https://github.com/ruby/ruby/security/advisories/GHSA-qm4g-8pfh-6996 ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-120020 * Author: k0kubun (Takashi Kokubun) * Status: Closed ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by vo.x (Vit Ondruch). I just wonder, are there really worth of "Critical" rating? These were Critical from GL POV, but should they be critical also in the Ruby domain? ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-120025 * Author: k0kubun (Takashi Kokubun) * Status: Closed * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by vo.x (Vit Ondruch). Also, I wonder if the documentation was updates and such use of RegExp was discouraged similarly to use of the `timeout` ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-120026 * Author: k0kubun (Takashi Kokubun) * Status: Closed * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by k0kubun (Takashi Kokubun). I can't answer to those questions on behalf of @matz; let's wait for his comment first. I think the rating is also ultimately up to how @matz wants to position such problems in the language. I wish I could leave the rating unknown while waiting for his answer, but GHSA unfortunately doesn't allow you to unset it (at least after you set it once, anyway). As a reminder, see also [the meeting log](https://github.com/ruby/dev-meeting-log/blob/master/2026/DevMeeting-2026-11-...), which touches on the documentation part of the conclusion. ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-120028 * Author: k0kubun (Takashi Kokubun) * Status: Closed * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
Issue #22502 has been updated by matz (Yukihiro Matsumoto). I don't think this is a binary choice. Our goal is that compiling any string into a Regexp never crashes the interpreter. Memory corruption caused by a pattern is a bug, and we will fix it. Whether a particular bug is treated as a vulnerability should be judged case by case, depending on its severity. However, a goal is not a guarantee. So the documentation should clearly say that passing untrusted input as a regexp pattern is generally not recommended, in `Regexp.new` and `doc/security/security.rdoc`. The same applies to methods that compile a String argument, such as `String#match`. I don't plan to change the API or the syntax for this, such as deprecating interpolation in Regexp literals. Documentation is enough. Regarding CVEs for the recent fixes, I leave the decision to the security team. Matz. ---------------------------------------- Misc #22502: Clarify whether compiling an untrusted string into a Regexp is supported https://bugs.ruby-lang.org/issues/22502#change-120126 * Author: k0kubun (Takashi Kokubun) * Status: Closed * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- ## Proposal Decide whether compiling an untrusted string into a Regexp is a supported use case, and document the decision. * If it's not supported: * Document it in `Regexp.new` and [doc/security/security.rdoc](https://docs.ruby-lang.org/en/master/security/security_rdoc.html), like `Marshal.load` and `eval`. * Treat memory corruption bugs that only untrusted patterns can trigger as normal bugs. * If it's supported: * Treat such bugs as vulnerabilities. * Request CVEs for the recent fixes: [#13332](https://github.com/ruby/ruby/pull/13332), [#19020](https://github.com/ruby/ruby/pull/19020), and [#16801](https://github.com/ruby/ruby/pull/16801). ## Background * Ruby 4.0.9, 3.4.12, and 3.3.13 fixed Regexp compilation bugs that led to RCE on GitLab. GitLab assigned CVEs to them, but we haven't requested CVEs for Ruby itself. See [the announcement](https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/). * The current documentation is not clear about it: * The [CVE-2022-28738 advisory](https://www.ruby-lang.org/en/news/2022/04/12/double-free-in-regexp-compilati...) says "in general, it is considered unsafe to create and use a Regexp object generated from untrusted input", but we still assigned a CVE to it. We did the same for CVE-2024-27282. * [The Regexp documentation](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Timeouts) mentions untrusted sources only for DoS, and recommends `Regexp.timeout`. * It's not only `Regexp.new` and `/#{...}/`. `String#match` and `String#match?` also compile a String argument, e.g. `"str".match?(user_input)`. -- https://bugs.ruby-lang.org/
participants (7)
-
byroot (Jean Boussier) -
duerst -
jeremyevans0 (Jeremy Evans) -
k0kubun (Takashi Kokubun) -
matz (Yukihiro Matsumoto) -
sorah (Sorah Fukumori) -
vo.x (Vit Ondruch)