Validate regex before using `CleanupContainerRepositoryWorker`
Three guards have been added: 1. The service used by the worker will not raise an error upon receiving an invalid regex but it will return an error response 2. The expiration container policy will not schedule the next run for the given container expiration policy if it is valid. In addition, the given container expiration policy will be disabled 3. Added a new UntrustedRegexp validator for Grape APIs. This one has been used in `API::ProjectContainerRepositories` to prevent enqueuing a job with invalid regex
显示
- app/models/container_expiration_policy.rb 4 个添加, 0 个删除app/models/container_expiration_policy.rb
- app/services/container_expiration_policy_service.rb 7 个添加, 0 个删除app/services/container_expiration_policy_service.rb
- app/services/projects/container_repository/cleanup_tags_service.rb 12 个添加, 0 个删除...ces/projects/container_repository/cleanup_tags_service.rb
- app/workers/container_expiration_policy_worker.rb 2 个添加, 0 个删除app/workers/container_expiration_policy_worker.rb
- changelogs/unreleased/216088-disable-container-expiration-policy-when-invalid-regex-is-present.yml 5 个添加, 0 个删除...ainer-expiration-policy-when-invalid-regex-is-present.yml
- config/initializers/grape_validators.rb 1 个添加, 0 个删除config/initializers/grape_validators.rb
- doc/api/container_registry.md 3 个添加, 3 个删除doc/api/container_registry.md
- lib/api/project_container_repositories.rb 3 个添加, 3 个删除lib/api/project_container_repositories.rb
- lib/api/validations/validators/untrusted_regexp.rb 19 个添加, 0 个删除lib/api/validations/validators/untrusted_regexp.rb
- spec/lib/api/validations/validators/untrusted_regexp_spec.rb 28 个添加, 0 个删除spec/lib/api/validations/validators/untrusted_regexp_spec.rb
- spec/models/container_expiration_policy_spec.rb 10 个添加, 0 个删除spec/models/container_expiration_policy_spec.rb
- spec/requests/api/project_container_repositories_spec.rb 34 个添加, 0 个删除spec/requests/api/project_container_repositories_spec.rb
- spec/services/container_expiration_policy_service_spec.rb 15 个添加, 0 个删除spec/services/container_expiration_policy_service_spec.rb
- spec/services/projects/container_repository/cleanup_tags_service_spec.rb 42 个添加, 1 个删除...rojects/container_repository/cleanup_tags_service_spec.rb
- spec/workers/container_expiration_policy_worker_spec.rb 17 个添加, 0 个删除spec/workers/container_expiration_policy_worker_spec.rb
想要评论请 注册 或 登录