chore: add sensitive to fn logs n errors

This commit is contained in:
Chirag Aggarwal 2025-01-11 13:46:44 +00:00
parent 48fd3b371e
commit 99f736aa52
2 changed files with 2 additions and 28 deletions

View file

@ -2135,15 +2135,6 @@ App::post('/v1/functions/:functionId/executions')
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution));
}
$roles = Authorization::getRoles();
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
$isAppUser = Auth::isAppUser($roles);
if (!$isPrivilegedUser && !$isAppUser) {
$execution->setAttribute('logs', '');
$execution->setAttribute('errors', '');
}
$headers = [];
foreach (($executionResponse['headers'] ?? []) as $key => $value) {
$headers[] = ['name' => $key, 'value' => $value];
@ -2239,17 +2230,6 @@ App::get('/v1/functions/:functionId/executions')
$results = $dbForProject->find('executions', $queries);
$total = $dbForProject->count('executions', $filterQueries, APP_LIMIT_COUNT);
$roles = Authorization::getRoles();
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
$isAppUser = Auth::isAppUser($roles);
if (!$isPrivilegedUser && !$isAppUser) {
$results = array_map(function ($execution) {
$execution->setAttribute('logs', '');
$execution->setAttribute('errors', '');
return $execution;
}, $results);
}
$response->dynamic(new Document([
'executions' => $results,
'total' => $total,
@ -2293,14 +2273,6 @@ App::get('/v1/functions/:functionId/executions/:executionId')
throw new Exception(Exception::EXECUTION_NOT_FOUND);
}
$roles = Authorization::getRoles();
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
$isAppUser = Auth::isAppUser($roles);
if (!$isPrivilegedUser && !$isAppUser) {
$execution->setAttribute('logs', '');
$execution->setAttribute('errors', '');
}
$response->dynamic($execution, Response::MODEL_EXECUTION);
});

View file

@ -97,12 +97,14 @@ class Execution extends Model
'description' => 'Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.',
'default' => '',
'example' => '',
'sensitive' => true,
])
->addRule('errors', [
'type' => self::TYPE_STRING,
'description' => 'Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.',
'default' => '',
'example' => '',
'sensitive' => true,
])
->addRule('duration', [
'type' => self::TYPE_FLOAT,