Skip to content

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

Merged
gladjohn merged 2 commits into
masterfrom
alert-autofix-35
Jul 7, 2026
Merged

Potential fix for code scanning alert no. 35: Missing cross-site request forgery token validation#3929
gladjohn merged 2 commits into
masterfrom
alert-autofix-35

Conversation

@gladjohn

@gladjohn gladjohn commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/AzureAD/microsoft-identity-web/security/code-scanning/35

Add ASP.NET Core anti-forgery validation to the POST action by decorating Post with [ValidateAntiForgeryToken].
This is the minimal, targeted fix for the flagged method and does not change business logic.

File/region to change:

  • tests/DevApps/B2CWebAppCallsWebApi/TodoListService/Controllers/TodoListController.cs
  • Around the Post action attributes (currently [HttpPost] and [RequiredScope("write")]).

What is needed:

  • No new imports are required because ValidateAntiForgeryTokenAttribute is in Microsoft.AspNetCore.Mvc, which is already imported.
  • Add one attribute line above Post.

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

…est forgery token validation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@gladjohn
gladjohn marked this pull request as ready for review July 7, 2026 14:04
@gladjohn
gladjohn requested a review from a team as a code owner July 7, 2026 14:04
@gladjohn
gladjohn merged commit a4588a9 into master Jul 7, 2026
5 checks passed
@gladjohn
gladjohn deleted the alert-autofix-35 branch July 7, 2026 15:16
This was referenced Jul 10, 2026
This was referenced Jul 15, 2026
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.

3 participants