feat: allow disabling CVE independently from search#4102
Open
rchincha wants to merge 1 commit into
Open
Conversation
rchincha
force-pushed
the
feat-disable-cve-keep-ui-search
branch
from
May 26, 2026 22:14
e68e23c to
51e403b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a way to disable CVE scanning independently of the search/UI extensions, enabling configurations like UI + search + remote storage (S3/GCS) without triggering Trivy DB downloads or remote-storage incompatibility checks.
Changes:
- Adds
extensions.search.cve.enableto explicitly disable CVE scanning while leaving search/UI enabled. - Updates server defaulting logic to skip CVE/Trivy defaults when CVE is explicitly disabled.
- Adjusts GraphQL CVE query resolvers (and tests) to return empty results when CVE is disabled.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/extensions/search/schema.resolvers.go | Returns empty CVE GraphQL results when CVE is disabled (instead of error). |
| pkg/extensions/search/resolver_test.go | Updates/extends resolver tests to cover empty-result behavior with nil cveInfo. |
| pkg/extensions/config/config.go | Adds CVEConfig.Enable and updates IsCveScanningEnabled() semantics. |
| pkg/extensions/config/config_test.go | Adds coverage for search enabled + CVE explicitly disabled. |
| pkg/cli/server/root.go | Skips CVE defaults (interval/Trivy repos) when CVE is explicitly disabled. |
| pkg/cli/server/extensions_test.go | Adds config verification + serve tests for explicit CVE disablement. |
| examples/config-ui-no-cve.json | Adds example config enabling UI with CVE disabled. |
Files not reviewed (1)
- pkg/extensions/search/schema.resolvers.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rchincha
force-pushed
the
feat-disable-cve-keep-ui-search
branch
from
May 26, 2026 22:36
51e403b to
87a2ba4
Compare
fixes issue project-zot#4096 Useful for airgapped environments and deployments which don't care about CVEs. Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>
rchincha
force-pushed
the
feat-disable-cve-keep-ui-search
branch
from
May 26, 2026 22:49
87a2ba4 to
8abf21c
Compare
Comment on lines
18
to
+23
| func (r *queryResolver) CVEListForImage(ctx context.Context, image string, requestedPage *gql_generated.PageInput, searchedCve *string, excludedCve *string, severity *string) (*gql_generated.CVEResultForImage, error) { | ||
| if r.cveInfo == nil { | ||
| return &gql_generated.CVEResultForImage{}, zerr.ErrCVESearchDisabled | ||
| return &gql_generated.CVEResultForImage{ | ||
| CVEList: []*gql_generated.Cve{}, | ||
| Page: &gql_generated.PageInfo{}, | ||
| }, nil |
Comment on lines
30
to
+45
| func (r *queryResolver) CVEDiffListForImages(ctx context.Context, minuend gql_generated.ImageInput, subtrahend gql_generated.ImageInput, requestedPage *gql_generated.PageInput, searchedCve *string, excludedCve *string) (*gql_generated.CVEDiffResult, error) { | ||
| if r.cveInfo == nil { | ||
| return &gql_generated.CVEDiffResult{}, zerr.ErrCVESearchDisabled | ||
| return &gql_generated.CVEDiffResult{ | ||
| Minuend: &gql_generated.ImageIdentifier{ | ||
| Repo: minuend.Repo, | ||
| Tag: minuend.Tag, | ||
| Digest: minuend.Digest, | ||
| }, | ||
| Subtrahend: &gql_generated.ImageIdentifier{ | ||
| Repo: subtrahend.Repo, | ||
| Tag: subtrahend.Tag, | ||
| Digest: subtrahend.Digest, | ||
| }, | ||
| CVEList: []*gql_generated.Cve{}, | ||
| Page: &gql_generated.PageInfo{}, | ||
| }, nil |
Comment on lines
52
to
+58
| // ImageListForCve is the resolver for the ImageListForCVE field. | ||
| func (r *queryResolver) ImageListForCve(ctx context.Context, id string, filter *gql_generated.Filter, requestedPage *gql_generated.PageInput) (*gql_generated.PaginatedImagesResult, error) { | ||
| if r.cveInfo == nil { | ||
| return &gql_generated.PaginatedImagesResult{}, zerr.ErrCVESearchDisabled | ||
| return &gql_generated.PaginatedImagesResult{ | ||
| Page: &gql_generated.PageInfo{}, | ||
| Results: []*gql_generated.ImageSummary{}, | ||
| }, nil |
Comment on lines
66
to
+72
| // ImageListWithCVEFixed is the resolver for the ImageListWithCVEFixed field. | ||
| func (r *queryResolver) ImageListWithCVEFixed(ctx context.Context, id string, image string, filter *gql_generated.Filter, requestedPage *gql_generated.PageInput) (*gql_generated.PaginatedImagesResult, error) { | ||
| if r.cveInfo == nil { | ||
| return &gql_generated.PaginatedImagesResult{}, zerr.ErrCVESearchDisabled | ||
| return &gql_generated.PaginatedImagesResult{ | ||
| Page: &gql_generated.PageInfo{}, | ||
| Results: []*gql_generated.ImageSummary{}, | ||
| }, nil |
andaaron
reviewed
May 31, 2026
| return ext | ||
| } | ||
|
|
||
| func buildSearchConfigWithCVEDisabled(enabled bool) *config.ExtensionConfig { |
Contributor
There was a problem hiding this comment.
Suggested change
| func buildSearchConfigWithCVEDisabled(enabled bool) *config.ExtensionConfig { | |
| func buildSearchConfig(enableSearch, enableCVE bool) *config.ExtensionConfig { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes issue #4096
What type of PR is this?
Which issue does this PR fix:
What does this PR do / Why do we need it:
If an issue # is not available please add repro steps and logs showing the issue:
Testing done on this change:
Automation added to e2e:
Will this break upgrades or downgrades?
Does this PR introduce any user-facing change?:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.