Skip to content

Protected packages: Align logic for protection rules across registries

What does this MR do and why?

  • This MR intends to keep the code and implementation consistent across the container and the package registry; this means, we want to apply improvements from the implementation of the protected containers, see related MRs
  • Renaming the scope method .push_protected_from? to .for_push_exists? in order to be alinged with the scope method used in app/models/container_registry/protection/rule.rb
  • Adjust return value of scope method to reflect the same logic as in app/models/container_registry/protection/rule.rb

🛠 with at Siemens

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

MR Checklist (@gerardo-navarro)

Screenshots or screen recordings

Only backend changes

How to set up and validate locally

  1. Execute the relevant tests
bundle exec rspec spec/models/packages/protection/rule_spec.rb spec/services/packages/npm/create_package_service_spec.rb

Related to #416382

💾 Database review

Edited by Gerardo Navarro

Merge request reports