-
Notifications
You must be signed in to change notification settings - Fork 322
Fix/#3235 fixed session manage #3236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/2.8.1
Are you sure you want to change the base?
Conversation
- Fixed session-fixation-protection, change on newSession (spring-security.xml); - Force http-only and secure for cookies (web.xml);
- Corrected spring-security.xml
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughSession security configuration is enhanced across two files: session-fixation protection policy is changed from "none" to "newSession" in spring-security.xml, and session cookie security attributes (http-only and secure) are enabled in web.xml. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
WebContent/WEB-INF/spring-security.xmlWebContent/WEB-INF/web.xml
🔇 Additional comments (2)
WebContent/WEB-INF/spring-security.xml (2)
29-29: LGTM: Session fixation protection enabled for API and service endpoints.Changing
session-fixation-protectionfrom"none"to"newSession"is a critical security improvement that mitigates session fixation attacks. When a user authenticates, Spring Security will now create a fresh session and invalidate the old one, preventing attackers from hijacking pre-set session IDs.This change is applied consistently across all API and service security configurations (
/services/**,/httpds/**,/httpds-secure/**,/api/secure/work-items/**,/api/secure/threads/**).Verify that no external integrations or automated clients depend on session IDs persisting across authentication events.
Also applies to: 52-52, 75-75, 98-98, 121-121
450-450: LGTM: Session fixation protection enabled for web application.Enabling
session-fixation-protection="newSession"for the main application security context is a best practice that prevents session fixation attacks. Combined with the logout configuration on line 451 (invalidate-session="true" delete-cookies="JSESSIONID"), this provides comprehensive session security.Ensure that any custom session management code or third-party integrations are compatible with session regeneration on authentication.
| <cookie-config> | ||
| <http-only>true</http-only> | ||
| <secure>true</secure> | ||
| </cookie-config> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Check if spring-security.xml exists and examine HTTPS enforcement
if [ -f "WebContent/WEB-INF/spring-security.xml" ]; then
echo "=== Paths without HTTPS enforcement in spring-security.xml ==="
rg -n 'intercept-url' WebContent/WEB-INF/spring-security.xml | head -30
echo ""
echo "=== Count summary ==="
echo "Total intercept-url patterns:"
rg -c 'intercept-url' WebContent/WEB-INF/spring-security.xml
echo ""
echo "Patterns with HTTPS enforcement:"
rg 'intercept-url.*requires-channel="https"' WebContent/WEB-INF/spring-security.xml | wc -l
else
echo "spring-security.xml not found at WebContent/WEB-INF/spring-security.xml"
# Try to find it
find . -name "spring-security.xml" -type f
fiRepository: SCADA-LTS/Scada-LTS
Length of output: 2957
🏁 Script executed:
# Also check web.xml context around session-config to understand full configuration
echo "=== web.xml session-config context ==="
rg -B 5 -A 10 '<session-config>' WebContent/WEB-INF/web.xml || echo "No session-config found"
# Check for any RemoteIpValve or proxy configuration
echo ""
echo "=== Checking for RemoteIpValve or proxy configuration ==="
rg -i 'remoteipvalve|x-forwarded|proxy' WebContent/WEB-INF/ || echo "No proxy valve configuration found"Repository: SCADA-LTS/Scada-LTS
Length of output: 5370
🏁 Script executed:
# Get full context of HTTP/HTTPS configuration in spring-security.xml
echo "=== HTTP configuration block in spring-security.xml ==="
rg -B 3 -A 50 '<http[^-]' WebContent/WEB-INF/spring-security.xml | head -80Repository: SCADA-LTS/Scada-LTS
Length of output: 3841
Critical: secure flag will break authentication over HTTP.
The <secure>true</secure> flag ensures session cookies are only transmitted over HTTPS. However, examination of spring-security.xml reveals that only 8 out of 213 intercept-url patterns enforce HTTPS—meaning 96% of application paths allow HTTP access. This includes login, logout, static assets, and WebSocket endpoints. When users access via HTTP (which is explicitly permitted), the session cookie will not be sent by the browser, breaking authentication.
No RemoteIpValve or reverse proxy HTTPS termination configuration was detected.
Required action: Choose one approach:
- Enforce HTTPS globally by adding
requires-channel="https"to all intercept-url patterns in spring-security.xml - Remove the
secureflag if HTTP access must be supported - Implement HTTPS termination at a reverse proxy (nginx, Apache) and configure Tomcat's RemoteIpValve to recognize it
The <http-only>true</http-only> flag is correct and should remain.
🤖 Prompt for AI Agents
In WebContent/WEB-INF/web.xml around lines 447 to 450, the cookie-config sets
<secure>true</secure> which prevents session cookies from being sent over plain
HTTP and thus breaks authentication for most application paths; fix by choosing
one of the three actions and implement it: (A) if you want to enforce HTTPS
everywhere, update spring-security.xml to add requires-channel="https" to all
intercept-url entries (or add a global requires-channel rule) so all traffic is
HTTPS-only; (B) if HTTP must remain supported, remove the <secure>true</secure>
line from web.xml (leaving <http-only>true</http-only> intact); or (C) terminate
HTTPS at a reverse proxy and configure Tomcat’s RemoteIpValve so the app sees
requests as secure (add/configure RemoteIpValve in server.xml and ensure the
proxy forwards X-Forwarded-Proto), then keep <secure>true</secure>.
- Removed tag <secure>
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.