Skip to content

Document antiforgery skip in AntiforgeryMiddleware for DELETE via HttpMethodOverride #66687

@cincuranet

Description

@cincuranet

This is not a common combination of pieces, but should be properly documented anyway. Maybe Roslyn analyzer could help here as well.

  1. Server developer added HttpMethodOverrideMiddleware (which is not default).
  2. Configured with form field mode (FormFieldName set) - header mode triggers CORS preflight and is not cross-origin exploitable.
  3. Method override registered before antiforgery in the pipeline.
  4. Target endpoint uses antiforgery.
  5. The endpoint accepts DELETE (or another non-POST/PUT/PATCH method).

We can explicitly document that AntiforgeryMiddleware and extensions like app.UseAntiforgery() only support checking a subset of methods (POST, PUT and PATCH), and if user needs other HTTP methods validated, they can resolve IAntifogery and validate the request explicitly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsThis issue tracks updating documentationarea-security

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions