Skip to content

fix(image): pass registry arguments through init_global_provider#10470

Merged
andoniaf merged 3 commits intoprowler-cloud:masterfrom
eblume:fix/image-provider-registry-args
Mar 30, 2026
Merged

fix(image): pass registry arguments through init_global_provider#10470
andoniaf merged 3 commits intoprowler-cloud:masterfrom
eblume:fix/image-provider-registry-args

Conversation

@eblume
Copy link
Copy Markdown
Contributor

@eblume eblume commented Mar 25, 2026

This PR resoles the corresponding issue: #10457

PR #9985 added registry scan support with --registry, --image-filter, --tag-filter, --max-images, --registry-insecure, and --registry-list-images flags. PR #10128 accidentally removed these kwargs from the init_global_provider call, so the CLI parsed them but never forwarded them to the ImageProvider constructor.

This restores the six missing kwargs and adds a regression test.

Please note, this is my first time contributing to Prowler, I have done my best to follow the guidelines from CONTRIBUTING.md.

Context

While deploying Prowler 5.22.0 as a weekly CronJob to scan my private OCI registry (blumeops), I discovered that prowler image --registry <url> always fails with ImageNoImagesProvidedError[11000]: No images provided for scanning, regardless of registry configuration.

Root cause: PR #9985 (merged 2026-02-19) correctly added registry kwargs (registry, image_filter, tag_filter, max_images, registry_insecure, registry_list_images) to the init_global_provider call. PR #10128 (merged 2026-02-24) accidentally removed them — likely a merge conflict resolution that took the older version of the ImageProvider constructor call.

My current workaround is an init container that enumerates images via the registry's /v2/_catalog API and generates an --image-list file, bypassing --registry entirely.

Description

Restores the six missing registry-related kwargs to the init_global_provider call for the image provider in prowler/providers/common/provider.py:

  • registry
  • image_filter
  • tag_filter
  • max_images
  • registry_insecure
  • registry_list_images

These are parsed by the CLI argument parser and accepted by ImageProvider.__init__, but were not being forwarded between the two.

Adds a regression test that exercises the full CLI-to-registry-enumeration path: it passes --registry and --image-filter arguments through init_global_provider, mocks the registry adapter, and asserts that matching images are discovered and filtered correctly. This reproduces the exact ImageNoImagesProvidedError when the fix is reverted.

Steps to review

  1. Compare the elif "image" block in prowler/providers/common/provider.py against ImageProvider.__init__ signature in prowler/providers/image/image_provider.py. The six added kwargs match constructor parameters that were previously unreachable.
  2. Run the regression test: pytest tests/providers/image/image_provider_test.py::TestInitGlobalProviderRegistryEnumeration -xvs
  3. To verify the bug exists on master, revert the provider.py change and re-run the test. It should fail with ImageNoImagesProvidedError[11000]: No images provided for scanning.
  4. Run the full image provider test suite: pytest tests/providers/image/image_provider_test.py. All 116 tests should pass.

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? No

UI

N/A

API

N/A

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

PR prowler-cloud#9985 added registry scan support with --registry, --image-filter,
--tag-filter, --max-images, --registry-insecure, and
--registry-list-images flags. PR prowler-cloud#10128 accidentally removed these
kwargs from the init_global_provider call, so the CLI parsed them
but never forwarded them to the ImageProvider constructor.

This restores the six missing kwargs and adds a regression test.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@andoniaf
Copy link
Copy Markdown
Member

andoniaf commented Mar 30, 2026

Closing and reopening to trigger CI approval flow for fork PR. Github is not having its best day...

@andoniaf andoniaf closed this Mar 30, 2026
@andoniaf andoniaf reopened this Mar 30, 2026
@andoniaf andoniaf changed the title fix(image): pass registry arguments through init_global_provider fix(image): pass registry arguments through init_global_provider Mar 30, 2026
@andoniaf andoniaf changed the title fix(image): pass registry arguments through init_global_provider fix(image): pass registry arguments through init_global_provider Mar 30, 2026
@andoniaf andoniaf merged commit de5bb94 into prowler-cloud:master Mar 30, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants