Skip to content

Implement Oj::Parser.safe with configurable JSON safety limits#1007

Merged
ohler55 merged 2 commits intoohler55:developfrom
meinac:implement_safe_parser
Apr 15, 2026
Merged

Implement Oj::Parser.safe with configurable JSON safety limits#1007
ohler55 merged 2 commits intoohler55:developfrom
meinac:implement_safe_parser

Conversation

@meinac
Copy link
Copy Markdown
Contributor

@meinac meinac commented Apr 14, 2026

Introduce a safe parser mode that enforces limits for array size, hash size, nesting depth, and total elements to reduce risk from oversized or deeply nested payloads.

@meinac meinac force-pushed the implement_safe_parser branch from 36766e7 to 9e4d11c Compare April 14, 2026 14:02
Introduce a safe parser mode that enforces limits for array size,
hash size, nesting depth, and total elements to reduce risk from
oversized or deeply nested payloads.
@meinac meinac force-pushed the implement_safe_parser branch from 9e4d11c to 9ef4cba Compare April 14, 2026 14:05
Comment thread ext/oj/safe.c Outdated
@ohler55
Copy link
Copy Markdown
Owner

ohler55 commented Apr 15, 2026

I probably need to take a look at the clang-formatter rules. I'm surprised the conditionals without brackets didn't get flagged. Please add the brackets.

I didn't check all lines but it seemed like some might have been over 120 characters. If there are lines longer than that please change. If all are under 120 then it is fine.

The content, while different than my code looks fine otherwise. Thanks for the new addition.

@meinac meinac force-pushed the implement_safe_parser branch from 0de35f6 to 1e6224a Compare April 15, 2026 14:05
@meinac
Copy link
Copy Markdown
Contributor Author

meinac commented Apr 15, 2026

Thanks for your initial review @ohler55! I have changed the branches to always have brackets.

I didn't check all lines but it seemed like some might have been over 120 characters. If there are lines longer than that please change. If all are under 120 then it is fine.

The longest line is exactly 120 characters, so it's fine I guess.

@ohler55
Copy link
Copy Markdown
Owner

ohler55 commented Apr 15, 2026

Thank you for the contribution.

@ohler55 ohler55 merged commit 0bcac18 into ohler55:develop Apr 15, 2026
34 checks passed
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.

2 participants