summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-07 11:55:54 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-09-15 12:21:00 -0500
commit71aff7f6a3ab63f1395bfab6ea49f0175fe08167 (patch)
treefb5a26ecf10deeabdeb10f4950a43ee345086558 /spec
parentc144db2935f0f71c7f282a3015d126526bc16b57 (diff)
downloadgitlab-ce-71aff7f6a3ab63f1395bfab6ea49f0175fe08167.tar.gz
Use special characters for `lfs+deploy-key` to prevent a someone from creating a user with this username, and method name refactoring.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/auth_spec.rb4
-rw-r--r--spec/lib/gitlab/lfs_token_spec.rb2
-rw-r--r--spec/requests/api/internal_spec.rb2
-rw-r--r--spec/requests/lfs_http_spec.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
index 4c8e09cd904..56f349f5d92 100644
--- a/spec/lib/gitlab/auth_spec.rb
+++ b/spec/lib/gitlab/auth_spec.rb
@@ -37,8 +37,8 @@ describe Gitlab::Auth, lib: true do
ip = 'ip'
token = Gitlab::LfsToken.new(key).generate
- expect(gl_auth).to receive(:rate_limit!).with(ip, success: true, login: "lfs-deploy-key-#{key.id}")
- expect(gl_auth.find_for_git_client("lfs-deploy-key-#{key.id}", token, project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new(key, :lfs_deploy_token))
+ expect(gl_auth).to receive(:rate_limit!).with(ip, success: true, login: "lfs+deploy-key-#{key.id}")
+ expect(gl_auth.find_for_git_client("lfs+deploy-key-#{key.id}", token, project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new(key, :lfs_deploy_token))
end
it 'recognizes OAuth tokens' do
diff --git a/spec/lib/gitlab/lfs_token_spec.rb b/spec/lib/gitlab/lfs_token_spec.rb
index f9812664e3b..184f235c1b2 100644
--- a/spec/lib/gitlab/lfs_token_spec.rb
+++ b/spec/lib/gitlab/lfs_token_spec.rb
@@ -40,7 +40,7 @@ describe Gitlab::LfsToken, lib: true do
it_behaves_like 'an LFS token generator'
it 'returns the correct username' do
- expect(handler.actor_name).to eq("lfs-deploy-key-#{actor.id}")
+ expect(handler.actor_name).to eq("lfs+deploy-key-#{actor.id}")
end
it 'returns the correct token type' do
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 1ee390e0a19..2e1e6a11b53 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -124,7 +124,7 @@ describe API::API, api: true do
lfs_auth(key, project)
expect(response).to have_http_status(200)
- expect(json_response['username']).to eq("lfs-deploy-key-#{key.id}")
+ expect(json_response['username']).to eq("lfs+deploy-key-#{key.id}")
expect(json_response['lfs_token']).to eq(Gitlab::LfsToken.new(key).value)
expect(json_response['repository_http_path']).to eq(project.http_url_to_repo)
end
diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb
index e61502400ff..54ecb793729 100644
--- a/spec/requests/lfs_http_spec.rb
+++ b/spec/requests/lfs_http_spec.rb
@@ -917,7 +917,7 @@ describe 'Git LFS API and storage' do
end
def authorize_deploy_key
- ActionController::HttpAuthentication::Basic.encode_credentials("lfs-deploy-key-#{key.id}", Gitlab::LfsToken.new(key).generate)
+ ActionController::HttpAuthentication::Basic.encode_credentials("lfs+deploy-key-#{key.id}", Gitlab::LfsToken.new(key).generate)
end
def fork_project(project, user, object = nil)