]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mjson: decode the escaped slash in strings
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 25 Nov 2026 15:28:48 +0000 (16:28 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 25 Nov 2026 15:22:07 +0000 (16:22 +0100)
commit1bc8a562302acdf5cfdb1949b529c319fd7b931c
tree0dafb478e21623754272537b0da950254d2e4d89
parent24e1f81bee94de8bf6336f2d4b5fbc363d46d100
BUG/MEDIUM: mjson: decode the escaped slash in strings

RFC 8259 allows the slash to be escaped in JSON strings as "\/", and
some encoders emit it by default (e.g. PHP's json_encode()). But
mjson_unescape() does not know this escape and fails, so no value is
returned for such strings by json_query(), jwt_header_query() and
jwt_payload_query(), nor to the ACME client which extracts strings the
same way. This can be reproduced with req.body,json_query('$.url') on
{"url":"\/a\/b"}.

Let's add the slash to the escapes known by mjson_esc().

This exists since the library was imported in 2.4-dev17 by commit
41007a683 ("MINOR: sample: converter: Add mjson library."). It must be
backported to all supported versions.
src/mjson.c