Limit the nesting depth of `JsonReader` and document it as internal
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 3.6k
- フォーク
- 1.8k
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/logging-log4j2 のほかの issue
-
additivity attributeオープンwaiting-for-maintainer
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
apache/logging-log4j2#4475 ·
メンテナーはふだん 1 日以内に返信
-
Migrate `log4j-api-test` tests to JUnit 5再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンapi priority: P3 tests waiting-for-maintainer
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/logging-log4j2#4430 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`Rfc5424Layout` does not escape the `newLineEscape` replacement in SD-PARAM-VALUE対応中かも @lunarbae628 が 5 日前に担当しました。 オープンbug layouts priority: P3
apache/logging-log4j2#4464 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`evaluateOnStartup="true"` saves logs under wrong file names after missing scheduled roll再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンappenders:Rolling bug priority: P1 waiting-for-maintainer
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
apache/logging-log4j2#4449 ·
メンテナーはふだん 1 日以内に返信
-
`PluginBuilder` reads builder fields that `GraalVmProcessor` does not register, so `LevelMatchFilter`, `SystemPropertyArbiter` and others fail in GraalVM native images対応中かも @typat が 13 日前に担当しました。 オープンbug graalvm plugins priority: P2 waiting-for-maintainer
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
apache/logging-log4j2#4441 ·
メンテナーはふだん 1 日以内に返信
apache/logging-log4j2 の issue をすべて見る
似ている issue
-
[Bug]: Nullable implicit operator on string extensible enums still throws for a null string対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug emitter:client:csharp
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/typespec#12572 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settingsオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration対応中かも @amalsaidov が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信