Builder emits forbidden XML control characters and validator accepts them

オープン
#902 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, xml
領域
api, backend

調査の方向性

Start with the XML builder and validator entry points in the fast-xml-parser source, where text values are escaped before output; the repro in the issue calls XMLBuilder().build and XMLValidator.validate on { a: "\u0000" }. Check whether the builder's text handling and the validator's character checks cover the XML 1.0 forbidden range U+0000-U+0008, U+000B, U+000C, U+000E-U+001F. Done when the builder no longer emits these code points and XMLValidator.validate rejects text containing them, with tests for U+0000 and U+0001.

索引モデルが issue の本文から書いたものです。

説明

  • Are you running the latest version? (5.11.2, master at cf66a9658004553bc740616e6c7a4912e7e9aab6)
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration? (default builder, validator, and parser options)
  • Did you try the online tool? (it reports Valid XML for the standalone NUL sample)
  • Have you checked the docs for helpful APIs and examples?
Description

The builder emits U+0000 and U+0001 verbatim, and the validator accepts the resulting text as valid XML. XML 1.0 Character Range excludes both code points. This can produce documents that a conforming XML reader cannot consume.

Input

{ a: "\u0000" } (the JavaScript string contains an actual NUL after escape processing). U+0001 behaves the same. U+0009 and U+000A are valid controls.

Code
const { XMLBuilder, XMLValidator, XMLParser } = require("./lib/fxp.cjs");
const xml = new XMLBuilder().build({ a: "\u0000" });
console.log(JSON.stringify(xml));
console.log(XMLValidator.validate(xml));
console.log(JSON.stringify(new XMLParser().parse(xml, true)));
Output
"<a>\u0000</a>"
true
{"a":"\u0000"}
Expected data

The builder should avoid emitting forbidden XML characters, and the validator should reject XML text containing U+0000 or U+0001.

Would you like to work on this issue?

  • Yes
  • No
主要言語
JavaScript
スター
3.1k
フォーク
410
平均マージ
4日 15時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NaturalIntelligence/fast-xml-parser のほかの issue

NaturalIntelligence/fast-xml-parser の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。