[Server] Handle malformed JSON-RPC input graceful (#412)
* Never let a throwable escape Protocol::processInput() * Validate payload types in the schema hydration methods * Stop leaking handler exception messages to the client
This commit is contained in:
parent
9236824b6d
commit
c8ed07bba2
1 changed files with 858 additions and 58 deletions
|
|
@ -57,7 +57,14 @@ class Implementation implements \JsonSerializable
|
|||
throw new InvalidArgumentException('Invalid "icons" in Implementation data; expected an array.');
|
||||
}
|
||||
|
||||
$data['icons'] = array_map(Icon::fromArray(...), $data['icons']);
|
||||
$data['icons'] = Icon::listFromArray($data['icons'], 'Implementation');
|
||||
}
|
||||
|
||||
if (isset($data['description']) && !\is_string($data['description'])) {
|
||||
throw new InvalidArgumentException('Invalid "description" in Implementation data.');
|
||||
}
|
||||
if (isset($data['websiteUrl']) && !\is_string($data['websiteUrl'])) {
|
||||
throw new InvalidArgumentException('Invalid "websiteUrl" in Implementation data.');
|
||||
}
|
||||
|
||||
return new self(
|
||||
|
|
|
|||
Loading…
Reference in a new issue