Limit the nesting depth of `JsonReader` and document it as internal
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start with JsonReader in the 2.x and 3.x packages named in the issue, then inspect JsonTemplateLayoutCodecFuzzer and its existing tests. Add coverage for input one nesting level above the proposed limit and check the fuzzer’s input bound. Done means excessive nesting raises IllegalArgumentException, the fuzzer no longer expects stack overflows, and Javadocs describe the parser as internal and for trusted input; the package move is only a consideration.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Log4j contains a minimal JSON parser, JsonReader, used to parse Log4j's own configuration: JSON configuration files, the MutableThreadContextMapFilter configuration, property mappings, and JSON Template Layout templates and resolver configuration. In 2.x it lives in org.apache.logging.log4j.layout.template.json.util; in 3.x in org.apache.logging.log4j.kit.json, which log4j-kit exports (OSGi @Export, version 3.0.0) under the module description "Helpers to implement Log4j 2.x API".
The parser recurses through readToken(), readArray() and readObject() without a depth limit, so a deeply nested document (a few thousand levels with the default thread stack) ends in a StackOverflowError instead of the IllegalArgumentException thrown for other malformed input. JsonTemplateLayoutCodecFuzzer currently works around this by bounding the length of its input (see OSS-Fuzz issue 370272570). Moreover, nothing in the Javadoc says that the parser is meant only for Log4j's own, operator-supplied input, and the exported 3.x package can give the impression that it is a general-purpose JSON parser.
Proposal:
- Add a nesting-depth counter to
JsonReader, incremented on entry toreadArray()andreadObject(), and throw anIllegalArgumentExceptiononce it exceeds a fixed limit (e.g. 128, far above the nesting of any real configuration file), in both 2.x and 3.x. Add a test parsing a document one level above the limit. - Relax the input length bound of
JsonTemplateLayoutCodecFuzzerand remove its comment about expected stack overflows. - State in the Javadoc of
JsonReaderand of its package that it is an internal component intended only for trusted input. Before 3.0.0 GA, consider moving the 3.x class to a non-exported (internal) package.
This issue originates from a private security report classified as a hardening.
- Ngôn ngữ chính
- Java
- Star
- 3.6k
- Fork
- 1.8k
- Merge trung bình
- 5 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 24
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 apache/logging-log4j2
-
additivity attributeĐang mởwaiting-for-maintainer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
apache/logging-log4j2#4475 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Migrate `log4j-api-test` tests to JUnit 5Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởapi priority: P3 tests waiting-for-maintainer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/logging-log4j2#4430 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`Rfc5424Layout` does not escape the `newLineEscape` replacement in SD-PARAM-VALUECó thể đã có người làm @lunarbae628 đã nhận 5 ngày trước. Đang mởbug layouts priority: P3
apache/logging-log4j2#4464 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`evaluateOnStartup="true"` saves logs under wrong file names after missing scheduled rollCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởappenders:Rolling bug priority: P1 waiting-for-maintainer
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
apache/logging-log4j2#4449 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`PluginBuilder` reads builder fields that `GraalVmProcessor` does not register, so `LevelMatchFilter`, `SystemPropertyArbiter` and others fail in GraalVM native imagesCó thể đã có người làm @typat đã nhận 13 ngày trước. Đang mởbug graalvm plugins priority: P2 waiting-for-maintainer
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
apache/logging-log4j2#4441 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/logging-log4j2
Issue tương tự
-
[FEATURE] Expose external refresh, node-level translog and warmer statsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
Good First Issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
hiero-ledger/hiero-sdk-java#3059 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug live-tv platform:desktop platform:mobile platform:tv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
fk0u/cleanyourtv-tahoe#102 ·
Maintainer thường phản hồi trong vòng 1 ngày