apiRoutesContainingAny(['roles', 'permissions', 'users', 'admin', 'settings', 'finance', 'inventory', 'school-years']); $payload = [ 'role' => 'administrator', 'roles' => ['administrator', 'super-admin'], 'permissions' => ['*', 'admin.*', 'finance.refund'], 'is_admin' => true, 'can_impersonate' => true, 'effective_role' => 'administrator', ]; 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 role mutation and effective privilege boundaries 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 role mutation and effective privilege boundaries probe.'); } } } }