Skip to content

SameOrigin validation fails with custom Nette\Http\IRequest implementation #371

Description

@janfejtek

Version: 3.3.0

Bug Description

Form validation for received signal $presenter->getHttpRequest()->isFrom(Nette\Http\FetchSite::SameOrigin) fails if custom Request class is used. Calling isFrom is not possible on IRequest interface as it does not exist

} elseif (!$this->crossOrigin && !$presenter->getHttpRequest()->isFrom(Nette\Http\FetchSite::SameOrigin)) {
$presenter->detectedCsrf();

Steps To Reproduce

For example PHPStan or just add custom class implementing https://github.com/nette/http/blob/master/src/Http/IRequest.php

Expected Behavior

Do not throw exception when for example Contributte\Codeception\Http\Request is used which does not have isFrom implemented

Possible Solution

add check with instanceof

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions