Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions WebContent/WEB-INF/spring-security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<custom-filter ref="xssFilter" before="FIRST"/>
<custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthFilter"/>
<session-management session-fixation-protection="none" />
<session-management session-fixation-protection="newSession" />
</http>

<http use-expressions="true" disable-url-rewriting="true" pattern="/httpds/**"
Expand All @@ -49,7 +49,7 @@

<custom-filter ref="xssFilter" before="FIRST"/>
<custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthFilter"/>
<session-management session-fixation-protection="none" />
<session-management session-fixation-protection="newSession" />
</http>

<http use-expressions="true" disable-url-rewriting="true" pattern="/httpds-secure/**"
Expand All @@ -72,7 +72,7 @@

<custom-filter ref="xssFilter" before="FIRST"/>
<custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthFilter"/>
<session-management session-fixation-protection="none"/>
<session-management session-fixation-protection="newSession" />
</http>

<http use-expressions="true" disable-url-rewriting="true" pattern="/api/secure/work-items/**"
Expand All @@ -95,7 +95,7 @@

<custom-filter ref="xssFilter" before="FIRST"/>
<custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthFilter"/>
<session-management session-fixation-protection="none"/>
<session-management session-fixation-protection="newSession" />
</http>

<http use-expressions="true" disable-url-rewriting="true" pattern="/api/secure/threads/**"
Expand All @@ -118,7 +118,7 @@

<custom-filter ref="xssFilter" before="FIRST"/>
<custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthFilter"/>
<session-management session-fixation-protection="none"/>
<session-management session-fixation-protection="newSession" />
</http>

<http use-expressions="true" disable-url-rewriting="true"
Expand Down Expand Up @@ -447,7 +447,7 @@
login-processing-url="/login.htm"/>
<custom-filter ref="xssFilter" before="FIRST"/>
<custom-filter after="SECURITY_CONTEXT_FILTER" ref="setDataSessionFilter" />
<session-management session-fixation-protection="none" />
<session-management session-fixation-protection="newSession" />
<logout logout-url="/logout.htm" invalidate-session="true" delete-cookies="JSESSIONID"
success-handler-ref="headerWriterLogoutHandler"/>
</http>
Expand Down
3 changes: 3 additions & 0 deletions WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@
</listener>
<session-config>
<session-timeout>30</session-timeout>
<cookie-config>
<http-only>true</http-only>
</cookie-config>
Comment on lines +447 to +449
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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
fi

Repository: 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 -80

Repository: 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:

  1. Enforce HTTPS globally by adding requires-channel="https" to all intercept-url patterns in spring-security.xml
  2. Remove the secure flag if HTTP access must be supported
  3. 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>.

</session-config>
<welcome-file-list>
<welcome-file>home.jsp</welcome-file>
Expand Down
Loading