Regex size limit bypass via json.match_schema and Azure RBAC StringMatches

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
rust
領域
security

調査の方向性

src/builtins/objects.rs の compile_json_schema 周辺と src/languages/azure_rbac/builtins/strings.rs:86 を読み、続いて compile_regex_for_builtin() と jsonschema バリデーターの設定を調べてください。json.match_schema/json.verify_schema と Azure RBAC StringMatches の両方が、JSON Schema を通じて提供されるパターンを含め、同じ regex サイズ制限を適用することを確認してください。

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

説明

Summary

PR #705 adds compiled-size limits to all regex.* builtins via compile_regex_for_builtin(). However, two other code paths accept user-controlled regex patterns without enforcing the same limit:

1. json.match_schema / json.verify_schema
  • Path: src/builtins/objects.rs → compile_json_schema → jsonschema::validator_for
  • Issue: JSON Schema "pattern" keywords contain regex patterns that are compiled by the jsonschema crate internally, bypassing our RegexBuilder::size_limit() enforcement.
  • Risk: A policy author can embed an adversarial regex inside a JSON schema pattern to circumvent the size limit.
2. Azure RBAC StringMatches
  • Path: src/languages/azure_rbac/builtins/strings.rs:86
  • Issue: Uses Regex::new() directly without size limit.
  • Risk: Feature-gated behind azure_rbac, but if enabled with untrusted conditions, the same class of adversarial patterns applies.

Suggested Fix

  • For json.match_schema: Configure the jsonschema crate to use a custom regex provider that enforces the same size limit, or pre-validate schema patterns before compilation.
  • For Azure RBAC: Route through compile_regex_for_builtin() or apply RegexBuilder::size_limit() directly.

Context

Found during multi-model review of #705. These are separate code paths from the regex.* builtins and would be best addressed in a follow-up PR.

主要言語
Rust
スター
375
フォーク
81
平均マージ
1日 11時間
マージ済み PR(30日)
78

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

microsoft/regorus のほかの issue

microsoft/regorus の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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