LulububuSoftwareGmbH / boltredirector

Handles 301 redirects in Bolt CMS.
16 stars 8 forks source link

Bug: Crash in match method for invalid regular expression #26

Closed blaues0cke closed 4 years ago

blaues0cke commented 4 years ago
     *
     * @return bool
     */
    public function match($path)
    {
        return preg_match("~^" . $this->computedWildcards . "$~i", $path);
    }

We may should add a trycatch or @preg_match around this to avoid the whole site to get broken when the user enters a invalid rule?

image

The user entered this configuration to make it crash:

?page_id=97:
    from: '/?page_id=97'
    to: '/'

?page_id=678:
    from: '/?page_id=678'
    to: '/'
SvanteRichter commented 4 years ago

Sure, open a PR and I'll have a look! Even better would be validation, but that'd be harder.