[BUG] REST endpoint producing invalid JSON
Posted: Mon Jul 22, 2024 2:46 am
I was attempting to read a backup file, and realized that the REST endpoint in 7.15.2 produces invalid JSON:
That seems be be because there are raw null bytes, which confuses the shell. Using NodeJS to bypass shell issues reports
Again, that is at an un-escaped null byte, which according to the JSON spec are not allowed un-escaped: https://www.json.org/json-en.html
Code: Select all
$ curl -X POST -u admin:${PASSWORD} -H "content-type: application/json" https://${YOUR_IP}/rest/file/read --data '{"file":"my-test.backup","chunk-size":"4096","offset":"0"}' | jq
parse error: Unfinished string at EOF at line 1, column 20
Code: Select all
SyntaxError: Bad control character in string literal in JSON at position 16
Again, that is at an un-escaped null byte, which according to the JSON spec are not allowed un-escaped: https://www.json.org/json-en.html
'0020' . '10FFFF' - '"' - '\'