Skip to content
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

想定しない脆弱性を防ぐため default modifier に HTMLPurifier を適用する #1066

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nanasess
Copy link
Contributor

@nanasess nanasess commented Nov 22, 2024

fixes #710

想定しない脆弱性を防ぐため default modifier に HTMLPurifier を適用する。
サニタイズされる内容が既存のコンテンツに悪影響を与えないかどうか要検証。

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.60%. Comparing base (a22be23) to head (1cc9481).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1066      +/-   ##
==========================================
- Coverage   51.67%   51.60%   -0.07%     
==========================================
  Files          80       80              
  Lines       10224    10224              
==========================================
- Hits         5283     5276       -7     
- Misses       4941     4948       +7     
Flag Coverage Δ
tests 51.60% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@nanasess nanasess marked this pull request as draft November 22, 2024 08:18
@nanasess
Copy link
Contributor Author

サニタイズされる内容が既存のコンテンツに悪影響を与えないかどうか要検証。

  • mtb_allowed_tag によって許可されているタグは、HTMLPurifier でも許可タグとなっているため削除されないことを確認済
  • その他、input タグや textarea タグなど、許可タグ以外は HTMLPurifier によって削除されてしまうが、2.17 より HTML をそのまま出力する Smarty 変数は明示的に nofilter を付与するようにしているため、大きな影響は無いと思われる

id 属性が重複するとよろしくないが、厳密にサニタイズするよりも後方互換
性を優先する
@nanasess nanasess marked this pull request as ready for review November 23, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ezyang/htmlpurifier の導入
1 participant