This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch chore/build-maintenance in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit 51e8efc0dc04a2f07152e80f9cdc5751fdbe224f Author: Claus Ibsen <[email protected]> AuthorDate: Sun Nov 29 13:52:09 2026 +0100 chore: align the .htaccess security headers and vary HTML on Accept - Vary: Accept on HTML responses. mod_rewrite adds it only when the Markdown negotiation rewrites, so the HTML variant of the same URL was served without it and a cache in front of the site could hand stored HTML to an agent asking for Markdown, or the reverse. - Strict-Transport-Security: use the value that is actually served (max-age=31536000; includeSubDomains; preload), which the ASF infrastructure sets for apache.org and which overrides this file. - X-XSS-Protection: 0, as OWASP recommends; the filter is gone from current browsers and 1; mode=block could be abused where it remains. - Referrer-Policy: strict-origin-when-cross-origin instead of no-referrer-when-downgrade, which sent full URLs to other sites. - Add Permissions-Policy (camera, microphone and geolocation off) and Cross-Origin-Opener-Policy: same-origin-allow-popups. The Content-Security-Policy is unchanged (#1427). Refs #1882 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y4dDj46SB6GniXf8mX2U6 --- static/.htaccess | 64 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/static/.htaccess b/static/.htaccess index a1d6b6fa..7f24322f 100644 --- a/static/.htaccess +++ b/static/.htaccess @@ -14,6 +14,14 @@ RewriteCond %{HTTP_ACCEPT} text/markdown [NC] RewriteCond %{REQUEST_FILENAME} ^(.+)\.html$ RewriteCond %1.md -f RewriteRule ^(.+)\.html$ $1.md [L] +# mod_rewrite only adds "Vary: Accept" when one of the rules above rewrites, so +# the Markdown response has it and the HTML response of the same URL does not. +# A cache in front of the site (the CDN) could then serve a stored HTML copy to +# an agent asking for Markdown. Every HTML response may have a Markdown variant, +# so they all vary on Accept. +<IfModule mod_headers.c> + Header merge Vary Accept "expr=%{CONTENT_TYPE} =~ m#text/html#i" +</IfModule> RewriteRule "^security-advisories.data/(.+)$" "security/$1" [R=permanent,L] @@ -1508,12 +1516,11 @@ AddDefaultCharset utf-8 # https://www.html5rocks.com/en/tutorials/security/transport-layer-security/ # https://blogs.msdn.microsoft.com/ieinternals/2014/08/18/strict-transport-security/ +# camel.apache.org is served with the value the ASF infrastructure sets for +# apache.org (on the HSTS preload list with its subdomains), which overrides +# the one here; keep the two the same so this file shows what is served. <IfModule mod_headers.c> - Header always set Strict-Transport-Security "max-age=16070400; includeSubDomains" env=HTTPS - # (1) or if HSTS preloading is desired (respect (2) for current requirements): - # Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS - # (4) respectively… (respect (2) for current requirements): - # Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" "expr=%{HTTPS} == 'on'" + Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS </IfModule> # ---------------------------------------------------------------------- @@ -1572,9 +1579,13 @@ AddDefaultCharset utf-8 # https://blogs.msdn.microsoft.com/ieinternals/2011/01/31/controlling-the-xss-filter/ # https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29 +# The XSS filter is gone from current browsers, and where it still exists +# "1; mode=block" can itself be abused to leak information from a page. OWASP +# recommends disabling it and relying on the Content-Security-Policy above: +# https://cheatsheetseries.owasp.org/cheatsheets/HTTP_Headers_Cheat_Sheet.html#x-xss-protection + <IfModule mod_headers.c> - # (1) (2) - Header set X-XSS-Protection "1; mode=block" "expr=%{CONTENT_TYPE} =~ m#text/html#i" + Header set X-XSS-Protection "0" "expr=%{CONTENT_TYPE} =~ m#text/html#i" </IfModule> # ---------------------------------------------------------------------- @@ -1595,12 +1606,39 @@ AddDefaultCharset utf-8 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy <IfModule mod_headers.c> - # no-referrer-when-downgrade (default) - # This should be the user agent's default behavior if no policy is - # specified.The origin is sent as referrer to a-priori as-much-secure - # destination (HTTPS->HTTPS), but isn't sent to a less secure destination - # (HTTPS->HTTP). - Header set Referrer-Policy "no-referrer-when-downgrade" "expr=%{CONTENT_TYPE} =~ m#text/html#i" + # strict-origin-when-cross-origin, the default of current browsers: the + # full URL is sent within the site, only the origin to other HTTPS sites, + # and nothing over HTTP. no-referrer-when-downgrade, used before, sent the + # full URL of the page to every other site. + Header set Referrer-Policy "strict-origin-when-cross-origin" "expr=%{CONTENT_TYPE} =~ m#text/html#i" +</IfModule> + +# ---------------------------------------------------------------------- +# | Permissions Policy | +# ---------------------------------------------------------------------- + +# The site uses none of these browser features, so no page, and no frame +# embedded in one (such as a YouTube video), may ask for them. +# +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy + +<IfModule mod_headers.c> + Header set Permissions-Policy "camera=(), microphone=(), geolocation=()" "expr=%{CONTENT_TYPE} =~ m#text/html#i" +</IfModule> + +# ---------------------------------------------------------------------- +# | Cross-Origin Opener Policy | +# ---------------------------------------------------------------------- + +# Puts the pages in their own browsing context group, so a cross-origin page +# that opens one cannot reach it through window.opener. +# same-origin-allow-popups keeps the windows the site opens itself, such as +# the share links on blog posts, working. +# +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy + +<IfModule mod_headers.c> + Header set Cross-Origin-Opener-Policy "same-origin-allow-popups" "expr=%{CONTENT_TYPE} =~ m#text/html#i" </IfModule> # ######################################################################
