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.
Remove password from rego policy descriptions and Makefile
- Loading branch information
1 parent
9779a21
commit 10e58ce
Showing
10 changed files
with
29 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,14 +204,9 @@ impl Policy { | |
pub async fn evaluate_register( | ||
&mut self, | ||
username: &str, | ||
password: &str, | ||
email: &str, | ||
) -> Result<EvaluationResult, EvaluationError> { | ||
let input = RegisterInput::Password { | ||
username, | ||
password, | ||
email, | ||
}; | ||
let input = RegisterInput::Password { username, email }; | ||
|
||
let [res]: [EvaluationResult; 1] = self | ||
.instance | ||
|
@@ -404,19 +399,19 @@ mod tests { | |
let mut policy = factory.instantiate().await.unwrap(); | ||
|
||
let res = policy | ||
.evaluate_register("hello", "hunter2", "[email protected]") | ||
.evaluate_register("hello", "[email protected]") | ||
.await | ||
.unwrap(); | ||
assert!(!res.valid()); | ||
|
||
let res = policy | ||
.evaluate_register("hello", "hunter2", "[email protected]") | ||
.evaluate_register("hello", "[email protected]") | ||
.await | ||
.unwrap(); | ||
assert!(res.valid()); | ||
|
||
let res = policy | ||
.evaluate_register("hello", "hunter2", "[email protected]") | ||
.evaluate_register("hello", "[email protected]") | ||
.await | ||
.unwrap(); | ||
assert!(!res.valid()); | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ package register | |
mock_registration := { | ||
"registration_method": "password", | ||
"username": "hello", | ||
"password": "Hunter2", | ||
"email": "[email protected]", | ||
} | ||
|
||
|
@@ -51,39 +50,3 @@ test_long_username { | |
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 data.passwords.require_number as true | ||
|
||
not allow with input as mock_registration | ||
with input.password as "hunter" | ||
with data.passwords.require_number as true | ||
} | ||
|
||
test_password_require_lowercase { | ||
allow with input as mock_registration | ||
with data.passwords.require_lowercase as true | ||
|
||
not allow with input as mock_registration | ||
with input.password as "HUNTER2" | ||
with data.passwords.require_lowercase as true | ||
} | ||
|
||
test_password_require_uppercase { | ||
allow with input as mock_registration | ||
with data.passwords.require_uppercase as true | ||
|
||
not allow with input as mock_registration | ||
with input.password as "hunter2" | ||
with data.passwords.require_uppercase as true | ||
} | ||
|
||
test_password_min_length { | ||
allow with input as mock_registration | ||
with data.passwords.min_length as 6 | ||
|
||
not allow with input as mock_registration | ||
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