Skip to content

Update test and codebase for signature verification and improvements #159

Update test and codebase for signature verification and improvements

Update test and codebase for signature verification and improvements #159

Triggered via pull request July 18, 2024 08:46
@SpomkySpomky
synchronize #84
ci-cd/update
Status Failure
Total duration 1m 15s
Artifacts

integrate.yml

on: pull_request
0️⃣ Byte-level
5s
0️⃣ Byte-level
1️⃣ Syntax errors
22s
1️⃣ Syntax errors
3️⃣ Static Analysis
15s
3️⃣ Static Analysis
4️⃣ Coding Standards
18s
4️⃣ Coding Standards
5️⃣ Mutation Testing
36s
5️⃣ Mutation Testing
6️⃣ Rector Checkstyle
31s
6️⃣ Rector Checkstyle
7️⃣ Exported files
3s
7️⃣ Exported files
Matrix: 2️⃣ Unit and functional tests
Fit to window
Zoom out
Zoom in

Annotations

2 errors and 10 warnings
3️⃣ Static Analysis: src/Key/Ec2Key.php#L1
Ignored error pattern #^Cannot cast mixed to string\.$# in path /home/runner/work/cose-lib/cose-lib/src/Key/Ec2Key.php was not matched in reported errors.
3️⃣ Static Analysis
Process completed with exit code 2.
5️⃣ Mutation Testing: src/Algorithm/Mac/HS256.php#L28
Escaped Mutant for Mutator "IncrementInteger": @@ @@ } protected function getSignatureLength(): int { - return 256; + return 257; } }
5️⃣ Mutation Testing: src/Algorithm/Mac/HS256Truncated64.php#L28
Escaped Mutant for Mutator "IncrementInteger": @@ @@ } protected function getSignatureLength(): int { - return 64; + return 65; } }
5️⃣ Mutation Testing: src/Algorithm/Mac/HS384.php#L28
Escaped Mutant for Mutator "IncrementInteger": @@ @@ } protected function getSignatureLength(): int { - return 384; + return 385; } }
5️⃣ Mutation Testing: src/Algorithm/Mac/HS512.php#L28
Escaped Mutant for Mutator "IncrementInteger": @@ @@ } protected function getSignatureLength(): int { - return 512; + return 513; } }
5️⃣ Mutation Testing: src/Algorithm/Mac/Hmac.php#L19
Escaped Mutant for Mutator "CastString": @@ @@ public function hash(string $data, Key $key): string { $this->checKey($key); - $signature = hash_hmac($this->getHashAlgorithm(), $data, (string) $key->get(SymmetricKey::DATA_K), true); + $signature = hash_hmac($this->getHashAlgorithm(), $data, $key->get(SymmetricKey::DATA_K), true); return substr($signature, 0, intdiv($this->getSignatureLength(), 8)); } public function verify(string $data, Key $key, string $signature): bool
5️⃣ Mutation Testing: src/Algorithm/Signature/ECDSA/ECSignature.php#L51
Escaped Mutant for Mutator "GreaterThan": @@ @@ $lengthR = self::octetLength($pointR); $lengthS = self::octetLength($pointS); $totalLength = $lengthR + $lengthS + self::BYTE_SIZE + self::BYTE_SIZE; - $lengthPrefix = $totalLength > self::ASN1_MAX_SINGLE_BYTE ? self::ASN1_LENGTH_2BYTES : ''; + $lengthPrefix = $totalLength >= self::ASN1_MAX_SINGLE_BYTE ? self::ASN1_LENGTH_2BYTES : ''; return hex2bin(self::ASN1_SEQUENCE . $lengthPrefix . dechex($totalLength) . self::ASN1_INTEGER . dechex($lengthR) . $pointR . self::ASN1_INTEGER . dechex($lengthS) . $pointS); } public static function fromAsn1(string $signature, int $length): string
5️⃣ Mutation Testing: src/Algorithm/Signature/ECDSA/ECSignature.php#L88
Escaped Mutant for Mutator "UnwrapSubstr": @@ @@ } private static function preparePositiveInteger(string $data): string { - if (substr($data, 0, self::BYTE_SIZE) > self::ASN1_BIG_INTEGER_LIMIT) { + if ($data > self::ASN1_BIG_INTEGER_LIMIT) { return self::ASN1_NEGATIVE_INTEGER . $data; } while (str_starts_with($data, self::ASN1_NEGATIVE_INTEGER) && substr($data, 2, self::BYTE_SIZE) <= self::ASN1_BIG_INTEGER_LIMIT) {
5️⃣ Mutation Testing: src/Algorithm/Signature/ECDSA/ECSignature.php#L88
Escaped Mutant for Mutator "GreaterThan": @@ @@ } private static function preparePositiveInteger(string $data): string { - if (substr($data, 0, self::BYTE_SIZE) > self::ASN1_BIG_INTEGER_LIMIT) { + if (substr($data, 0, self::BYTE_SIZE) >= self::ASN1_BIG_INTEGER_LIMIT) { return self::ASN1_NEGATIVE_INTEGER . $data; } while (str_starts_with($data, self::ASN1_NEGATIVE_INTEGER) && substr($data, 2, self::BYTE_SIZE) <= self::ASN1_BIG_INTEGER_LIMIT) {
5️⃣ Mutation Testing: src/Algorithm/Signature/ECDSA/ECSignature.php#L94
Escaped Mutant for Mutator "LessThanOrEqualTo": @@ @@ if (substr($data, 0, self::BYTE_SIZE) > self::ASN1_BIG_INTEGER_LIMIT) { return self::ASN1_NEGATIVE_INTEGER . $data; } - while (str_starts_with($data, self::ASN1_NEGATIVE_INTEGER) && substr($data, 2, self::BYTE_SIZE) <= self::ASN1_BIG_INTEGER_LIMIT) { + while (str_starts_with($data, self::ASN1_NEGATIVE_INTEGER) && substr($data, 2, self::BYTE_SIZE) < self::ASN1_BIG_INTEGER_LIMIT) { $data = substr($data, 2, null); } return $data;
5️⃣ Mutation Testing: src/Algorithm/Signature/ECDSA/ECSignature.php#L116
Escaped Mutant for Mutator "CastInt": @@ @@ if (self::readAsn1Content($message, $position, self::BYTE_SIZE) !== self::ASN1_INTEGER) { throw new InvalidArgumentException('Invalid data. Should contain an integer.'); } - $length = (int) hexdec(self::readAsn1Content($message, $position, self::BYTE_SIZE)); + $length = hexdec(self::readAsn1Content($message, $position, self::BYTE_SIZE)); return self::readAsn1Content($message, $position, $length * self::BYTE_SIZE); } private static function retrievePositiveInteger(string $data): string