Skip to content

Commit e75dbaa

Browse files
chore: improve wording
1 parent 2cd8792 commit e75dbaa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

content/security/csrf.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### CSRF Protection
22

3-
Cross-site request forgery (also known as CSRF or XSRF) is a type of malicious exploit of a website where **unauthorized** commands are transmitted from a user that the web application trusts. To mitigate this kind of attack you can use the [csrf-csrf](https://github.com/Psifi-Solutions/csrf-csrf) package.
3+
Cross-site request forgery (CSRF or XSRF) is a type of attack where **unauthorized** commands are sent from a trusted user to a web application. To help prevent this, you can use the [csrf-csrf](https://github.com/Psifi-Solutions/csrf-csrf) package.
44

55
#### Use with Express (default)
66

@@ -10,17 +10,17 @@ Start by installing the required package:
1010
$ npm i csrf-csrf
1111
```
1212

13-
> warning **Warning** As explained in the [`csrf-csrf` docs](https://github.com/Psifi-Solutions/csrf-csrf?tab=readme-ov-file#getting-started), this middleware requires either session middleware or `cookie-parser` to be initialized first. Please see that documentation for further instructions.
13+
> warning **Warning** As noted in the [csrf-csrf documentation](https://github.com/Psifi-Solutions/csrf-csrf?tab=readme-ov-file#getting-started), this middleware requires session middleware or `cookie-parser` to be initialized beforehand. Please refer to the documentation for further details.
1414
15-
Once the installation is complete, apply the `csrf-csrf` middleware as global middleware.
15+
Once the installation is complete, register the `csrf-csrf` middleware as global middleware.
1616

1717
```typescript
1818
import { doubleCsrf } from 'csrf-csrf';
1919
// ...
2020
// somewhere in your initialization file
2121
const {
22-
invalidCsrfTokenError, // This is just for convenience if you plan on making your own middleware.
23-
generateToken, // Use this in your routes to provide a CSRF hash + token cookie and token.
22+
invalidCsrfTokenError, // This is provided purely for convenience if you plan on creating your own middleware.
23+
generateToken, // Use this in your routes to generate and provide a CSRF hash, along with a token cookie and token.
2424
validateRequest, // Also a convenience if you plan on making your own middleware.
2525
doubleCsrfProtection, // This is the default CSRF protection middleware.
2626
} = doubleCsrf(doubleCsrfOptions);

0 commit comments

Comments
 (0)