Skip to content

Commit 51b6dd9

Browse files
Apply suggestions from code review
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
1 parent 1353801 commit 51b6dd9

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

.changeset/fair-jars-behave.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"astro": minor
33
---
44

5-
Adds a new security - and experimental - option to prevent CSRF attacks. This feature is available only for on-demand pages:
5+
Adds a new experimental security option to prevent [Cross-Site Request Forgery (CSRF) attacks](https://owasp.org/www-community/attacks/csrf). This feature is available only for pages rendered on demand:
66

77
```js
88
import { defineConfig } from "astro/config"
@@ -17,9 +17,8 @@ export default defineConfig({
1717
})
1818
```
1919

20-
When enabled, it checks that the "origin" header, automatically passed by all modern browsers, matches the URL sent by each `Request`.
20+
Enabling this setting performs a check that the "origin" header, automatically passed by all modern browsers, matches the URL sent by each `Request`.
2121

22-
The "origin" check is executed only on-demand pages, and only for the requests `POST, `PATCH`, `DELETE` and `PUT`, only for those requests that
23-
the followin `content-type` header: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'.
22+
This experimental "origin" check is executed only for pages rendered on demand, and only for the requests `POST, `PATCH`, `DELETE` and `PUT` with one of the following `content-type` headers: 'application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'.
2423

2524
It the "origin" header doesn't match the pathname of the request, Astro will return a 403 status code and won't render the page.

packages/astro/src/@types/astro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ export interface AstroUserConfig {
18561856
* @version 4.6.0
18571857
* @description
18581858
*
1859-
* It enables some security measures to prevent CSRF attacks: https://owasp.org/www-community/attacks/csrf
1859+
* Allows you to enable security measures to prevent CSRF attacks: https://owasp.org/www-community/attacks/csrf
18601860
*/
18611861

18621862
csrfProtection?: {

0 commit comments

Comments
 (0)