A processing instruction with no target passes validation, then the builder prints invalid XML
メンテナーはふだん 4 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
- 領域
- backend, testing-qa
調査の方向性
まず XMLValidator の処理命令の検証経路を確認し、<?x?> と <? ?> の処理を、issue で説明されている XML PI 文法と比較してください。提示された Node.js の例を使って、parser と builder の動作を確認してください。検証で無効な target のケースが拒否されるか、parsing でスキップされ、その結果 builder が無効な XML を生成しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
- Are you running the latest version?
- Have you included sample input, output, error, and expected output?
- Have you checked if you are using correct configuration?
- Did you try online tool?
- Have you checked the docs for helpful APIs and examples?
Description
Hello,
While fuzzing [email protected] (the latest version) with Termo, a fuzzer I'm developing, I found that XMLValidator accepts a processing instruction with no target name (<?>x?>). XMLParser then returns a node with an empty tag name, and XMLBuilder turns it into <></>, which is not XML:
// [email protected], Node.js v26.13.0
const { XMLValidator, XMLParser, XMLBuilder } = require('fast-xml-parser');
const options = { ignoreAttributes: false, preserveOrder: true };
const input = '<?>x?><r/>';
console.log(XMLValidator.validate(input)); // true
const parsed = new XMLParser(options).parse(input);
console.log(JSON.stringify(parsed)); // [{"":[{"#text":""}]},{"r":[]}]
const built = new XMLBuilder(options).build(parsed);
console.log(built); // <></><r></r>
console.log(XMLValidator.validate(built) === true); // false
Without a target (<?>) validation already fails as it should. With a body (<?>x?>) it passes. The XML spec requires a name right after <? (PI ::= '<?' PITarget (S ...)? '?>').
<? ?><r/> is similar: it validates, and parses into a node named "?", which the builder prints as <??>.
Expected: the validator rejects a processing instruction with no target (or else the parser skips it), so the builder never prints an element with an empty name.
Happy to test a fix against these inputs if it helps.
If you'd like me to keep fuzzing fast-xml-parser (other parts of the API, or re-checking after a fix), feel free to reach out. I'd be glad to keep working on it with you.
Thanks!
- 主要言語
- JavaScript
- スター
- 3.1k
- フォーク
- 410
- 平均マージ
- 4日 15時間
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NaturalIntelligence/fast-xml-parser のほかの issue
-
XMLValidator accepts double hyphens inside comments対応中かも @Sskift が 16 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NaturalIntelligence/fast-xml-parser#903 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
XMLValidator accepts raw < and & in attribute values対応中かも @jeromeyyy が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NaturalIntelligence/fast-xml-parser#900 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
getMetaDataSymbol() declares a boxed Symbol対応中かも @chiragbitoni が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
NaturalIntelligence/fast-xml-parser#890 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
NaturalIntelligence/fast-xml-parser#888 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
ignoreDeclaration does not ignore lower case doctype declaration再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NaturalIntelligence/fast-xml-parser#870 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
NaturalIntelligence/fast-xml-parser の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
Extended search drops any query term that contains a line break対応中かも @goranai が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信