Legacy Knowledge Base
公開されました Jun. 30, 2025

ウェブコンテンツのソースからのonclickイベントの自動削除

Written By

Rishabh Agrawal

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

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

1.
以下のコンテンツがオリジナルのコンテンツです:

<div class="Small-ButtonRSecond"><button class="Rbtn" onClick="">Read&nbsp;More<i class="bi bi-arrow-right"></i></button></div>


2. その結果、以下のような出力が得られた:

<div class="Small-ButtonRSecond"><button class="Rbtn">Read&nbsp;More<i class="bi bi-arrow-right"></i></button></div>

再現の手順:
1. LiferayDXP 2024.Q1.5のクリーンインスタンスを起動します。
2. ウェブコンテンツに移動し、基本ウェブコンテンツを作成する。
3. 以下の内容をソース・オプションに貼り付けて、onClickイベントが削除されていることを確認してください。
<div class="Small-ButtonRSecond"><button class="Rbtn" onClick="">Read&nbsp;More<i class="bi bi-arrow-right"></i></button></div>

実績:onClickイベントがソースから削除されています。
期待される結果:onClickイベントがソースに表示されるはずです。

環境

  • 2024.Q1.5

解像度

  1. DXP 2024.Q1.5で削除されたonclickイベントは、セキュリティリスクを防止するための意図的な動作です。
  2. ただし、上記の点はボタンへのonclickイベントだけに限らず、他のイベントにも適用できる。 つまり、ユーザーはソース・タブからどの要素にもイベントを追加できない。
  3. onclick、onerror、onloadのような属性のいくつかは、XSSのようなセキュリティの脆弱性のために、ckeditorのベストプラクティスのドキュメントに従って削除されます。
  4. 上記のckeditorのドキュメントでは、XSS攻撃を防ぐためにソース・モードを無効にすることを強く推奨しているが、ソース・モードの必要性がある以上、これらの攻撃を防ぐためにコンテンツをフィルタリングすることを推奨する。
  5. 報告された懸念に対して、アプリケーション全体に対するセキュリティ上の脅威となる可能性があり、そうすることでポータルに重大なセキュリティリスクをもたらす可能性がある、オンクリックや同様のイベントを許可する代替ソリューションはありません。
Did this article resolve your issue ?

Legacy Knowledge Base