diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb
index 839f514ad5851ed39acada010d8b1556ddcf76cc..dcb728b615156d287268d1c186371dfe19f1bedf 100644
--- a/app/services/auth/container_registry_authentication_service.rb
+++ b/app/services/auth/container_registry_authentication_service.rb
@@ -64,6 +64,10 @@ module Auth
     end
 
     def process_repository_access(type, path, actions)
+      # TODO, add specs for invalid paths
+      #
+      return unless path.valid?
+
       requested_project = path.repository_project
 
       return unless requested_project