Commit 2d838890 authored by Valery Sizov's avatar Valery Sizov

Fix JWT token check when repository does not exist

parent 35d4810f
...@@ -60,11 +60,11 @@ module EE ...@@ -60,11 +60,11 @@ module EE
end end
def jwt_scope_valid? def jwt_scope_valid?
decoded_authorization[:scope] == repository.full_path decoded_authorization[:scope] == repository_full_path
end end
def repository def repository_full_path
wiki? ? project.wiki.repository : project.repository File.join(params[:namespace_id], project_path)
end end
def decoded_authorization def decoded_authorization
......
---
title: Fix JWT token check when repository does not exist
merge_request: 11033
author:
type: fixed
...@@ -348,6 +348,22 @@ describe "Git HTTP requests (Geo)", :geo do ...@@ -348,6 +348,22 @@ describe "Git HTTP requests (Geo)", :geo do
end end
end end
context 'repository does not exist' do
subject do
make_request
response
end
def make_request
full_path = project.full_path
project.destroy
get "/#{full_path}.git/info/refs", params: { service: 'git-upload-pack' }, headers: env
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'invalid scope' do context 'invalid scope' do
subject do subject do
make_request make_request
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment