A processing instruction with no target passes validation, then the builder prints invalid XML
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, testing-qa
Hướng nghiên cứu
Bắt đầu với đường dẫn xác thực processing instruction trong XMLValidator, sau đó so sánh cách xử lý <?x?> và <? ?> với ngữ pháp XML PI được mô tả trong issue. Kiểm tra hành vi của parser và builder bằng ví dụ Node.js được cung cấp. Công việc hoàn tất khi quá trình xác thực từ chối các trường hợp target không hợp lệ, hoặc parsing bỏ qua chúng, để builder không tạo ra XML không hợp lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- 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!
- Ngôn ngữ chính
- JavaScript
- Star
- 3.1k
- Fork
- 410
- Merge trung bình
- 4 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NaturalIntelligence/fast-xml-parser
-
XMLValidator accepts double hyphens inside commentsCó thể đã có người làm @Sskift đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NaturalIntelligence/fast-xml-parser#903 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
XMLValidator accepts raw < and & in attribute valuesCó thể đã có người làm @jeromeyyy đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NaturalIntelligence/fast-xml-parser#900 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
getMetaDataSymbol() declares a boxed SymbolCó thể đã có người làm @chiragbitoni đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NaturalIntelligence/fast-xml-parser#890 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NaturalIntelligence/fast-xml-parser#888 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
ignoreDeclaration does not ignore lower case doctype declarationCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NaturalIntelligence/fast-xml-parser#870 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của NaturalIntelligence/fast-xml-parser
Issue tương tự
-
Quick Connect form is off-centerĐang mởbug
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
jellyfin/jellyfin-web#8865 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
renderer.44: a zoom out cannot keep the center and stay inside data.range at an end of the dataĐang mởarea:contract P3
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
grafana/viz-contract#100 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SUB-1: [CI] Update deprecated CodeQL Action v2 to v4Có thể đã có người làm @AnkitSatpute đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
-
The model name in the conversation header is truncated to "Qwen3…" with free space beside itĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100