Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress Check For Unhandled Security Metadata #16437

Merged
merged 3 commits into from
Jul 18, 2024
Merged

Conversation

MikeAlhayek
Copy link
Member

Fix #16429

/cc: @kevinchalet

@Piedone
Copy link
Member

Piedone commented Jul 12, 2024

I don't really know what this is about, so will have to defer to Kévin.

{
// The Cors module is designed to handle CORS, thus we skip checking for unhandled security metadata by default.
// Additionally, skipping security metadata checks on the endpoint provides a minor performance benefit.
options.SuppressCheckForUnhandledSecurityMetadata = true;
Copy link
Member

@hishamco hishamco Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes a check for a misconfigured application.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could OC end up being misconfigured?

We could configure this using a configuration provider and then set it to false just to ensure that all tests pass with it being false but use true by default

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I forgot to reply to this, it's something related to what @gvkries refers to in #16437 (comment)

@kevinchalet
Copy link
Member

I don't really know what this is about, so will have to defer to Kévin.

SuppressCheckForUnhandledSecurityMetadata = true disables the sanity checks performed by the ASP.NET Core routing stack to ensure the antiforgery, authorization and CORS middleware are present in the pipeline when any of the MVC actions/minimal actions is decorated with a related attribute (e.g [Authorize]).

It's a bit annoying we can't just opt out the CORS check, but the only other option I can think of is to make the OpenID module depend on CORS so the ASP.NET CORS middleware is always present in the pipeline.

@gvkries
Copy link
Contributor

gvkries commented Jul 15, 2024

I don't think it is a good idea to suppress all of these checks for the whole application.

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.

(OrchardCore.OpenId) contains CORS metadata, but a middleware was not found that supports CORS.
6 participants