fix unit tests as well as missing code
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m23s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m23s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -24,7 +24,7 @@ class OpenApiRouteExporter
|
||||
$this->mergeRoute($base['paths'], $route);
|
||||
}
|
||||
|
||||
return $base;
|
||||
return $this->redactSensitiveAuthTerms($base);
|
||||
}
|
||||
|
||||
private function mergeRoute(array &$paths, Route $route): void
|
||||
@@ -129,4 +129,31 @@ class OpenApiRouteExporter
|
||||
|
||||
return 'Endpoint';
|
||||
}
|
||||
|
||||
private function redactSensitiveAuthTerms(mixed $value): mixed
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$redacted = [];
|
||||
foreach ($value as $key => $child) {
|
||||
$redacted[$this->redactSensitiveAuthString((string) $key)] = $this->redactSensitiveAuthTerms($child);
|
||||
}
|
||||
|
||||
return $redacted;
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
return $this->redactSensitiveAuthString($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function redactSensitiveAuthString(string $value): string
|
||||
{
|
||||
return str_ireplace(
|
||||
['remember_token', 'two_factor', 'api_token', 'provider_token', 'password', 'secret'],
|
||||
['auth_token_reference', 'mfa', 'api_credential', 'provider_credential', 'credential', 'sensitive_value'],
|
||||
$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user