Skip to content

Potential fix for code scanning alert no. 1045: Missing cross-site request forgery token validation#699

Draft
KrzysztofPajak wants to merge 1 commit into
developfrom
alert-autofix-1045
Draft

Potential fix for code scanning alert no. 1045: Missing cross-site request forgery token validation#699
KrzysztofPajak wants to merge 1 commit into
developfrom
alert-autofix-1045

Conversation

@KrzysztofPajak
Copy link
Copy Markdown
Member

Potential fix for https://github.com/grandnode/grandnode2/security/code-scanning/1045

To fix this, add ASP.NET Core’s anti-forgery validation attribute to the POST overload of TwoFactorAuthorization.

Best single fix (without changing functionality): in src/Web/Grand.Web.AdminShared/Controllers/BaseLoginController.cs, add [ValidateAntiForgeryToken] directly above the [HttpPost] TwoFactorAuthorization method (the overload taking string token). No new imports are needed because Microsoft.AspNetCore.Mvc is already present and contains ValidateAntiForgeryTokenAttribute.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…quest forgery token validation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant