【发布时间】:2021-01-08 02:50:14
【问题描述】:
我正在根据安全扫描报告对我的应用程序进行安全增强。我的应用程序是一个在wildfly 中运行的Java EE Web 应用程序。它通过一个反向代理服务器 Apache 暴露给用户。
我在 Wildfly 中的standalone.xml 文件中进行了以下更改,以启用严格的传输安全性和 httponly 属性。
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<http-invoker security-realm="ApplicationRealm"/>
<filter-ref name="x-frame-options"/>
<filter-ref name="x-xss-protection"/>
<filter-ref name="x-content-type-options"/>
<filter-ref name="transport-security"/>
</host>
</server>
<servlet-container name="default">
<jsp-config x-powered-by="false"/>
<session-cookie http-only="true" secure="true"/>
<websockets/>
</servlet-container>
但是,当我转到应用程序页面并检查网络选项卡中的响应时,我看到重复的属性。
Request Method: GET
Status Code: 200 OK
Referrer Policy: strict-origin-when-cross-origin
Connection: Keep-Alive
Content-Length: 4222
Content-Type: text/html;charset=ISO-8859-1
Date: Fri, 08 Jan 2021 02:36:52 GMT
Keep-Alive: timeout=5, max=99
Server: Apache
SET-COOKIE: JSESSIONID=BOH0IrY-e2q24ks1bbMy9bBzqeDZshm1n1O02G_f; Path=/MyApplication; HttpOnly
SET-COOKIE: JSESSIONID=BOH0IrY-e2q24ks1bbMy9bBzqeDZshm1n1O02G_f.application_uat; path=/MyApplication; secure; HttpOnly
Strict-Transport-Security: max-age=63072000; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
另外,JSESSIONID 一方面是安全的,另一方面是不安全的。我没有处理 Apache 服务器的配置。可能是因为 Apache 服务器的某些配置?我对此很陌生,所以感谢一些帮助来解决这个问题。
谢谢。
【问题讨论】:
-
是的,这可能是由于某些 apache 配置基于严格传输安全的不同值,在这种情况下,apache 不应该处理标头,而只是通过标头,如果您与 apache 服务器团队交谈,他们可以在响应通过 apache 之前和之后检查响应
标签: java apache security wildfly wildfly-15