docs(security): stop presenting CORS as an XSS defence - #3086
Open
santhiprakash wants to merge 1 commit into
Open
docs(security): stop presenting CORS as an XSS defence#3086santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
- Problem: operating/security.md told operators to set CORS headers to prevent XSS. CORS relaxes the Same-Origin Policy and is not an XSS defence (prometheus#2449). The same page also claimed Java exporters would get TLS "in the future" and linked the retired golang.org/pkg/crypto/tls docs. - Fix: reword the CORS sentence, document that the JMX exporter already supports TLS, and point crypto/tls links at pkg.go.dev. - Verification: confirmed the stale sentences on current main; jmx_exporter ships Mutual TLS tests; golang.org/pkg/crypto/tls redirects to pkg.go.dev. Signed-off-by: Santhi Prakash <b.santhiprakash@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docs/operating/security.mdcurrently tells operators to set CORS headers such asAccess-Control-Allow-Originto prevent XSS. That is incorrect: CORS relaxes the Same-Origin Policy so a browser on another origin can read responses; it is not an XSS defence.Reported in #2449. Confirmed still present on current
main.The same page has two sibling stale claims in the TLS section:
http/sslintegration tests).crypto/tlsis linked via the retiredgolang.org/pkg/crypto/tlsURLs (they redirect, but the canonical docs are onpkg.go.dev).Triage / Root cause
The CORS sentence is in the API Security section and presents CORS as an XSS control. Maintainers already agreed in #2449 that CORS should not be mentioned as a defence against XSS.
Fix
crypto/tlslinks athttps://pkg.go.dev/crypto/tls.Issue Number
Fixes #2449
Verification
docs/operating/security.mdonupstream/main@8ea3853e— the "to prevent XSS" wording, the Java "in the future" sentence, and thegolang.org/pkg/crypto/tlslinks were all still present.https://golang.org/pkg/crypto/tlsredirects tohttps://pkg.go.dev/crypto/tls.MutualTLSWithAuthTest/MutualTLSWithCustomCiphersTest.Notes / Risks