Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbaturin committed Nov 8, 2024
1 parent 9e56915 commit b4e463c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ return [
The use of a custom request header for CSRF protection is based on the CORS Protocol. Thus, you **must** configure the CORS module to allow or deny cross-origin access to the backend API.

>**Warning**
>
>`CsrfHeaderMiddleware` can be used to prevent forgery of same-origin requests and requests from the list of specific origins only.

Expand Down
4 changes: 4 additions & 0 deletions src/CsrfHeaderMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public function withHeaderName(string $name): self
return $new;
}

/**
* @param array $methods "unsafe" methods not triggered a CORS-preflight request
* @link https://fetch.spec.whatwg.org/#http-cors-protocol
*/
public function withUnsafeMethods(array $methods): self
{
$new = clone $this;
Expand Down
4 changes: 4 additions & 0 deletions src/CsrfMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public function withHeaderName(string $name): self
return $new;
}

/**
* @param array $methods "safe" methods skipped on CSRF token validation
* @link https://datatracker.ietf.org/doc/html/rfc9110#name-safe-methods
*/
public function withSafeMethods(array $methods): self
{
$new = clone $this;
Expand Down
4 changes: 4 additions & 0 deletions src/CsrfTokenMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public function withHeaderName(string $name): self
return $new;
}

/**
* @param array $methods "safe" methods skipped on CSRF token validation
* @link https://datatracker.ietf.org/doc/html/rfc9110#name-safe-methods
*/
public function withSafeMethods(array $methods): self
{
$new = clone $this;
Expand Down

0 comments on commit b4e463c

Please sign in to comment.