Archived
vendor: the pattern parser counts its nesting, and refuses past 64
A tool schema's `pattern` reaches the grammar converter as client data,
and the group scanner recursed once per nested '(': a few tens of KB of
brackets inside one JSON string was an uncatchable stack overflow of the
request worker. The body's depth and value bounds never saw it -- the
brackets are string content, not JSON nesting -- and 0003, the patch that
made this same function survive a hostile pattern, hardened the empty and
the looping cases but never the recursing one. It is the one remote crash
in the audit, and one request is the whole attack.
transform() now counts its nesting and records the refusal once, where
every unwinding frame met the same '(' and repeated it; check_errors turns
it into the clean throw the server already answers with a 400. Proven on
the compile host against the real converter: the 20000-group pattern is
refused by name, a 40-group pattern -- far past anything a real schema
nests -- still compiles. The record keeps the addition under 0003's name,
whose footing it stands on.
This commit is contained in:
1 parent
b83d53cf19
commit
2fda03ccdd
4 files changed
+46
-2
No files matched your search
Vendored
+6
@@ -139,6 +139,12 @@ vendor/llama/common/regex-partial.{h,cpp} <- llama.cpp common/*
|
||||
adds a size test, two empty-container guards, and a did-we-consume-a-byte test at the bottom
|
||||
of the loop, each recording an error the existing check_errors() already turns into a throw.
|
||||
|
||||
Added 2026-11 on 0003's footing: the same client `pattern` can also KILL the worker by
|
||||
recursion -- transform() calls itself once per nested '(', no cap anywhere, and no JSON
|
||||
depth bound helps because the brackets are string content, not JSON nesting. A pattern of
|
||||
tens of KB of '(' is an uncatchable stack overflow. A nesting counter caps the recursion
|
||||
at 64 groups and records one more error the existing check_errors() turns into a refusal.
|
||||
|
||||
On 0004: three things upstream ACCEPTS and then gets wrong, each now refused by name.
|
||||
A remote $ref is fetched through a callback the public entry point stubs out, so it silently
|
||||
degrades into "accepts any object" -- we refuse and fetch nothing, because a sampler that
|
||||
|
||||
Reference in new issue
Block a user