Skip to content

Commit c59508a

Browse files
authored
Fix Base64UrlSafe decoding (#399)
* Fix Base64UrlSafe decoding * PHPStan baseline * @simplewebauthn/browser 7.0 * Exported files fixed * JS fixed
1 parent 2272c23 commit c59508a

File tree

6 files changed

+1891
-74
lines changed

6 files changed

+1891
-74
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/jest.config.js export-ignore
1515
/Makefile export-ignore
1616
/phpstan.neon export-ignore
17+
/phpstan-baseline.neon export-ignore
1718
/phpunit.xml.dist export-ignore
1819
/rector.php export-ignore
1920
/rollup.config.js export-ignore

phpstan-baseline.neon

+1,883
Large diffs are not rendered by default.

phpstan.neon

+2-70
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,7 @@
11
parameters:
2-
level: 8
2+
level: max
33
paths:
44
- src
5-
ignoreErrors:
6-
- '#Call to function method_exists\(\) with Symfony\\Component\\HttpFoundation\\Request and .* will always evaluate to true\.#'
7-
- '#Method Webauthn\\Bundle\\Security\\Storage\\OptionsStorage::get\(\) invoked with 1 parameter, 0 required\.#'
8-
-
9-
message: '#Class Webauthn\\CertificateChainChecker\\PhpCertificateChainChecker extends @final class Webauthn\\MetadataService\\CertificateChain\\PhpCertificateChainValidator\.#'
10-
path: src/webauthn/src/CertificateChainChecker/PhpCertificateChainChecker.php
11-
count: 1
12-
-
13-
message: '#Method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory::.*\(\) has parameter \$config(s)? with no value type specified in iterable type array\.#'
14-
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
15-
count: 4
16-
-
17-
message: '#Method Webauthn\\Bundle\\DependencyInjection\\WebauthnExtension::.*\(\) has parameter \$config(s)? with no value type specified in iterable type array\.#'
18-
path: src/symfony/src/DependencyInjection/WebauthnExtension.php
19-
count: 1
20-
-
21-
message: '#Method Webauthn\\Bundle\\Security\\Authorization\\Voter\\IsUserPresentVoter::vote\(\) has parameter \$attributes with no value type specified in iterable type array\.#'
22-
path: src/symfony/src/Security/Authorization/Voter/IsUserPresentVoter.php
23-
count: 1
24-
-
25-
message: '#Method Webauthn\\Bundle\\Security\\Authorization\\Voter\\IsUserVerifiedVoter::vote\(\) has parameter \$attributes with no value type specified in iterable type array\.#'
26-
path: src/symfony/src/Security/Authorization/Voter/IsUserVerifiedVoter.php
27-
count: 1
28-
-
29-
message: '#Cannot call method (scalar|integer)Node\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null.#'
30-
path: src/symfony/src/DependencyInjection/Configuration.php
31-
count: 6
32-
-
33-
message: '#Cannot call method scalarNode\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null\.#'
34-
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
35-
count: 1
36-
-
37-
message: '#Access to deprecated property \$authenticatorSelection of class Webauthn\\Bundle\\Dto\\PublicKeyCredentialCreationOptionsRequest.*#'
38-
path: src/symfony/src/CredentialOptionsBuilder/ProfileBasedCreationOptionsBuilder.php
39-
count: 1
40-
-
41-
message: '#Access to deprecated property \$requireResidentKey of class Webauthn\\AuthenticatorSelectionCriteria\:\nWill be removed in 5\.0\. Please use residentKey instead#'
42-
path: src/webauthn/src/AuthenticatorSelectionCriteria.php
43-
count: 1
44-
-
45-
message: '#Call to deprecated method setRequireResidentKey\(\) of class Webauthn\\AuthenticatorSelectionCriteria\:\nsince v4\.1\. Please use setResidentKey instead#'
46-
path: src/webauthn/src/AuthenticatorSelectionCriteria.php
47-
count: 1
48-
-
49-
message: '#Call to deprecated method setRequireResidentKey\(\) of class Webauthn\\AuthenticatorSelectionCriteria\:\nsince v4\.1\. Please use setResidentKey instead#'
50-
path: src/symfony/src/CredentialOptionsBuilder/ProfileBasedCreationOptionsBuilder.php
51-
count: 1
52-
-
53-
message: '#Call to deprecated method setRequireResidentKey\(\) of class Webauthn\\AuthenticatorSelectionCriteria\:\nsince v4\.1\. Please use setResidentKey instead#'
54-
path: src/symfony/src/Service/PublicKeyCredentialCreationOptionsFactory.php
55-
count: 1
56-
-
57-
message: '#.*ECDAA.*#'
58-
path: src/webauthn/src/AuthenticatorAttestationResponseValidator.php
59-
count: 2
60-
-
61-
message: '#.*ECDAA.*#'
62-
path: src/webauthn/src/AttestationStatement/PackedAttestationStatementSupport.php
63-
count: 2
64-
-
65-
message: '#Strict comparison using === between mixed and null will always evaluate to false\.#'
66-
path: src/metadata-service/src/Statement/StatusReport.php
67-
count: 1
68-
- '#.*Binding.*#'
69-
- '#Parameter \#\d+ \$.* of .* expects .*, .* given\.#'
70-
- '#Property .* does not accept .*\|false\.#'
71-
- '#Cannot access offset \d+ on array\|false\.#'
72-
- '#Method .* should return string but returns string\|false\.#'
73-
- '#Call to deprecated method getContentType\(\) of class Symfony\\Component\\HttpFoundation\\Request#'
745
checkMissingIterableValueType: true
756
checkGenericClassInNonGenericObjectType: true
767
checkUninitializedProperties: true
@@ -84,3 +15,4 @@ includes:
8415
- vendor/phpstan/phpstan-phpunit/extension.neon
8516
- vendor/phpstan/phpstan-strict-rules/rules.neon
8617
- vendor/ekino/phpstan-banned-code/extension.neon
18+
- phpstan-baseline.neon

src/stimulus/Resources/assets/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
},
1616
"peerDependencies": {
1717
"@hotwired/stimulus": "^3.0.0",
18-
"@simplewebauthn/browser": "^6.0.0"
18+
"@simplewebauthn/browser": "^7.0.0"
1919
},
2020
"devDependencies": {
2121
"@hotwired/stimulus": "^3.0.0",
22-
"@simplewebauthn/browser": "^6.0.0"
22+
"@simplewebauthn/browser": "^7.0.0"
2323
}
2424
}

src/stimulus/Resources/assets/src/controller.ts

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export default class extends Controller {
131131
_getData() {
132132
let data = new FormData();
133133
try {
134+
// @ts-ignore
134135
data = new FormData(this.element);
135136
} catch (e) {
136137
//Nothing to do

src/webauthn/src/AuthenticatorAssertionResponse.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Webauthn;
66

7-
use ParagonIE\ConstantTime\Base64;
7+
use Webauthn\Util\Base64;
88

99
/**
1010
* @see https://www.w3.org/TR/webauthn/#authenticatorassertionresponse
@@ -36,6 +36,6 @@ public function getUserHandle(): ?string
3636
return $this->userHandle;
3737
}
3838

39-
return Base64::decode($this->userHandle, true);
39+
return Base64::decode($this->userHandle);
4040
}
4141
}

0 commit comments

Comments
 (0)