Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Forward IDisableCorsAttribute to a more broadly-used package #134

Closed
dougbu opened this issue Nov 23, 2017 · 7 comments
Closed

Forward IDisableCorsAttribute to a more broadly-used package #134

dougbu opened this issue Nov 23, 2017 · 7 comments

Comments

@dougbu
Copy link
Member

dougbu commented Nov 23, 2017

IDisableCorsAttribute and DisableCorsAttribute are located in the Microsoft.AspNetCore.Cors package. This means external frameworks and extensions must reference those packages just to disable the possibly-conflicting features, even if they are aimed at API controllers. That is, they may need to reference Cors to disable CORS in case their consumers reference that package -- but for no other reason.

Hit this and aspnet/Mvc#7076 while working on the ASP.NET Core WebHooks implementation. No action associated with the WebHookAttribute needs antiforgery checks or CORS support. But, the containing Microsoft.AspNetCore.WebHooks.Receivers package would need to reference the Cors and MVC's ViewFeatures packages to disable both.

One possible landing spot for the interface would be be the Microsoft.AspNetCore.Http.Abstractions package.

@Eilon
Copy link
Member

Eilon commented Nov 27, 2017

What is the connection between CORS and Web Hooks? Web Hooks are triggered by other servers (e.g. Office 365, GitHub, etc.), whereas CORS is a browser security feature that applies to AJAX requests.

@dougbu
Copy link
Member Author

dougbu commented Nov 27, 2017

More the opposite of a connection: It's sensible to disable CORS for WebHook actions.

@Eilon
Copy link
Member

Eilon commented Nov 27, 2017

My question is when does CORS even apply to this? CORS is used only by browsers, but when is a browser ever calling a web hook?

@dougbu
Copy link
Member Author

dougbu commented Nov 27, 2017

If a browser called a web hook, why enable CORS? Except in a the rare case of a receiver that implements "ping" using a simple GET, the request should always fail -- but due to the receiver's normal rules, not because CORS blocks it.

@Eilon
Copy link
Member

Eilon commented Nov 27, 2017

Browsers never call web hooks, do they?

@dougbu
Copy link
Member Author

dougbu commented Nov 27, 2017

Browsers can call almost-any ASP.NET Core endpoint. A WebHooks endpoint is just another URL on the Internet.

@Eilon
Copy link
Member

Eilon commented Nov 27, 2017

The question isn't whether they can - my thermostat can make web calls too, but I don't know whether it supports CORS 😄 The question is whether it's a scenario that happens in practice, and I can't think of a case where it does.

@Eilon Eilon closed this as completed Nov 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants