diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-16 03:13:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-16 03:13:19 +0000 |
commit | 0e6ff93eba3ed1ba4c7be0ec78a76dde71a47285 (patch) | |
tree | 5644055ecab86d9f68a1ac701ca8ac8e9219ce77 /spec/initializers | |
parent | d746accf38bc9304f29c2bc4a70dfdc6565170f7 (diff) | |
download | gitlab-ce-0e6ff93eba3ed1ba4c7be0ec78a76dde71a47285.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers')
-rw-r--r-- | spec/initializers/settings_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/initializers/settings_spec.rb b/spec/initializers/settings_spec.rb index 71ea12a41aa..c3200d2fab1 100644 --- a/spec/initializers/settings_spec.rb +++ b/spec/initializers/settings_spec.rb @@ -58,4 +58,40 @@ RSpec.describe Settings do end end end + + describe "#weak_passwords_digest_set" do + subject { described_class.gitlab.weak_passwords_digest_set } + + it 'is a Set' do + expect(subject).to be_kind_of(Set) + end + + it 'contains 4500 password digests' do + expect(subject.length).to eq(4500) + end + + it 'includes 8 char weak password digest' do + expect(subject).to include(digest("password")) + end + + it 'includes 16 char weak password digest' do + expect(subject).to include(digest("progressivehouse")) + end + + it 'includes long char weak password digest' do + expect(subject).to include(digest("01234567890123456789")) + end + + it 'does not include 7 char weak password digest' do + expect(subject).not_to include(digest("1234567")) + end + + it 'does not include plaintext' do + expect(subject).not_to include("password") + end + + def digest(plaintext) + Digest::SHA256.base64digest(plaintext) + end + end end |