Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-29 11:23:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-29 11:23:24 +0300
commit2234b4382091add4dfe8d44f4e0764bf64ff8c5e (patch)
tree2e16ea43616574e4612223b7cdb70322ce914648 /spec/lib/gitlab
parent6c85cb2ff17cf4ea34372e84ef579734fd607cec (diff)
Add latest changes from gitlab-org/security/gitlab@14-10-stable-ee
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/conan_token_spec.rb14
-rw-r--r--spec/lib/gitlab/regex_spec.rb15
2 files changed, 24 insertions, 5 deletions
diff --git a/spec/lib/gitlab/conan_token_spec.rb b/spec/lib/gitlab/conan_token_spec.rb
index b6180f69044..c8bda0a5cf0 100644
--- a/spec/lib/gitlab/conan_token_spec.rb
+++ b/spec/lib/gitlab/conan_token_spec.rb
@@ -25,13 +25,17 @@ RSpec.describe Gitlab::ConanToken do
end
describe '.from_personal_access_token' do
- it 'sets access token id and user id' do
- access_token = double(id: 123, user_id: 456)
+ it 'sets access token and user id and does not use the token id' do
+ personal_access_token = double(id: 999, token: 123, user_id: 456)
- token = described_class.from_personal_access_token(access_token)
+ token = described_class.from_personal_access_token(
+ personal_access_token.user_id,
+ personal_access_token.token
+ )
- expect(token.access_token_id).to eq(123)
- expect(token.user_id).to eq(456)
+ expect(token.access_token_id).not_to eq(personal_access_token.id)
+ expect(token.access_token_id).to eq(personal_access_token.token)
+ expect(token.user_id).to eq(personal_access_token.user_id)
end
end
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
index f3e8c440fba..b4c1f3b689b 100644
--- a/spec/lib/gitlab/regex_spec.rb
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -1005,4 +1005,19 @@ RSpec.describe Gitlab::Regex do
it { is_expected.not_to match('.xt.est_') }
it { is_expected.not_to match('0test1') }
end
+
+ describe '.sha256_regex' do
+ subject { described_class.sha256_regex }
+
+ it { is_expected.to match('a' * 64) }
+ it { is_expected.to match('abcdefABCDEF1234567890abcdefABCDEF1234567890abcdefABCDEF12345678') }
+ it { is_expected.not_to match('a' * 63) }
+ it { is_expected.not_to match('a' * 65) }
+ it { is_expected.not_to match('a' * 63 + 'g') }
+ it { is_expected.not_to match('a' * 63 + '{') }
+ it { is_expected.not_to match('a' * 63 + '%') }
+ it { is_expected.not_to match('a' * 63 + '*') }
+ it { is_expected.not_to match('a' * 63 + '#') }
+ it { is_expected.not_to match('') }
+ end
end