Discovered 9 months ago
Source: static code analysis
Category: Denial of Service
Confidence level: Medium

Problem

Model attribute used in regex

Location

app/models/concerns/referable.rb:83

/
        (?<url>
          #{Regexp.escape(Gitlab.config.gitlab.url)}
          \/#{Project.reference_pattern}
          (?:\/\-)?
          \/#{route.is_a?(Regexp) ? (route) : (Regexp.escape(route))}
          \/#{pattern}
          (?<path>
            (\/[a-z0-9_=-]+)*\/*
          )?
          (?<query>
            \?[a-z0-9_=-]+
            (&[a-z0-9_=-]+)*
          )?
          (?<anchor>\#[a-z0-9_-]+)?
        )
      /x

Category description: Denial of Service is any attack which causes a service to become unavailable for legitimate clients.

Solution: fix the issue in app/models/concerns/referable.rb or mark it as false positive.