Files
inbuxa-server/crates/scim
jcoffey-dev fb26949b17 SCIM: a filter too long or nested too deep is refused
The SCIM filter parser recursed once per '(', 'not (' and '[' with no
limit, and what reads a parsed filter recurses down its 'and' chain. A
filter of a few thousand '(' in GET /scim/v2/Users?filter=, a .search
body (up to 1 MiB) or a PATCH path overflowed the worker's stack, which
aborts the whole server process, for every tenant and protocol on the
node. Any SCIM credential could do it: a server-level provisioning key,
or a tenant's where the tenant's ceiling allows scimAccess.

A filter is now at most 8 KiB and nests at most 32 deep. Past either,
the request is 400 invalidFilter (invalidPath for a PATCH path) before
anything else is parsed.

Test: a new scim-proto test parsing 100,000 '(' on a 2 MiB thread
aborted with a stack overflow on main, and an over-long filter parsed;
in the SCIM suite a .search with 500,000 '(' aborted the server
(tokio-rt-worker has overflowed its stack). Both now get invalidFilter,
the longest accepted filter parses and is read on a 2 MiB stack, and the
server keeps answering.

Found in a security review.

(cherry picked from commit f28144046a)
2026-11-17 16:36:17 -07:00
..
2026-10-18 13:53:24 -07:00