fix(api): validate token team context

This commit is contained in:
Andras Bacsai committed 2026-06-01 15:17:55 +02:00
1 parent 4d0be415c8
commit a511bd9b67
14 files changed
+277 -23

No files matched your search

+11
View File
@@ -192,3 +192,14 @@ test('tool calls fail when the token lacks the read ability', function () {
expect($response->json('result.isError'))->toBeTrue();
expect($response->json('result.content.0.text'))->toContain('Missing required permissions');
});
test('MCP rejects token when user no longer belongs to token team', function () {
Project::create(['name' => 'Hidden', 'team_id' => $this->team->id]);
$token = $this->user->createToken('mcp-read', ['read'])->plainTextToken;
$this->team->members()->detach($this->user->id);
$response = mcpCallTool($token, 'list_projects');
$response->assertUnauthorized();
});