Replies: 2 comments
-
Hello @musaka872, You seem to be right, this indeed looks like a bug. I've created a ticket out of it. Would you like to provide a PR with the fix? |
Beta Was this translation helpful? Give feedback.
-
Interesting, I am also facing a similar problem. The difference is I have enabled tokenPerPage. @forgedhallpass is there any config changes required for tokenPerPage? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to integrate csrfguard 4.3.0 in our project.
I've configured it to use per-session tokens and not per-page tokens. But when I receive the token in the response header it is returned as page token in this form
{pageTokens:{"/page/uri":"csrf-token"}}
and then when I send this token in a subsequent request csrfguard compares {pageTokens:{"/page/uri":"csrf-token"}} to "csrf-token" and it fails.I debugged CsrfGuardFilter and in handleSession method we have:
In generateTokenIfAbsent it checks whether the per-page or master token should be generated and generates the correct master token. But then as you can see when TokenTO is created the master token is passed as per-page token and it is send as such in the response header.
Is this a bug or I'm missing something?
I don't want to parse the response header to retrieve the "csrf-token" that csrfguard returns.
Best regards,
Martin
Beta Was this translation helpful? Give feedback.
All reactions