mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
[pitboss/grind] deferred session-0001 (20260522T163126Z-7d60)
This commit is contained in:
parent
fd50549582
commit
e4258d63ed
7 changed files with 625 additions and 13 deletions
23
tests/dynamic_fixtures/json_parse_depth/ruby/vuln.rb
Normal file
23
tests/dynamic_fixtures/json_parse_depth/ruby/vuln.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Ruby JSON_PARSE depth-bomb vuln fixture.
|
||||
#
|
||||
# Models a config-driven JSON ingest endpoint that picks the parser
|
||||
# input based on the request payload tag — `*_DEEP` routes through a
|
||||
# deeply-nested array literal (256 levels) that drives `JSON.parse`
|
||||
# past the 64-level depth budget; `*_SHALLOW` routes through a flat
|
||||
# `[]` parse that leaves the predicate clear. This shape is needed
|
||||
# by the differential runner: the vuln-payload attempt and the
|
||||
# benign-control attempt both load the same fixture, and only the
|
||||
# payload-routed deep branch trips the `JsonParseExcessiveDepth`
|
||||
# predicate. `max_nesting: false` disables the json gem's depth
|
||||
# guard so the harness's depth walker sees the full 256-level shape
|
||||
# rather than triggering `JSON::NestingError` at depth 100.
|
||||
require 'json'
|
||||
|
||||
def run(value)
|
||||
text = value.to_s
|
||||
if text.include?('DEEP')
|
||||
nested = '[' * 256 + ']' * 256
|
||||
return JSON.parse(nested, max_nesting: false)
|
||||
end
|
||||
JSON.parse('[]')
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue