add tests batch 20
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\V1\FullSurface;
|
||||
|
||||
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
|
||||
|
||||
|
||||
class ApiBatch18StudentMedicalAndSafetyDataMinimizationContractTest extends FullSurfaceE2EContractCase
|
||||
{
|
||||
public function test_batch18_studentmedicalandsafetydataminimization_stays_controlled(): void
|
||||
{
|
||||
$routes = $this->apiRoutesContainingAny(['students', 'attendance', 'incident', 'safety', 'emergency', 'guardian', 'family', 'reports']);
|
||||
$payload = [
|
||||
'include' => 'medical_notes,diagnosis,medication,allergy,custody_order,restraining_order,ssn',
|
||||
'fields' => 'medical_notes,diagnosis,medication,allergy,custody_order,restraining_order,ssn',
|
||||
];
|
||||
|
||||
foreach (array_slice($routes, 0, 100) as $route) {
|
||||
$method = $this->primaryMethod($route);
|
||||
$uri = $route->uri();
|
||||
$actor = $this->actorFor($uri);
|
||||
|
||||
if (str_contains($uri, 'admin') || str_contains($uri, 'roles') || str_contains($uri, 'permissions')) {
|
||||
$actor = $this->studentUser;
|
||||
}
|
||||
|
||||
$response = $this->requestAs($actor, $method, $uri, $this->payloadFor($method, $uri) + $payload);
|
||||
$this->assertControlled($response, $method, $uri);
|
||||
$this->assertNotEquals(500, $response->getStatusCode(), $method.' '.$uri.' crashed during Batch 18 student medical and safety data minimization probe.');
|
||||
|
||||
$body = strtolower($response->getContent());
|
||||
foreach (['sqlstate', 'stack trace', 'app_key', 'remember_token', 'api_token', 'massassignmentexception', 'foreign key constraint'] as $leak) {
|
||||
$this->assertStringNotContainsString($leak, $body, $method.' '.$uri.' leaked '.$leak.' during Batch 18 student medical and safety data minimization probe.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user