Skip to content

Commit 5905f4e

Browse files
authored
Merge branch '5.2.x' into dependabot/github_actions/ossf/scorecard-action-2.4.1
2 parents 906b813 + d7b2fcb commit 5905f4e

File tree

23 files changed

+253
-150
lines changed

23 files changed

+253
-150
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
"ext-json": "*",
4646
"ext-openssl": "*",
4747
"paragonie/constant_time_encoding": "^2.6|^3.0",
48+
"phpdocumentor/reflection-docblock": "^5.3",
4849
"psr/clock": "^1.0",
4950
"psr/event-dispatcher": "^1.0",
5051
"psr/log": "^1.0|^2.0|^3.0",
51-
"phpdocumentor/reflection-docblock": "^5.3",
5252
"spomky-labs/cbor-php": "^3.0",
5353
"spomky-labs/pki-framework": "^1.0",
54+
"symfony/clock": "^6.4|^7.0",
5455
"symfony/config": "^6.4|^7.0",
5556
"symfony/dependency-injection": "^6.4|^7.0",
5657
"symfony/deprecation-contracts": "^3.2",
57-
"symfony/clock": "^6.4|^7.0",
5858
"symfony/framework-bundle": "^6.4|^7.0",
5959
"symfony/http-client": "^6.4|^7.0",
6060
"symfony/property-access": "^6.4|^7.0",
@@ -93,6 +93,7 @@
9393
"doctrine/orm": "^2.14|^3.0",
9494
"doctrine/persistence": "^3.1|^4.0",
9595
"ekino/phpstan-banned-code": "^3.0",
96+
"ergebnis/phpunit-slow-test-detector": "^2.18",
9697
"infection/infection": "^0.29",
9798
"matthiasnoback/symfony-dependency-injection-test": "^5.1|^6.0",
9899
"php-parallel-lint/php-parallel-lint": "^1.3",

phpstan-baseline.neon

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ parameters:
108108
-
109109
message: '#^Cannot access offset ''routes'' on mixed\.$#'
110110
identifier: offsetAccess.nonOffsetAccessible
111-
count: 12
111+
count: 14
112112
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
113113

114114
-
@@ -214,19 +214,19 @@ parameters:
214214
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
215215

216216
-
217-
message: '#^Parameter \#7 \$optionsStorageId of method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory\:\:createAssertionRequestControllerAndRoute\(\) expects string, mixed given\.$#'
217+
message: '#^Parameter \#7 \$optionsStorageId of method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory\:\:createAssertionRequestControllerAndRoute\(\) expects string\|null, mixed given\.$#'
218218
identifier: argument.type
219219
count: 1
220220
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
221221

222222
-
223-
message: '#^Parameter \#7 \$optionsStorageId of method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory\:\:createAttestationRequestControllerAndRoute\(\) expects string, mixed given\.$#'
223+
message: '#^Parameter \#7 \$optionsStorageId of method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory\:\:createAttestationRequestControllerAndRoute\(\) expects string\|null, mixed given\.$#'
224224
identifier: argument.type
225225
count: 1
226226
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
227227

228228
-
229-
message: '#^Parameter \#7 \$optionsStorageId of method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory\:\:createAuthenticatorService\(\) expects string, mixed given\.$#'
229+
message: '#^Parameter \#7 \$optionsStorageId of method Webauthn\\Bundle\\DependencyInjection\\Factory\\Security\\WebauthnFactory\:\:createAuthenticatorService\(\) expects string\|null, mixed given\.$#'
230230
identifier: argument.type
231231
count: 1
232232
path: src/symfony/src/DependencyInjection/Factory/Security/WebauthnFactory.php
@@ -402,7 +402,7 @@ parameters:
402402
-
403403
message: '#^Parameter \#2 \$id of method Symfony\\Component\\DependencyInjection\\ContainerBuilder\:\:setAlias\(\) expects string\|Symfony\\Component\\DependencyInjection\\Alias, mixed given\.$#'
404404
identifier: argument.type
405-
count: 12
405+
count: 13
406406
path: src/symfony/src/DependencyInjection/WebauthnExtension.php
407407

