-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce domain restrictions on the domain part of the email address
- Loading branch information
Showing
4 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,24 @@ public function testEmailRestrictions() | |
$this->container['memoryCache']->flush(); | ||
$this->assertTrue($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
$this->assertFalse($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
$this->assertFalse($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
|
||
$this->assertTrue($this->container['configModel']->save(array('google_account_creation' => '1', 'google_email_domains' => 'example.org, example.com'))); | ||
$this->container['memoryCache']->flush(); | ||
$this->assertTrue($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
$this->assertTrue($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
$this->assertFalse($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
$this->assertFalse($provider->isAccountCreationAllowed(array('email' => 'invalid email'))); | ||
|
||
$this->assertTrue($this->container['configModel']->save(array('google_account_creation' => '1', 'google_email_domains' => 'example'))); | ||
$this->container['memoryCache']->flush(); | ||
$this->assertTrue($provider->isAccountCreationAllowed(array('email' => 'me@example'))); | ||
$this->assertFalse($provider->isAccountCreationAllowed(array('email' => 'example@localhost'))); | ||
|
||
$this->assertTrue($this->container['configModel']->save(array('google_account_creation' => '1', 'google_email_domains' => 'example.org'))); | ||
$this->container['memoryCache']->flush(); | ||
$this->assertTrue($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
$this->assertFalse($provider->isAccountCreationAllowed(array('email' => '[email protected]'))); | ||
} | ||
|
||
public function testGetClientId() | ||
|
2c283fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there.
There is a missing case. You covered
but not
if example.org is owned by an attacker they can break in. And google allows you to register any email address as a google account, so all someone needs is their own domain and email server to pull that off.
I think that rather than
you should use
2c283fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a small improvement: you could also pull
out of the loop, since it doesn't depend on the iteration.