lambdaclass / lambdaclass/lambda_compiler_kit
security: deep nesting causes stack overflow in JSON parser
まだ誰も着手していません。
- 主要言語
- Lean
- スター
- 2
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Problem
The JSON parser (parseValue/parseArrayElems/parseObjectElems) is mutually recursive with no depth limit. Deeply nested JSON (e.g., [[[[...10000 levels...]]]]) will exhaust the Lean runtime stack.
This is distinct from the DoS risk in #13 (which is about exponent arithmetic) — this is about recursion depth on the parse stack.
Expected fix
Add a configurable maximum nesting depth to the parser (defaulting to a safe value like 512 or 1024). Return a ParseError.nestingDepthExceeded on overflow.
References
- Related to: #13 (DoS prevention)
- Flagged by AI code review on PR #8
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず JSON パーサー関数 parseValue、parseArrayElems、parseObjectElems を読み、それらの相互再帰と既存の ParseError 処理を追跡します。設定可能な深さ制限をどのように渡すか、また適切なデフォルト値は何かを定義し、その後、深くネストされた入力がランタイムスタックを枯渇させずに ParseError.nestingDepthExceeded を返すことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 領域
- compilers, security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100