Skip to content

feat: allow disabling CVE independently from search#4102

Open
rchincha wants to merge 1 commit into
project-zot:mainfrom
rchincha:feat-disable-cve-keep-ui-search
Open

feat: allow disabling CVE independently from search#4102
rchincha wants to merge 1 commit into
project-zot:mainfrom
rchincha:feat-disable-cve-keep-ui-search

Conversation

@rchincha

Copy link
Copy Markdown
Contributor

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.

@rchincha rchincha added this to the v2.1.18 milestone May 26, 2026
@rchincha
rchincha force-pushed the feat-disable-cve-keep-ui-search branch from e68e23c to 51e403b Compare May 26, 2026 22:14
@rchincha
rchincha requested a review from Copilot May 26, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.enable to 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.

Comment thread pkg/extensions/config/config.go Outdated
Comment thread pkg/extensions/search/schema.resolvers.go
Comment thread pkg/extensions/search/schema.resolvers.go
Comment thread pkg/extensions/search/schema.resolvers.go
Comment thread pkg/extensions/search/schema.resolvers.go
Comment thread pkg/cli/server/extensions_test.go
@rchincha
rchincha force-pushed the feat-disable-cve-keep-ui-search branch from 51e403b to 87a2ba4 Compare May 26, 2026 22:36
@rchincha
rchincha requested a review from Copilot May 26, 2026 22:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pkg/extensions/search/schema.resolvers.go: Language not supported

Comment thread pkg/extensions/config/config.go
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
rchincha force-pushed the feat-disable-cve-keep-ui-search branch from 87a2ba4 to 8abf21c Compare May 26, 2026 22:49
@rchincha
rchincha requested a review from Copilot May 26, 2026 22:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pkg/extensions/search/schema.resolvers.go: Language not supported

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
return ext
}

func buildSearchConfigWithCVEDisabled(enabled bool) *config.ExtensionConfig {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func buildSearchConfigWithCVEDisabled(enabled bool) *config.ExtensionConfig {
func buildSearchConfig(enableSearch, enableCVE bool) *config.ExtensionConfig {

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.

3 participants