Regex size limit bypass via json.match_schema and Azure RBAC StringMatches
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Read src/builtins/objects.rs around compile_json_schema and src/languages/azure_rbac/builtins/strings.rs:86, then inspect compile_regex_for_builtin() and the jsonschema validator configuration. Confirm both json.match_schema/json.verify_schema and Azure RBAC StringMatches enforce the same regex size limit, including patterns supplied through JSON Schema.
Written by the indexing model from the issue text.
Description
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 thejsonschemacrate internally, bypassing ourRegexBuilder::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 thejsonschemacrate 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 applyRegexBuilder::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.
- Dominant language
- Rust
- Stars
- 375
- Forks
- 81
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 78
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/regorus
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
RVM: errors and conflicts in rule bodies evaluate to undefined, even with strict builtin errorsMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
microsoft/regorus#932 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
Maintainers usually reply within 1 day
All issues in microsoft/regorus
Similar issues
-
documentation target:powerpoint
Difficulty 1/5 Under an hour Newbie friendliness 76/100
tomast1337/PdfLapas#602 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
SlimeBoyOwO/LingChat#965 ·
Maintainers usually reply within 3 days
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
bug db/dameng user-priority/P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day