Skip to content

Commit

Permalink
Fixes #37504 - send 404 to v2 client requesting v1/search
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Jun 18, 2024
1 parent 98dfce0 commit 276adf2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,10 @@ def v1_ping
end

def v1_search
# Checks for podman client and issues a 404 in that case. Podman
# Checks for v2 client and issues a 404 in that case. Podman
# examines the response from a /v1_search request. If the result
# is a 4XX, it will then proceed with a request to /_catalog
if request.headers['HTTP_USER_AGENT'].downcase.include?('libpod')
if request.headers['HTTP_DOCKER_DISTRIBUTION_API_VERSION'] == 'registry/2.0'
render json: {}, status: :not_found
return
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def setup_permissions
it "blocks search for podman" do
@docker_repo.set_container_repository_name
@docker_env_repo.set_container_repository_name
@request.env['HTTP_USER_AGENT'] = "libpod/1.8.0"
@request.env['HTTP_DOCKER_DISTRIBUTION_API_VERSION'] = "registry/2.0"
get :v1_search, params: { q: "abc", n: 2 }
assert_response 404
end
Expand Down

0 comments on commit 276adf2

Please sign in to comment.