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
5454csrf_ignore_path =
5555csrf_max_tokens =100
5656csrf_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(
233233 $ csrfTokenStore ->verify ($ _POST );
234234 }
235235
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+ };
236240 $ protector = new HTMLDocumentProtector ($ viewModel , $ csrfTokenStore );
237- $ tokens = $ protector ->protect (HTMLDocumentProtector:: ONE_TOKEN_PER_FORM );
241+ $ tokens = $ protector ->protect ($ sharing );
238242 $ response = $ response ->withHeader ($ this ->config ->getString ("security.csrf_header " ), $ tokens );
239243 }
240244 }
You can’t perform that action at this time.
0 commit comments