AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Do not promote using the CSP directive "block-all-mixed-content"

Open yugabe opened this issue 3 years ago • 2 comments

Based on the relevant MDN articles, block-all-mixed-content and upgrade-insecure-requests, the block-all-mixed-content is considered obsolete, and using both is never recommended.


CSP: block-all-mixed-content Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Warning: This directive is marked as obsolete in the specification: all mixed content is now blocked if it can't be autoupgraded.


CSP: upgrade-insecure-requests Note: The upgrade-insecure-requests directive is evaluated before block-all-mixed-content and if it is set, the latter is effectively a no-op. It is recommended to set either directive, but not both, unless you want to force HTTPS on older browsers that do not force it after a redirect to HTTP.

I suggest removing the CSP directive block-all-mixed-content from the page and leave only upgrade-insecure-requests, as it will be as secure as the alternative, but won't produce errors on the page, and will rewrite URLs to HTTPS endpoints.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

yugabe avatar Jul 20 '22 11:07 yugabe

Thanks, @yugabe. We'll discuss here first before moving to the PR phase.

@mkArtakMSFT ... We'll need to triage this for the PU to take a look before proceeding given that what we show has been provided and approved by engineering. IIRC, Tanay was the last engineer to assist with the CSP config on https://github.com/dotnet/AspNetCore.Docs/pull/23365. We'll also need to scope the version(s) for any updates.

Cross-refs:

  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content
  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests

guardrex avatar Jul 20 '22 11:07 guardrex

UPDATE (8/11): Very sorry for the delay! There's a delay due to the work for the upcoming .NET 7 release. We'll get to this ASAP, but I don't have an ETA at this time.

guardrex avatar Aug 11 '22 14:08 guardrex