HostヘッダーのXSS攻撃を防止する
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
問題
- リクエストからHostヘッダーを調整することで、ページのレンダリングなどに影響がある
環境
- Liferay DXP 7.0, Liferay DXP 7.1
解決
- LiferayはHostを確認するサーブレットフィルター機能が搭載されています
#
# The valid host name filter will check the host name from request's
# host header. It rejects a request with invalid server name to prevent XSS
# and other host header manipulation attacks.
#
# Env: LIFERAY_COM_PERIOD_LIFERAY_PERIOD_PORTAL_PERIOD_SERVLET_PERIOD_FILTERS_PERIOD_VALIDHOSTNAME_PERIOD__UPPERCASEV_ALID_UPPERCASEH_OST_UPPERCASEN_AME_UPPERCASEF_ILTER
#
com.liferay.portal.servlet.filters.validhostname.ValidHostNameFilter=true
- このフィルターを有効にした場合(デフォルト)、以下のプロパティで指定したドメインに沿って確認します
#
# Input a list of comma delimited valid domains and IPs that the portal is
# allowed to use.
#
# Env: LIFERAY_VIRTUAL_PERIOD_HOSTS_PERIOD_VALID_PERIOD_HOSTS
#
virtual.hosts.valid.hosts=*
#virtual.hosts.valid.hosts=localhost,127.0.0.1,[::1],[0:0:0:0:0:0:0:1]
- ドメインの確認を行いたい場合は、ご利用中のドメインを上記プロパティに設定します
did-this-article-resolve-your-issue