Problem/Motivation
The response header contains the X-Content-Type-Options header twice. Which can scramble security scanning tools.
For example, I recently saw tweets about headers and security https://twitter.com/Stargayte/status/1260654141421961216.
And I have tested https://observatory.mozilla.org/ on my personal website. And among the results, there is:
X-Content-Type-Options header cannot be recognized
The header is present but twice with the same value.
I think one comes from the .htaccess: https://git.drupalcode.org/project/drupal/-/blob/9.0.x/core/assets/scaff...
And the other one from an EventSubscriber: https://git.drupalcode.org/project/drupal/-/blob/9.0.x/core/lib/Drupal/C...
I don't doubt that the effect of the header is correctly applied. But I think it can reassure people testing their website with such tools.
And yes, I also agree that it can easily be fixed with server configuration. But the goal of the issue is to fix out-of-the-box behavior.
Proposed resolution
Remove the directive in .htaccess because the one in the event subscriber can also apply to other webservers than Apache.
Remaining tasks
- Agree on the solution
- Make a patch
- Make a change record?
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
Comments
Comment #2
longwaveThanks for the detailed bug report!
Solving this is trickier than it seems because of differences in Apache versions, please see #2854817: Duplicate X-Content-Type-Options headers both with the value nosniff where there is an ongoing effort to fix this problem.
Closing this issue as duplicate.
Comment #3
grimreaperThanks a lot for the quick reply and sorry for the duplicate.
Before creating the issue. I searched "X-Content-Type-Options" (without quotes) in the issue queue, both open and closed issues and there was no result.
Thanks again, I will take a look at the other issue!