Skip to content

Commit c9bf6af

Browse files
committed
fix(hooks): validate level and failed tests payload fields #34
1 parent 1acde9b commit c9bf6af

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎views/hooks/phpunit.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
[$git_commit_hash, $payload] = Psalm\Shepherd\Hook::readPayload();
66

7+
if (!is_array($payload['tests'] ?? null)) {
8+
Psalm\Shepherd\Hook::reject(400, 'Payload has no failed tests');
9+
}
10+
711
\Psalm\Shepherd\PhpunitData::handleFailurePayload($git_commit_hash, $payload);

‎views/hooks/psalm.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
Psalm\Shepherd\Hook::reject(400, 'Payload has no Psalm issues or type coverage');
1515
}
1616

17+
if (!is_int($payload['level'] ?? 0)) {
18+
Psalm\Shepherd\Hook::reject(400, 'Psalm level is not an integer');
19+
}
20+
1721
Psalm\Shepherd\PsalmData::handlePayload($git_commit_hash, $payload);

0 commit comments

Comments
 (0)