ATLAS-5160: Remove deprecated X-XSS-PROTECTION header from HTTP response headers initialization and Atlas Spring Security Config#482
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the deprecated X-XSS-Protection header from Atlas HTTP responses. The X-XSS-Protection header is no longer supported by modern browsers and has been superseded by the Content-Security-Policy header.
Key Changes:
- Removed X_XSS_PROTECTION_KEY and X_XSS_PROTECTION_VAL constants from HeadersUtil
- Disabled XSS protection at the Spring Security level by adding
.xssProtection().disable()to prevent Spring Security from automatically adding the header - Updated test files to remove assertions and mock configurations related to the deprecated header
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| webapp/src/main/java/org/apache/atlas/web/filters/HeadersUtil.java | Removed X-XSS-Protection constants and removed initialization of the header in the HEADER_MAP |
| webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java | Added .xssProtection().disable() to the Spring Security configuration to prevent automatic addition of the deprecated header |
| webapp/src/test/java/org/apache/atlas/web/filters/HeaderUtilsTest.java | Removed test assertion that validated the presence of X-XSS-Protection header |
| webapp/src/test/java/org/apache/atlas/web/security/AtlasSecurityConfigTest.java | Added mock setup for XXssConfig in both setupHttpSecurityMocksFor and setupHttpSecurityMocks methods to support the new xssProtection().disable() call chain |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| httpSecurity.authorizeRequests().anyRequest().authenticated() | ||
| .and() | ||
| .headers() | ||
| // Why disable() xssProtection -> By default Spring Security automatically adds security headers unless you disable them. No Modern Browsers support and its replaced by "Content-Security-Policy" |
There was a problem hiding this comment.
The comment contains a grammatical error. "No Modern Browsers support" should be "No modern browsers support" (lowercase 'm') and should say "support it" for clarity. Consider revising to: "By default Spring Security automatically adds security headers unless you disable them. No modern browsers support it and it's replaced by 'Content-Security-Policy'"
| // Why disable() xssProtection -> By default Spring Security automatically adds security headers unless you disable them. No Modern Browsers support and its replaced by "Content-Security-Policy" | |
| // Why disable() xssProtection -> By default Spring Security automatically adds security headers unless you disable them. No modern browsers support it and it's replaced by "Content-Security-Policy" |
webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java
Show resolved
Hide resolved
…nse headers initialization and Atlas Spring Security Config
16f4652 to
f13a5a0
Compare
What changes were proposed in this pull request?
How was the patch tested?