Fix HMAC CSRF token payload #462
Annotations
11 warnings
|
Complete job
Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/cache@v4. Actions will be forced to run with Node.js 24 by default starting June 16th, 2026. Node.js 20 will be removed from the runner on September 16th, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L137
Escaped Mutant for Mutator "ConcatOperandRemoval":
@@ @@
private function generateHash(string $message): string
{
$identity = $this->identityGenerator->generate();
- $message = StringHelper::byteLength($identity) . '~' . $identity . '~' . $message;
+ $message = StringHelper::byteLength($identity) . $identity . '~' . $message;
$hash = hash_hmac($this->algorithm, $message, $this->secretKey, true);
if (!$hash) {
throw new RuntimeException("Failed to generate HMAC with hash algorithm: {$this->algorithm}.");
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L137
Escaped Mutant for Mutator "ConcatOperandRemoval":
@@ @@
private function generateHash(string $message): string
{
$identity = $this->identityGenerator->generate();
- $message = StringHelper::byteLength($identity) . '~' . $identity . '~' . $message;
+ $message = '~' . $identity . '~' . $message;
$hash = hash_hmac($this->algorithm, $message, $this->secretKey, true);
if (!$hash) {
throw new RuntimeException("Failed to generate HMAC with hash algorithm: {$this->algorithm}.");
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L137
Escaped Mutant for Mutator "Concat":
@@ @@
private function generateHash(string $message): string
{
$identity = $this->identityGenerator->generate();
- $message = StringHelper::byteLength($identity) . '~' . $identity . '~' . $message;
+ $message = '~' . StringHelper::byteLength($identity) . $identity . '~' . $message;
$hash = hash_hmac($this->algorithm, $message, $this->secretKey, true);
if (!$hash) {
throw new RuntimeException("Failed to generate HMAC with hash algorithm: {$this->algorithm}.");
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L127
Escaped Mutant for Mutator "ReturnRemoval":
@@ @@
} else {
$expiration = (int) $chunks[0];
if ((string) $expiration !== $chunks[0]) {
- return null;
+
}
}
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L119
Escaped Mutant for Mutator "ReturnRemoval":
@@ @@
$message = StringHelper::byteSubstring($payload, $this->hashLength, null);
$chunks = explode('~', $message, 2);
if (count($chunks) !== 2) {
- return null;
+
}
if ($chunks[0] === '') {
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L117
Escaped Mutant for Mutator "IncrementInteger":
@@ @@
}
$message = StringHelper::byteSubstring($payload, $this->hashLength, null);
- $chunks = explode('~', $message, 2);
+ $chunks = explode('~', $message, 3);
if (count($chunks) !== 2) {
return null;
}
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L113
Escaped Mutant for Mutator "ReturnRemoval":
@@ @@
}
if (StringHelper::byteLength($payload) <= $this->hashLength) {
- return null;
+
}
$message = StringHelper::byteSubstring($payload, $this->hashLength, null);
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L112
Escaped Mutant for Mutator "LessThanOrEqualTo":
@@ @@
return null;
}
- if (StringHelper::byteLength($payload) <= $this->hashLength) {
+ if (StringHelper::byteLength($payload) < $this->hashLength) {
return null;
}
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L96
Escaped Mutant for Mutator "IncrementInteger":
@@ @@
private function generateToken(?int $expiration): string
{
- $message = (string) $expiration . '~' . Random::string(32);
+ $message = (string) $expiration . '~' . Random::string(33);
return StringHelper::base64UrlEncode($this->generateHash($message) . $message);
}
|
|
Run roave infection.:
src/Hmac/HmacCsrfToken.php#L96
Escaped Mutant for Mutator "DecrementInteger":
@@ @@
private function generateToken(?int $expiration): string
{
- $message = (string) $expiration . '~' . Random::string(32);
+ $message = (string) $expiration . '~' . Random::string(31);
return StringHelper::base64UrlEncode($this->generateHash($message) . $message);
}
|
background
wait
wait-all
cancel
parallel
Loading