408408
-
@@ -682,7 +682,7 @@ parameters:
682682
path: src/symfony/src/Security/WebauthnFirewallConfig.php
683683

684684
-
685-
message: '#^Method Webauthn\\Bundle\\Security\\WebauthnFirewallConfig\:\:getOptionsStorage\(\) should return string but returns mixed\.$#'
685+
message: '#^Method Webauthn\\Bundle\\Security\\WebauthnFirewallConfig\:\:getOptionsStorage\(\) should return string\|null but returns mixed\.$#'
686686
identifier: return.type
687687
count: 1
688688
path: src/symfony/src/Security/WebauthnFirewallConfig.php
@@ -1341,6 +1341,12 @@ parameters:
13411341
count: 3
13421342
path: src/webauthn/src/AuthenticationExtensions/AuthenticationExtensions.php
13431343

1344+
-
1345+
message: '#^Cannot unset @readonly Webauthn\\AuthenticationExtensions\\AuthenticationExtensions\:\:\$extensions property\.$#'
1346+
identifier: unset.readOnlyPropertyByPhpDoc
1347+
count: 1
1348+
path: src/webauthn/src/AuthenticationExtensions/AuthenticationExtensions.php
1349+
13441350
-
13451351
message: '#^Class Webauthn\\AuthenticationExtensions\\AuthenticationExtensions implements generic interface ArrayAccess but does not specify its types\: TKey, TValue$#'
13461352
identifier: missingType.generics

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@
3232
<file>src/symfony/src/Repository/DummyPublicKeyCredentialUserEntityRepository.php</file>
3333
</exclude>
3434
</source>
35+
<extensions>
36+
<bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/>
37+
</extensions>
3538
</phpunit>

