Parse the JSON document and return its root object. Throws on malformed input; the caller treats that as an invalid message and closes the socket. We must parse the full structure (rather than searching for keys by substring) because top-level fields like `type`/`user`/`password` could otherwise be matched inside nested objects in attacker-controlled input.
| 263 | /// substring) because top-level fields like `type`/`user`/`password` could |
| 264 | /// otherwise be matched inside nested objects in attacker-controlled input. |
| 265 | Poco::JSON::Object::Ptr parseRootObject(const String & json) |
| 266 | { |
| 267 | Poco::JSON::Parser parser; |
| 268 | return parser.parse(json).extract<Poco::JSON::Object::Ptr>(); |
| 269 | } |
| 270 | |
| 271 | /// Read a top-level string field. Returns empty string if the key is missing. |
| 272 | /// Throws on type mismatch. |
no test coverage detected