Skip to content

Commit 3c063fc

Browse files
authored
Remove fallback to P256 in WebAuthn signer (#6337)
1 parent 8614ef7 commit 3c063fc

File tree

3 files changed

+5
-22
lines changed

3 files changed

+5
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- `ERC721` and `ERC1155`: Prevent setting an operator for `address(0)`. In the case of `ERC721` this type of operator allowance could lead to obfuscated mint permission. ([#6171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/6171))
88
- `RLP`: The `encode(bytes32)` function now encodes `bytes32` as a fixed size item and not as a scalar in `encode(uint256)`. Users must replace calls to `encode(bytes32)` with `encode(uint256(bytes32))` to preserve the same behavior. ([#6167](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/6167))
99
- `ERC4337Utils`: The `parseValidationData` now returns a `ValidationRange` as the last return tuple value indicating whether the `validationData` is compared against a timestamp or block number. Developers must update their code to handle this new return value (e.g. `(aggregator, validAfter, validUntil) -> (aggregator, validAfter, validUntil, range)`).
10+
- `SignerWebAuthn`: The `_rawSignatureValidation` function now returns `false` when the signature is not a valid WebAuthn authentication assertion. P256 fallback is removed. Developers can add it back by overriding the function.
1011

1112
## 5.5.0 (2025-10-31)
1213

contracts/utils/cryptography/signers/SignerWebAuthn.sol

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,15 @@ abstract contract SignerWebAuthn is SignerP256 {
3232
/**
3333
* @dev Validates a raw signature using the WebAuthn authentication assertion.
3434
*
35-
* In case the signature can't be validated, it falls back to the
36-
* {SignerP256-_rawSignatureValidation} method for raw P256 signature validation by passing
37-
* the raw `r` and `s` values from the signature.
35+
* Returns `false` if the signature is not a valid WebAuthn authentication assertion.
3836
*/
3937
function _rawSignatureValidation(
4038
bytes32 hash,
4139
bytes calldata signature
4240
) internal view virtual override returns (bool) {
4341
(bool decodeSuccess, WebAuthn.WebAuthnAuth calldata auth) = WebAuthn.tryDecodeAuth(signature);
44-
if (decodeSuccess) {
45-
(bytes32 qx, bytes32 qy) = signer();
46-
return WebAuthn.verify(abi.encodePacked(hash), auth, qx, qy);
47-
} else {
48-
return super._rawSignatureValidation(hash, signature);
49-
}
42+
if (!decodeSuccess) return false;
43+
(bytes32 qx, bytes32 qy) = signer();
44+
return WebAuthn.verify(abi.encodePacked(hash), auth, qx, qy);
5045
}
5146
}

test/account/AccountWebAuthn.test.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,4 @@ describe('AccountWebAuthn', function () {
7272
shouldBehaveLikeERC1271({ erc7739: true });
7373
shouldBehaveLikeERC7821();
7474
});
75-
76-
describe('as regular P256 validator', function () {
77-
beforeEach(async function () {
78-
this.signer = p256Signer;
79-
this.mock = this.p256Mock;
80-
this.domain.verifyingContract = this.mock.address;
81-
});
82-
83-
shouldBehaveLikeAccountCore();
84-
shouldBehaveLikeAccountHolder();
85-
shouldBehaveLikeERC1271({ erc7739: true });
86-
shouldBehaveLikeERC7821();
87-
});
8875
});

0 commit comments

Comments
 (0)