File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -54,3 +54,5 @@ csrf_header=X-CSRF
54
54
csrf_ignore_path =
55
55
csrf_max_tokens =100
56
56
csrf_token_length =10
57
+ ; Generate tokens once "per-form" or once "per-page"
58
+ csrf_token_sharing =per-page
Original file line number Diff line number Diff line change @@ -233,8 +233,12 @@ public function handle(
233
233
$ csrfTokenStore ->verify ($ _POST );
234
234
}
235
235
236
+ $ sharing = match ($ this ->config ->getString ("security.csrf_token_sharing " )) {
237
+ "per-page " => HTMLDocumentProtector::ONE_TOKEN_PER_PAGE ,
238
+ default => HTMLDocumentProtector::ONE_TOKEN_PER_FORM ,
239
+ };
236
240
$ protector = new HTMLDocumentProtector ($ viewModel , $ csrfTokenStore );
237
- $ tokens = $ protector ->protect (HTMLDocumentProtector:: ONE_TOKEN_PER_FORM );
241
+ $ tokens = $ protector ->protect ($ sharing );
238
242
$ response = $ response ->withHeader ($ this ->config ->getString ("security.csrf_header " ), $ tokens );
239
243
}
240
244
}
You can’t perform that action at this time.
0 commit comments