This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run the registration policy on upstream OAuth registration
- Loading branch information
Showing
13 changed files
with
205 additions
and
36 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package email | ||
|
||
test_allow_all_domains { | ||
allow with input.email as "[email protected]" | ||
} | ||
|
||
test_allowed_domain { | ||
allow with input.email as "[email protected]" | ||
with data.allowed_domains as ["*.element.io"] | ||
} | ||
|
||
test_not_allowed_domain { | ||
not allow with input.email as "[email protected]" | ||
with data.allowed_domains as ["example.com"] | ||
} | ||
|
||
test_banned_domain { | ||
not allow with input.email as "[email protected]" | ||
with data.banned_domains as ["*.element.io"] | ||
} | ||
|
||
test_banned_subdomain { | ||
not allow with input.email as "[email protected]" | ||
with data.allowed_domains as ["*.element.io"] | ||
with data.banned_domains as ["staging.element.io"] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package password | ||
|
||
test_password_require_number { | ||
allow with data.passwords.require_number as true | ||
|
||
not allow with input.password as "hunter" | ||
with data.passwords.require_number as true | ||
} | ||
|
||
test_password_require_lowercase { | ||
allow with data.passwords.require_lowercase as true | ||
|
||
not allow with input.password as "HUNTER2" | ||
with data.passwords.require_lowercase as true | ||
} | ||
|
||
test_password_require_uppercase { | ||
allow with data.passwords.require_uppercase as true | ||
|
||
not allow with input.password as "hunter2" | ||
with data.passwords.require_uppercase as true | ||
} | ||
|
||
test_password_min_length { | ||
allow with data.passwords.min_length as 6 | ||
|
||
not allow with input.password as "short" | ||
with data.passwords.min_length as 6 | ||
} |
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 |
---|---|---|
|
@@ -32,54 +32,58 @@ test_banned_subdomain { | |
with data.banned_domains as ["staging.element.io"] | ||
} | ||
|
||
test_email_required { | ||
not allow with input as {"username": "hello", "registration_method": "password"} | ||
} | ||
|
||
test_no_email { | ||
allow with input as {"username": "hello", "registration_method": "upstream-oauth2"} | ||
} | ||
|
||
test_short_username { | ||
not allow with input as {"username": "a", "email": "[email protected]"} | ||
not allow with input as {"username": "a", "registration_method": "upstream-oauth2"} | ||
} | ||
|
||
test_long_username { | ||
not allow with input as {"username": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "email": "[email protected]"} | ||
not allow with input as {"username": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "registration_method": "upstream-oauth2"} | ||
} | ||
|
||
test_invalid_username { | ||
not allow with input as {"username": "hello world", "registration_method": "upstream-oauth2"} | ||
} | ||
|
||
test_password_require_number { | ||
allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with data.passwords.require_number as true | ||
|
||
not allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with input.password as "hunter" | ||
with data.passwords.require_number as true | ||
} | ||
|
||
test_password_require_lowercase { | ||
allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with data.passwords.require_lowercase as true | ||
|
||
not allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with input.password as "HUNTER2" | ||
with data.passwords.require_lowercase as true | ||
} | ||
|
||
test_password_require_uppercase { | ||
allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with data.passwords.require_uppercase as true | ||
|
||
not allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with input.password as "hunter2" | ||
with data.passwords.require_uppercase as true | ||
} | ||
|
||
test_password_min_length { | ||
allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with data.passwords.min_length as 6 | ||
|
||
not allow with input as mock_registration | ||
with input.registration_method as "password" | ||
with input.password as "short" | ||
with data.passwords.min_length as 6 | ||
} |
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
Oops, something went wrong.