Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix DoS vulnerability in JSON parsing fallback#778

Open
georgi wants to merge 4 commits intomainfrom
sentinel-fix-json-parsing-dos-5449327674807422585
Open

πŸ›‘οΈ Sentinel: [HIGH] Fix DoS vulnerability in JSON parsing fallback#778
georgi wants to merge 4 commits intomainfrom
sentinel-fix-json-parsing-dos-5449327674807422585

Conversation

@georgi
Copy link
Contributor

@georgi georgi commented Mar 17, 2026

🚨 Severity: HIGH
πŸ’‘ Vulnerability: lenient_json_parse in src/nodetool/utils/message_parsing.py used ast.literal_eval as a fallback mechanism for broken JSON containing single quotes, exposing the application to Denial of Service via deeply nested inputs or massive expressions.
🎯 Impact: An attacker could crash the application or cause memory exhaustion by supplying pathologically nested JSON. Furthermore, regex-based JSON fixes like replacing "true" to "True" were fragile and could corrupt legitimate strings.
πŸ”§ Fix: Replaced ast.literal_eval with yaml.safe_load, which limits recursion depth, safely handles YAML/JSON literals, and is purpose-built to securely handle data parsing. Updated test assertions appropriately.
βœ… Verification: Ran uv run pytest tests/utils/test_message_parsing.py to ensure all parsing assertions succeed. Validated that PyYAML is already present in the dependency tree.


PR created automatically by Jules for task 5449327674807422585 started by @georgi

Replaced ast.literal_eval with yaml.safe_load in lenient_json_parse to mitigate Denial of Service (DoS) risks associated with parsing deeply nested or massive JSON-like strings. ast.literal_eval is susceptible to stack exhaustion and memory exhaustion (CVE-2024-10188 style issues). This also removes fragile regex string replacements used for boolean/null conversions that were corrupting valid substrings.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules bot and others added 3 commits March 17, 2026 11:32
Remove `cache-dependency-path: ts/package-lock.json` from the `ts-parity-harness.yml` CI workflow as the `ts` directory does not exist yet (it is planned for Phase 1 as per `ts-rewrite.md`), causing the `actions/setup-node` step to fail with a path resolution error.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
Remove `cache: npm` from the `ts-parity-harness.yml` CI workflow. The `ts` directory does not exist yet (it is planned for Phase 1 as per `ts-rewrite.md`), causing the `actions/setup-node` step to fail because there are no lockfiles.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
1. Added missing `search_raw` abstract method implementations to `ApifyProvider` and `DataForSEOProvider` to prevent `TypeError` during instantiation.
2. Removed `cache: npm` from `ts-parity-harness.yml` CI workflow, which failed because the `ts/package-lock.json` file does not exist yet.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant