Skip to content

Commit 5fd4bc1

Browse files
[Security/Http] fix parsing X509 emailAddress
1 parent aa05d5d commit 5fd4bc1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Firewall/X509AuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function getPreAuthenticatedData(Request $request)
4646
$user = $request->server->get($this->userKey);
4747
} elseif (
4848
$request->server->has($this->credentialKey)
49-
&& preg_match('#emailAddress=(.+\@.+\.[^,/]+)($|,|/)#', $request->server->get($this->credentialKey), $matches)
49+
&& preg_match('#emailAddress=([^,/@]++@[^,/]++)#', $request->server->get($this->credentialKey), $matches)
5050
) {
5151
$user = $matches[1];
5252
}

Tests/Firewall/X509AuthenticationListenerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public static function dataProviderGetPreAuthenticatedDataNoUser()
8181
yield ['[email protected]', 'CN=Sample certificate DN,[email protected]'];
8282
yield ['[email protected]', '[email protected],CN=Sample certificate DN'];
8383
84+
yield ['[email protected]', '[email protected],CN=Firstname.Lastname,OU=london,OU=company design and engineering,OU=Issuer London,OU=Roaming,OU=Interactive,OU=Users,OU=Standard,OU=Business,DC=england,DC=core,DC=company,DC=co,DC=uk'];
8485
}
8586

8687
public function testGetPreAuthenticatedDataNoData()

0 commit comments

Comments
 (0)