Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pentest partners to have AWS user accounts #268

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/lib/email_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def self.email_is_allowed_basic?(email)
return true if email.end_with? '@softwire.com'
return true if email.end_with? '@fidusinfosec.com'
return true if email.end_with? '@cyberis.com'
return true if email.end_with? '@pentestpartners.com'
false
end

Expand All @@ -25,6 +26,7 @@ def self.allowed_emails_regexp
/([a-z0-9.\-\']+@softwire\.com,?\s*)/,
/([a-z0-9.\-\']+@fidusinfosec\.com,?\s*)/,
/([a-z0-9.\-\']+@cyberis\.com,?\s*)/,
/([a-z0-9.\-\']+@pentestpartners\.com,?\s*)/,
)})+\z/
end

Expand Down
10 changes: 10 additions & 0 deletions test/lib/email_validator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class EmailValidatorTest < ActiveSupport::TestCase
assert EmailValidator.email_is_allowed_basic?(email)
end

test 'Pentestpartners email addresses are allowed to sign in' do
email = '[email protected]'
assert EmailValidator.email_is_allowed_basic?(email)
end

test 'Other email addresses are not allowed to sign in' do
email = '[email protected]'
assert ! EmailValidator.email_is_allowed_basic?(email)
Expand Down Expand Up @@ -86,6 +91,11 @@ class EmailValidatorTest < ActiveSupport::TestCase
assert_match EmailValidator.allowed_emails_regexp, email
end

test 'Pentestpartners emails are matched by the allowed emails regexp' do
email = '[email protected]'
assert_match EmailValidator.allowed_emails_regexp, email
end

test 'Emails with numbers in the local part are allowed' do
email = '[email protected]'
assert_match EmailValidator.allowed_emails_regexp, email
Expand Down
Loading