src/stimulus/assets/dist/controller.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default class extends Controller {
99
type: StringConstructor;
1010
default: string;
1111
};
12+
requestResultField: {
13+
type: StringConstructor;
14+
default: null;
15+
};
1216
requestSuccessRedirectUri: StringConstructor;
1317
creationResultUrl: {
1418
type: StringConstructor;
@@ -18,6 +22,10 @@ export default class extends Controller {
1822
type: StringConstructor;
1923
default: string;
2024
};
25+
creationResultField: {
26+
type: StringConstructor;
27+
default: null;
28+
};
2129
creationSuccessRedirectUri: StringConstructor;
2230
usernameField: {
2331
type: StringConstructor;
@@ -59,9 +67,11 @@ export default class extends Controller {
5967
};
6068
readonly requestResultUrlValue: string;
6169
readonly requestOptionsUrlValue: string;
70+
readonly requestResultFieldValue?: string;
6271
readonly requestSuccessRedirectUriValue?: string;
6372
readonly creationResultUrlValue: string;
6473
readonly creationOptionsUrlValue: string;
74+
readonly creationResultFieldValue?: string;
6575
readonly creationSuccessRedirectUriValue?: string;
6676
readonly usernameFieldValue: string;
6777
readonly displayNameFieldValue: string;

src/stimulus/assets/dist/controller.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ class default_1 extends Controller {
55
constructor() {
66
super(...arguments);
77
this.connect = async () => {
8-
var _a, _b;
8+
var _a, _b, _c, _d;
99
const options = {
1010
requestResultUrl: this.requestResultUrlValue,
1111
requestOptionsUrl: this.requestOptionsUrlValue,
12-
requestSuccessRedirectUri: (_a = this.requestSuccessRedirectUriValue) !== null && _a !== undefined ? _a : null,
12+
requestResultField: (_a = this.requestResultFieldValue) !== null && _a !== undefined ? _a : null,
13+
creationResultField: (_b = this.creationResultFieldValue) !== null && _b !== undefined ? _b : null,
14+
requestSuccessRedirectUri: (_c = this.requestSuccessRedirectUriValue) !== null && _c !== undefined ? _c : null,
1315
creationResultUrl: this.creationResultUrlValue,
1416
creationOptionsUrl: this.creationOptionsUrlValue,
15-
creationSuccessRedirectUri: (_b = this.creationSuccessRedirectUriValue) !== null && _b !== undefined ? _b : null,
17+
creationSuccessRedirectUri: (_d = this.creationSuccessRedirectUriValue) !== null && _d !== undefined ? _d : null,
1618
};
1719
this._dispatchEvent('webauthn:connect', { options });
1820
const supportAutofill = await browserSupportsWebAuthnAutofill();
@@ -38,9 +40,15 @@ class default_1 extends Controller {
3840
this._processSignin(optionsResponseJson, false);
3941
}
4042
async _processSignin(optionsResponseJson, useBrowserAutofill) {
43+
var _a;
4144
try {
4245
const authenticatorResponse = await startAuthentication({ optionsJSON: optionsResponseJson, useBrowserAutofill });
4346
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });
47+
if (this.requestResultFieldValue && this.element instanceof HTMLFormElement) {
48+
(_a = this.element.querySelector(this.requestResultFieldValue)) === null || _a === void 0 ? void 0 : _a.setAttribute('value', JSON.stringify(authenticatorResponse));
49+
this.element.submit();
50+
return;
51+
}
4452
const assertionResponse = await this._getAssertionResponse(authenticatorResponse);
4553
if (assertionResponse !== false && this.requestSuccessRedirectUriValue) {
4654
window.location.replace(this.requestSuccessRedirectUriValue);
@@ -52,6 +60,7 @@ class default_1 extends Controller {
5260
}
5361
}
5462
async signup(event) {
63+
var _a;
5564
try {
5665
if (!browserSupportsWebAuthn()) {
5766
this._dispatchEvent('webauthn:unsupported', {});
@@ -64,6 +73,11 @@ class default_1 extends Controller {
6473
}
6574
const authenticatorResponse = await startRegistration({ optionsJSON: optionsResponseJson });
6675
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });
76+
if (this.creationResultFieldValue && this.element instanceof HTMLFormElement) {
77+
(_a = this.element.querySelector(this.creationResultFieldValue)) === null || _a === void 0 ? void 0 : _a.setAttribute('value', JSON.stringify(authenticatorResponse));
78+
this.element.submit();
79+
return;
80+
}
6781
const attestationResponseJSON = await this._getAttestationResponse(authenticatorResponse);
6882
if (attestationResponseJSON !== false && this.creationSuccessRedirectUriValue) {
6983
window.location.replace(this.creationSuccessRedirectUriValue);
@@ -151,9 +165,11 @@ class default_1 extends Controller {
151165
default_1.values = {
152166
requestResultUrl: { type: String, default: '/request' },
153167
requestOptionsUrl: { type: String, default: '/request/options' },
168+
requestResultField: { type: String, default: null },
154169
requestSuccessRedirectUri: String,
155170
creationResultUrl: { type: String, default: '/creation' },
156171
creationOptionsUrl: { type: String, default: '/creation/options' },
172+
creationResultField: { type: String, default: null },
157173
creationSuccessRedirectUri: String,
158174
usernameField: { type: String, default: 'username' },
159175
displayNameField: { type: String, default: 'displayName' },

src/stimulus/assets/src/controller.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ export default class extends Controller {
1111
static values = {
1212
requestResultUrl: { type: String, default: '/request' },
1313
requestOptionsUrl: { type: String, default: '/request/options' },
14+
requestResultField: { type: String, default: null },
1415
requestSuccessRedirectUri: String,
1516
creationResultUrl: { type: String, default: '/creation' },
1617
creationOptionsUrl: { type: String, default: '/creation/options' },
18+
creationResultField: { type: String, default: null },
1719
creationSuccessRedirectUri: String,
1820
usernameField: { type: String, default: 'username' },
1921
displayNameField: { type: String, default: 'displayName' },
@@ -32,9 +34,11 @@ export default class extends Controller {
3234

3335
declare readonly requestResultUrlValue: string;
3436
declare readonly requestOptionsUrlValue: string;
37+
declare readonly requestResultFieldValue?: string;
3538
declare readonly requestSuccessRedirectUriValue?: string;
3639
declare readonly creationResultUrlValue: string;
3740
declare readonly creationOptionsUrlValue: string;
41+
declare readonly creationResultFieldValue?: string;
3842
declare readonly creationSuccessRedirectUriValue?: string;
3943
declare readonly usernameFieldValue: string;
4044
declare readonly displayNameFieldValue: string;
@@ -49,6 +53,8 @@ export default class extends Controller {
4953
const options = {
5054
requestResultUrl: this.requestResultUrlValue,
5155
requestOptionsUrl: this.requestOptionsUrlValue,
56+
requestResultField: this.requestResultFieldValue ?? null,
57+
creationResultField: this.creationResultFieldValue ?? null,
5258
requestSuccessRedirectUri: this.requestSuccessRedirectUriValue ?? null,
5359
creationResultUrl: this.creationResultUrlValue,
5460
creationOptionsUrl: this.creationOptionsUrlValue,
@@ -85,6 +91,11 @@ export default class extends Controller {
8591
// @ts-ignore
8692
const authenticatorResponse = await startAuthentication({ optionsJSON: optionsResponseJson, useBrowserAutofill });
8793
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });
94+
if (this.requestResultFieldValue && this.element instanceof HTMLFormElement) {
95+
this.element.querySelector(this.requestResultFieldValue)?.setAttribute('value', JSON.stringify(authenticatorResponse));
96+
this.element.submit();
97+
return;
98+
}
8899

89100
const assertionResponse = await this._getAssertionResponse(authenticatorResponse);
90101
if (assertionResponse !== false && this.requestSuccessRedirectUriValue) {
@@ -111,6 +122,11 @@ export default class extends Controller {
111122
// @ts-ignore
112123
const authenticatorResponse = await startRegistration({ optionsJSON: optionsResponseJson });
113124
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });
125+
if (this.creationResultFieldValue && this.element instanceof HTMLFormElement) {
126+
this.element.querySelector(this.creationResultFieldValue)?.setAttribute('value', JSON.stringify(authenticatorResponse));
127+
this.element.submit();
128+
return;
129+
}
114130

115131
const attestationResponseJSON = await this._getAttestationResponse(authenticatorResponse);
116132
if (attestationResponseJSON !== false && this.creationSuccessRedirectUriValue) {

src/symfony/src/Controller/AssertionControllerFactory.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ final class AssertionControllerFactory implements CanLogData
2323

2424
public function __construct(
2525
private readonly SerializerInterface $serializer,
26+
private readonly OptionsStorage $optionStorage,
2627
private readonly AuthenticatorAssertionResponseValidator $authenticatorAssertionResponseValidator,
2728
private readonly PublicKeyCredentialSourceRepositoryInterface $publicKeyCredentialSourceRepository,
2829
) {
@@ -36,30 +37,44 @@ public function setLogger(LoggerInterface $logger): void
3637

3738
public function createRequestController(
3839
PublicKeyCredentialRequestOptionsBuilder $optionsBuilder,
39-
OptionsStorage $optionStorage,
40+
null|OptionsStorage $optionStorage,
4041
RequestOptionsHandler $optionsHandler,
4142
FailureHandler|AuthenticationFailureHandlerInterface $failureHandler
4243
): AssertionRequestController {
44+
if ($optionStorage !== null) {
45+
trigger_deprecation(
46+
'web-auth/webauthn-lib',
47+
'5.2.0',
48+
'The parameter "$optionStorage" is deprecated since 5.2.0 and will be removed in 6.0.0. Please set "null" and use the global option storage instead.'
49+
);
50+
}
4351
return new AssertionRequestController(
4452
$optionsBuilder,
45-
$optionStorage,
53+
$optionStorage ?? $this->optionStorage,
4654
$optionsHandler,
4755
$failureHandler,
4856
$this->logger,
4957
);
5058
}
5159

5260
public function createResponseController(
53-
OptionsStorage $optionStorage,
61+
null|OptionsStorage $optionStorage,
5462
SuccessHandler $successHandler,
5563
FailureHandler|AuthenticationFailureHandlerInterface $failureHandler,
5664
null|AuthenticatorAssertionResponseValidator $authenticatorAssertionResponseValidator = null,
5765
): AssertionResponseController {
66+
if ($optionStorage !== null) {
67+
trigger_deprecation(
68+
'web-auth/webauthn-lib',
69+
'5.2.0',
70+
'The parameter "$optionStorage" is deprecated since 5.2.0 and will be removed in 6.0.0. Please set "null" and use the global option storage instead.'
71+
);
72+
}
5873
return new AssertionResponseController(
5974
$this->serializer,
6075
$authenticatorAssertionResponseValidator ?? $this->authenticatorAssertionResponseValidator,
6176
$this->logger,
62-
$optionStorage,
77+
$optionStorage ?? $this->optionStorage,
6378
$successHandler,
6479
$failureHandler,
6580
$this->publicKeyCredentialSourceRepository

src/symfony/src/Controller/AttestationControllerFactory.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
final readonly class AttestationControllerFactory
1919
{
2020
public function __construct(
21+
private OptionsStorage $optionStorage,
2122
private SerializerInterface $serializer,
2223
private AuthenticatorAttestationResponseValidator $attestationResponseValidator,
2324
private PublicKeyCredentialSourceRepositoryInterface $publicKeyCredentialSourceRepository
@@ -27,32 +28,46 @@ public function __construct(
2728
public function createRequestController(
2829
PublicKeyCredentialCreationOptionsBuilder $optionsBuilder,
2930
UserEntityGuesser $userEntityGuesser,
30-
OptionsStorage $optionStorage,
31+
null|OptionsStorage $optionStorage,
3132
CreationOptionsHandler $creationOptionsHandler,
3233
FailureHandler|AuthenticationFailureHandlerInterface $failureHandler,
3334
bool $hideExistingExcludedCredentials = false
3435
): AttestationRequestController {
36+
if ($optionStorage !== null) {
37+
trigger_deprecation(
38+
'web-auth/webauthn-lib',
39+
'5.2.0',
40+
'The parameter "$optionStorage" is deprecated since 5.2.0 and will be removed in 6.0.0. Please set "null" and use the global option storage instead.'
41+
);
42+
}
3543
return new AttestationRequestController(
3644
$optionsBuilder,
3745
$userEntityGuesser,
38-
$optionStorage,
46+
$optionStorage ?? $this->optionStorage,
3947
$creationOptionsHandler,
4048
$failureHandler,
4149
$hideExistingExcludedCredentials
4250
);
4351
}
4452

4553
public function createResponseController(
46-
OptionsStorage $optionStorage,
54+
null|OptionsStorage $optionStorage,
4755
SuccessHandler $successHandler,
4856
FailureHandler|AuthenticationFailureHandlerInterface $failureHandler,
4957
null|AuthenticatorAttestationResponseValidator $attestationResponseValidator = null,
5058
): AttestationResponseController {
59+
if ($optionStorage !== null) {
60+
trigger_deprecation(
61+
'web-auth/webauthn-lib',
62+
'5.2.0',
63+
'The parameter "$optionStorage" is deprecated since 5.2.0 and will be removed in 6.0.0. Please set "null" and use the global option storage instead.'
64+
);
65+
}
5166
return new AttestationResponseController(
5267
$this->serializer,
5368
$attestationResponseValidator ?? $this->attestationResponseValidator,
5469
$this->publicKeyCredentialSourceRepository,
55-
$optionStorage,
70+
$optionStorage ?? $this->optionStorage,
5671
$successHandler,
5772
$failureHandler,
5873
);

0 commit comments

Comments
 (0)