Add option to validate ElementTree during serialization
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Feature or enhancement
Proposal:
ElementTree can be serialized to XML and HTML formats. While special characters like & and < are escaped in text and attribute values, there is no way to escape arbitrary characters in element and attribute names, comments, processing instructions and HTML elements like <script>. Also, not all characters can be represented in XML and HTML, for example the null character cannot.
This is usually not a problem, because the structure of the element tree is usually hardcoded and variable parts have reasonable values. But if the element tree is constructed using arbitrary user data, it is possible to inject some elements. For example, if the comment is '--><tag>...</tag><!--'.
It is considered the user's responsibility to ensure that the element tree is valid. But we can help them. The proposed PR add the validate option to serialization functions which enables validation if true. It is the option of serialization because rules are different for XML and HTML.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-149469
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ElementTree の XML および HTML シリアライゼーション関数から始め、この提案を実装するものとして特定されている、リンクされた PR gh-149469 を調査してください。シリアライゼーションが提案されたバリデーションオプションを受け付け、ここで説明されている文字およびインジェクションのケースを含め、XML と HTML に適切なバリデーションルールを適用すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100