fix(api): expose cloud tokens with sensitive read access

Show cloud provider token values only when the API request has sensitive
read permission, and cover read, read:sensitive, and root token behavior.
This commit is contained in:
Andras Bacsai
2026-05-13 11:29:48 +02:00
parent db23ee76fd
commit fb13a6cdc0
2 changed files with 66 additions and 1 deletions
@@ -16,9 +16,14 @@ class CloudProviderTokensController extends Controller
{
$token->makeHidden([
'id',
'token',
]);
if (request()->attributes->get('can_read_sensitive', false) === true) {
$token->makeVisible([
'token',
]);
}
return serializeApiResponse($token);
}