fix(mcp): return only service fields from get_service

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-11-09 11:04:47 +01:00
co-authored by Claude Opus 5.5
parent 5ff94dbd7a
commit a44193b6e4
3 changed files with 23 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
---
type: security
---
Removed the server details from the response of the `get_service` MCP tool
+1 -1
View File
@@ -46,7 +46,7 @@ class GetService extends Tool
}
$service->setRelations([]);
$service->makeHidden(['destination', 'source', 'environment', 'applications', 'databases', 'serviceApplications', 'serviceDatabases']);
$service->makeHidden(['server', 'destination', 'source', 'environment', 'applications', 'databases', 'serviceApplications', 'serviceDatabases']);
return $this->mcpSuccess($request, $this->respond(
$this->scrubSensitive($service->toArray()),
+18
View File
@@ -2675,3 +2675,21 @@ test('redactLogText redacts JSON secret fields in log lines', function () {
->and($mixed)->not->toContain('redactme03')
->and($mixed)->toContain(REDACTED);
});
test('get_service does not return the server of the service', function () {
$service = Service::factory()->create([
'environment_id' => $this->environment->id,
'server_id' => $this->server->id,
'destination_id' => $this->destination->id,
'destination_type' => $this->destination->getMorphClass(),
]);
$response = mcpReadCall('get_service', ['uuid' => $service->uuid]);
$response->assertOk();
$data = mcpReadJson($response)['data'];
expect($data['uuid'])->toBe($service->uuid)
->and($data)->toHaveKey('server_status')
->and($data)->not->toHaveKey('server')
->and(json_encode($data))->not->toContain($this->server->ip);
});