Skip to content

path and query parameters should be sanitised #1032

@huancheng-trili

Description

@huancheng-trili

Description

Path and query parameters should be sanitised. Invalid input should be rejected right away.

Observed behaviour

$ curl -i localhost:8933/accounts/KT1NgfuZDU4fp5cqG4nhSPQGBAfT2cmj1rJ2\\t/kv/subkeys
HTTP/1.1 500 Internal Server Error
content-length: 162
vary: origin, access-control-request-method, access-control-request-headers
access-control-allow-origin: *
date: Fri, 30 May 2025 09:46:43 GMT

{"error":"Failed to get subkeys for /jstz_kv/KT1NgfuZDU4fp5cqG4nhSPQGBAfT2cmj1rJ2\\t. Error: Error(\"invalid type: map, expected a string\", line: 1, column: 1)"}
$ curl -i localhost:8933/accounts/KT1NgfuZDU4fp5cqG4nhSPQGBAfT2cmj1rJ2/kv\?key\=foo\\t
HTTP/1.1 500 Internal Server Error                                                 
content-length: 300           
vary: origin, access-control-request-method, access-control-request-headers
access-control-allow-origin: *
date: Fri, 30 May 2025 09:45:39 GMT      

{"error":"Failed to get value of key-value pair: /jstz_kv/KT1NgfuZDU4fp5cqG4nhSPQGBAfT2cmj1rJ2/foo\\t. Errors: [ValueError { kind: \"temporary\", id: \"failure\", blo
ck: None, msg: Some(\"Tezos_scoru_wasm.Durable.Invalid_key(\\\"/jstz_kv/KT1NgfuZDU4fp5cqG4nhSPQGBAfT2cmj1rJ2/foo\\\\\\\\t\\\")\") }]"}

Expected behaviour

4xx errors should have been returned with proper error messages.

Steps to reproduce

Spin up the sandbox and call jstz node API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions