Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Artifact RegistryPolicyArtifacts

Set artifact filtering rules

Use allowed and blocked regular expression patterns to control which artifact names can be pushed to a registry on every push.

Artifact filtering rules use regular expressions to control which artifacts can enter a registry. You set rules at the registry level, and they apply on every push.

Two rule types are available:

  • Allowed patterns: a push succeeds only when the artifact name matches at least one allowed pattern. If allowed patterns are configured and the artifact name does not match, the push is rejected.

  • Blocked patterns: a push is rejected when the artifact name matches a blocked pattern, regardless of allowed pattern settings.

When both are set, the blocked pattern takes precedence: an artifact that matches both an allowed and a blocked pattern is rejected.

Before you begin

Your role must include Create/Edit permission on the registry. Go to RBAC and permissions for details.

Set filtering rules

  1. In the left navigation, select Registries.

  2. Click the registry you want to configure.

  3. Select the Configuration tab.

  4. In the Artifact filtering rules section, click the edit icon to open the drawer.

  5. Enter a regex pattern in the Allowed Patterns or Blocked Patterns field, then press Enter to add it. Repeat for each pattern.

  6. Save the setting.

Patterns are evaluated against the artifact name (excluding the registry prefix and version). Patterns are matched using standard regex, not wildcards.

Pattern examples

Restrict to production artifacts only

To allow only artifacts whose names end with -prod and reject any that start with dev-:

  • Allowed patterns: .*-prod

  • Blocked patterns: dev-.*

This allows api-service-prod and worker-prod, and rejects dev-api-service and dev-worker.

Block a specific artifact name

To prevent a known problematic package from being pushed:

  • Blocked patterns: legacy-auth-service

Allow only a namespaced prefix

To enforce that all artifacts in the registry belong to a specific team namespace:

  • Allowed patterns: team-payments/.*

Considerations

  • Patterns apply to pushes only, not to pulls. Existing artifacts in the registry are not retroactively blocked.

  • If no allowed pattern is set, all artifact names are permitted unless blocked.

  • Each pattern must match the entire artifact name. .*-prod matches any name ending with -prod; use ^my-service$ to match a single exact name.

  • To remove a pattern, open the Artifact filtering rules edit drawer and delete the pattern entry.

Troubleshooting

A push is rejected but the artifact name looks correct

Filtering rules match against the artifact name only, not the full registry path. Check that your allowed pattern matches the artifact name as it appears in the registry, without the pkg.harness.io/<account>/<registry>/ prefix or the version tag.

I want to allow all artifacts except a few

Leave Allowed patterns empty (which permits all names by default) and add your exclusion rules to Blocked patterns.

Next steps

Last updated

Was this helpful?