Move Gitlab::UntrustedRegexp into gitlab-utils
What does this MR do and why?
Gitlab::UntrustedRegexp and Gitlab::UntrustedRegexp::RubySyntax are
generic RE2 wrappers with no GitLab concepts. Moving them into
gitlab-utils is the first step of extracting the CI config code into
a gitlab-ci-config gem, which can then depend on gitlab-utils
instead of on re2 and the monolith.
The two feature flag checks in with_fallback become ports on the
class, wired in config/initializers/900_gem_gitlab-utils.rb:
fallback_disabledreplacesFeature.enabled?(:disable_unsafe_regexp). It defaults totrue, so the gem refuses the unsafe fallback unless the host allows it.fallback_loggerreplaces theci_unsafe_regexp_loggerlogging and is called with the class name and the pattern. It defaults to doing nothing.
spec/initializers/gitlab_utils_untrusted_regexp_spec.rb covers the
adapters. The malicious regexp shared example moves into
gitlab-utils so the gem and the three monolith specs using it share
one copy.
gitlab-utils gains a runtime dependency on re2 with the monolith's
constraint. The root lockfiles stay on re2 2.27.0. qa/Gemfile.lock
now resolves re2, which needs mini_portile2 2.8.9.
Part of #632651.
Context
Part of #635234, which has the plan, verification and risks for this workstream. The tracking issue for the whole slice is #632651.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.