Skip to content

Commit cc9e0ba

Browse files
committed
fix(http-sig): make setSignature public and skip third-party-dependent test
Two CI failures introduced by the test additions in this PR: 1. testEd25519VerifyAcceptedWhenSodiumLoaded calls setSignature() to inject an externally-produced Ed25519 signature (since Algorithm::sign() rejects Ed25519 by design). setSignature was declared protected, so the test couldn't call it from outside the class hierarchy. Make it public — SignedRequest lives in the OC\ private namespace, so this widens internal-only visibility, not the public API surface. 2. testParseKeyRejectsContradictoryAlg expected firebase/php-jwt's JWK::parseKey() to throw on a kty=OKP/crv=Ed25519/alg=ES256 key. The current firebase/php-jwt version does not validate that coherence at parse time, so the test now fails to see any throwable. The actual security check happens at Algorithm::verify() time and is covered by testVerifyEd25519KeyAgainstES256Alg right above it. Skip the parse-time test with a comment pointing at the verify-time coverage. Signed-off-by: Micke Nordin <kano@sunet.se>
1 parent c753aad commit cc9e0ba

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

lib/private/Security/Signature/Model/SignedRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function getSignatureData(): array {
157157
* @return self
158158
* @since 31.0.0
159159
*/
160-
protected function setSignature(string $signature): self {
160+
public function setSignature(string $signature): self {
161161
$this->signature = $signature;
162162
return $this;
163163
}

tests/lib/Security/Signature/Rfc9421/AlgorithmTest.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,10 @@ public function testAlgHintConflictsWithJwkAlgRejected(): void {
115115
}
116116

117117
public function testParseKeyRejectsContradictoryAlg(): void {
118-
$this->skipUnlessSodium();
119-
// kty=OKP/crv=Ed25519 with alg=ES256 is contradictory; firebase's
120-
// parseKey rejects it before we ever build a Key.
121-
$keypair = sodium_crypto_sign_keypair();
122-
$this->expectException(\Throwable::class);
123-
JWK::parseKey([
124-
'kty' => 'OKP',
125-
'crv' => 'Ed25519',
126-
'kid' => 'k',
127-
'alg' => 'ES256',
128-
'x' => self::b64url(sodium_crypto_sign_publickey($keypair)),
129-
], null);
118+
$this->markTestSkipped(
119+
'firebase/php-jwt JWK::parseKey does not validate kty/crv/alg coherence; '
120+
. 'the alg mismatch is caught at verify() time instead — see testVerifyEd25519KeyAgainstES256Alg.'
121+
);
130122
}
131123

132124
public function testEcdsaRawToDerProducesValidSignature(): void {

0 commit comments

Comments
 (0)