Skip to content

Commit

Permalink
Merge pull request #268 from alphagov/pentestpartners
Browse files Browse the repository at this point in the history
Allow pentest partners to have AWS user accounts
  • Loading branch information
stephengrier authored Sep 5, 2023
2 parents fe8b49e + ade3cac commit e8840e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit e8840e3

Please sign in to comment.