diff --git a/.configs/gqlgen.yaml b/.configs/gqlgen.yaml index 63636e8c3..df100891f 100644 --- a/.configs/gqlgen.yaml +++ b/.configs/gqlgen.yaml @@ -75,6 +75,7 @@ autobind: - "github.com/nais/api/internal/usersync" - "github.com/nais/api/internal/utilization" - "github.com/nais/api/internal/vulnerability" + - "github.com/nais/api/internal/v0s" - "github.com/nais/api/internal/workload" - "github.com/nais/api/internal/workload/application" - "github.com/nais/api/internal/workload/job" @@ -144,3 +145,6 @@ models: PageInfo: model: - github.com/nais/api/internal/graph/pagination.PageInfo + fields: + totalCount: + fieldName: Count diff --git a/.mise-tasks/generate/proto b/.mise-tasks/generate/proto index 8c697e376..5f2f49d97 100755 --- a/.mise-tasks/generate/proto +++ b/.mise-tasks/generate/proto @@ -10,4 +10,14 @@ protoc \ --go_out=. \ --go-grpc_out=. +protoc \ + -I internal/v0s/protoapi/schema/ \ + internal/v0s/protoapi/schema/v0s.proto \ + --go_opt='Mv0s.proto=github.com/nais/api/internal/v0s/protoapi;protoapi' \ + --go_opt=module=github.com/nais/api \ + --go_out=. \ + --go-grpc_opt='Mv0s.proto=github.com/nais/api/internal/v0s/protoapi;protoapi' \ + --go-grpc_opt=module=github.com/nais/api \ + --go-grpc_out=. + mise run fmt:go diff --git a/README.md b/README.md index 674bf2b60..53f39bdb7 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,48 @@ Existing clients can keep using configured aliases. The additive allowing newer clients to warn about legacy aliases without duplicating this configuration. Activity log entries use the canonical name. +## v0s migration + +The new `vulnerabilityFindings`, `vulnerabilityFindingSummary`, +`vulnerabilityCoverage`, `vulnerability`, and `vulnerabilitySuppressions` queries +read v0s. Applications and jobs also expose findings, summary and coverage. +Existing v13s queries and mutations keep their existing source and behavior. + +Set `V0S_ENDPOINT` to the plaintext gRPC endpoint allowed by v0s's NetworkPolicy. +The connection is lazy: an unset endpoint or unavailable v0s does not block API +startup, workload inventory, or legacy vulnerability fields. New fields return +errors rather than silently falling back to v13s or reporting zero findings. +Environment names are the same user-facing names used by `Workloads.ListImages`. + +`V0S_SUPPRESSIONS_ENABLED` defaults to false. Keep it false while v13s owns +assessments and synchronizes them into v0s. Enable only after old user writes are +frozen, synchronization has caught up, and the sync worker and its retries have +stopped. The new mutations authorize the whole team's batch and derive the actor +from the authenticated user. Deletions do not require an active finding. +Successful sets and deletions are recorded in the team's activity log. + +New lists are forward-only (`first` from 1 to 200) and use the standard +`edges`, `nodes` and `PageInfo` contract. `totalCount` covers the full filtered +selection and is loaded only when requested; counting suppressions currently +pages through the matching assessments. `pageStart` and `pageEnd` track positions +in the traversal; concurrent updates can change the total. Root finding and suppression queries +take scope inside `filter.scope`; workload fields are already scoped. +Findings, advisories and assessments have global IDs and can be fetched through +`node`. A finding's ID includes its image digest, so an obsolete-image finding +is not returned after the workload changes images. + +Opaque cursors wrap v0s's per-item tokens and are scoped to the operation and +filter. They remain usable when an earlier item disappears, and cannot be used +with the old offset-paginated fields. Deploy v0s with per-item cursor support +before enabling the new API reads. Coverage uses current API inventory; +workloads absent from v0s or still associated with an old image are pending, not +clean. Removed workloads and old-image findings are excluded. + +The pinned v0s protobuf schema is in `internal/v0s/protoapi/schema/v0s.proto`. +`mise run generate:proto` generates the client locally, without depending on the +v0s scanner module or its Go version. Update the pinned schema and regenerate when +the upstream contract changes. + ## Development practices Check practices used in this project here: [docs/practices.md](docs/practices.md) diff --git a/internal/cmd/api/api.go b/internal/cmd/api/api.go index f620be822..06e7c4eb4 100644 --- a/internal/cmd/api/api.go +++ b/internal/cmd/api/api.go @@ -42,6 +42,7 @@ import ( "github.com/nais/api/internal/thirdparty/hookd" fakehookd "github.com/nais/api/internal/thirdparty/hookd/fake" "github.com/nais/api/internal/unleash" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/sethvargo/go-envconfig" "github.com/sirupsen/logrus" @@ -222,6 +223,16 @@ func run(ctx context.Context, cfg *Config, log logrus.FieldLogger) error { } var mgmtK8sClient k8s.Interface + v0sMgr, err := v0s.NewManager(cfg.V0s.Endpoint, cfg.V0s.SuppressionsEnabled) + if err != nil { + return err + } + defer func() { + if err := v0sMgr.Close(); err != nil { + log.WithError(err).Warn("close v0s client") + } + }() + if cfg.Fakes.WithFakeKubernetes || cfg.Fakes.WithFakeManagementKubernetes { mgmtK8sClient = k8sfake.NewSimpleClientset() } else { @@ -339,6 +350,7 @@ func run(ctx context.Context, cfg *Config, log logrus.FieldLogger) error { cfg.Aiven.Projects, cfg.KafkaEnvironments, vulnMgr, + v0sMgr, cfg.Tenant, cfg.K8s.AllClusterNames(), hookdClient, diff --git a/internal/cmd/api/config.go b/internal/cmd/api/config.go index 1e7346107..c66e7f1d9 100644 --- a/internal/cmd/api/config.go +++ b/internal/cmd/api/config.go @@ -196,6 +196,7 @@ type Config struct { Usersync usersyncConfig Cost costConfig VulnerabilitiesAPI vulnerabilitiesConfig + V0s v0sConfig Hookd hookdConfig OAuth oAuthConfig Unleash UnleashConfig @@ -206,6 +207,12 @@ type Config struct { AuditLog auditLogConfig } +type v0sConfig struct { + Endpoint string `env:"V0S_ENDPOINT"` + // Enable only after v13s user writes and suppression synchronization are stopped. + SuppressionsEnabled bool `env:"V0S_SUPPRESSIONS_ENABLED"` +} + type Fakes struct { WithInsecureWebhookURLs bool `env:"WITH_INSECURE_WEBHOOK_URLS"` WithInsecureUserHeader bool `env:"WITH_INSECURE_USER_HEADER"` diff --git a/internal/cmd/api/config_test.go b/internal/cmd/api/config_test.go index 31a0b2d5e..b1054e705 100644 --- a/internal/cmd/api/config_test.go +++ b/internal/cmd/api/config_test.go @@ -35,6 +35,7 @@ func TestKafkaEnvironmentsConfig(t *testing.T) { if (err != nil) != tt.wantErr { t.Fatalf("NewConfig() error = %v, wantErr %v", err, tt.wantErr) } + if tt.wantErr { return } @@ -45,6 +46,18 @@ func TestKafkaEnvironmentsConfig(t *testing.T) { } } +func TestV0sConfigurationIsOptionalAndIndependent(t *testing.T) { + cfg, err := NewConfig(t.Context(), envconfig.MapLookuper(map[string]string{ + "V0S_ENDPOINT": "v0s:8080", "VULNERABILITIES_ENDPOINT": "legacy:8080", + })) + if err != nil { + t.Fatal(err) + } + if cfg.V0s.Endpoint != "v0s:8080" || cfg.V0s.SuppressionsEnabled || cfg.VulnerabilitiesAPI.Endpoint != "legacy:8080" { + t.Fatalf("new reads changed the legacy endpoint or enabled writes: %+v, %+v", cfg.V0s, cfg.VulnerabilitiesAPI) + } +} + func TestInsecureWebhookURLsConfig(t *testing.T) { for _, tt := range []struct { name string diff --git a/internal/cmd/api/http.go b/internal/cmd/api/http.go index 5d8e8e844..8b1e0b84f 100644 --- a/internal/cmd/api/http.go +++ b/internal/cmd/api/http.go @@ -24,7 +24,9 @@ import ( "github.com/nais/api/internal/environment" "github.com/nais/api/internal/feature" "github.com/nais/api/internal/github/repository" + "github.com/nais/api/internal/graph/apierror" "github.com/nais/api/internal/graph/loader" + "github.com/nais/api/internal/grpc/grpcworkload" "github.com/nais/api/internal/issue" apik8s "github.com/nais/api/internal/kubernetes" "github.com/nais/api/internal/kubernetes/crd" @@ -58,6 +60,7 @@ import ( "github.com/nais/api/internal/user" "github.com/nais/api/internal/usersync" "github.com/nais/api/internal/utilization" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" @@ -68,6 +71,7 @@ import ( "github.com/nais/api/internal/workload/podlog" fakepodlog "github.com/nais/api/internal/workload/podlog/fake" "github.com/nais/api/internal/workload/secret" + "github.com/nais/api/pkg/apiclient/protoapi" "github.com/rs/cors" "github.com/sirupsen/logrus" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -215,6 +219,7 @@ func ConfigureGraph( aivenProjects aiven.Projects, kafkaEnvironments kafkatopic.Environments, vulnMgr *vulnerability.Manager, + v0sMgr *v0s.Manager, tenantName string, clusters []string, hookdClient hookd.Client, @@ -401,6 +406,15 @@ func ConfigureGraph( ctx = activitylog.NewLoaderContext(ctx, pool) ctx = event.NewLoaderContext(ctx, pool) ctx = vulnerability.NewLoaderContext(ctx, vulnMgr, log) + ctx = v0s.WithManager(ctx, v0sMgr) + ctx = v0s.NewLoaderContext(ctx, func(ctx context.Context) (*protoapi.ListWorkloadImagesResponse, error) { + for _, env := range watchers.AppWatcher.EnvironmentNames() { + if !watchers.AppWatcher.HasSynced(env) || !watchers.JobWatcher.HasSynced(env) { + return nil, apierror.Errorf("Workload inventory is not ready; vulnerability coverage is unavailable.") + } + } + return grpcworkload.NewServer(watchers.AppWatcher, watchers.JobWatcher).ListImages(ctx, &protoapi.ListWorkloadImagesRequest{}) + }) ctx = servicemaintenance.NewLoaderContext(ctx, serviceMaintenanceManager, log) ctx = reconciler.NewLoaderContext(ctx, pool) ctx = deployment.NewLoaderContext(ctx, pool, hookdClient) diff --git a/internal/graph/gengql/activitylog.generated.go b/internal/graph/gengql/activitylog.generated.go index 5ce17d621..1cf0327e0 100644 --- a/internal/graph/gengql/activitylog.generated.go +++ b/internal/graph/gengql/activitylog.generated.go @@ -28,6 +28,7 @@ import ( "github.com/nais/api/internal/team" "github.com/nais/api/internal/tunnel" "github.com/nais/api/internal/unleash" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" @@ -589,6 +590,13 @@ func (ec *executionContext) _ActivityLogEntry(ctx context.Context, sel ast.Selec return graphql.Null } return ec._VulnerabilityUpdatedActivityLogEntry(ctx, sel, obj) + case v0s.VulnerabilitySuppressionActivityLogEntry: + return ec._VulnerabilitySuppressionActivityLogEntry(ctx, sel, &obj) + case *v0s.VulnerabilitySuppressionActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._VulnerabilitySuppressionActivityLogEntry(ctx, sel, obj) case valkey.ValkeyUpdatedActivityLogEntry: return ec._ValkeyUpdatedActivityLogEntry(ctx, sel, &obj) case *valkey.ValkeyUpdatedActivityLogEntry: diff --git a/internal/graph/gengql/applications.generated.go b/internal/graph/gengql/applications.generated.go index 812f35494..51f413c62 100644 --- a/internal/graph/gengql/applications.generated.go +++ b/internal/graph/gengql/applications.generated.go @@ -33,6 +33,7 @@ import ( "github.com/nais/api/internal/slug" "github.com/nais/api/internal/team" "github.com/nais/api/internal/utilization" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" @@ -74,6 +75,9 @@ type ApplicationResolver interface { ServiceAccount(ctx context.Context, obj *application.Application) (*serviceaccount.ServiceAccount, error) SQLInstances(ctx context.Context, obj *application.Application, orderBy *sqlinstance.SQLInstanceOrder) (*pagination.Connection[*sqlinstance.SQLInstance], error) Utilization(ctx context.Context, obj *application.Application) (*utilization.WorkloadUtilization, error) + VulnerabilityFindings(ctx context.Context, obj *application.Application, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilityFinding], error) + VulnerabilityFindingSummary(ctx context.Context, obj *application.Application, filter *v0s.VulnerabilityFindingFilter) (*v0s.VulnerabilityFindingSummary, error) + VulnerabilityCoverage(ctx context.Context, obj *application.Application) (*v0s.VulnerabilityCoverage, error) Valkeys(ctx context.Context, obj *application.Application, orderBy *valkey.ValkeyOrder) (*pagination.FacetableConnection[*valkey.Valkey, *valkey.ValkeyFilter], error) ImageVulnerabilityHistory(ctx context.Context, obj *application.Application, from scalar.Date) (*vulnerability.ImageVulnerabilityHistory, error) VulnerabilityFixHistory(ctx context.Context, obj *application.Application, from scalar.Date) (*vulnerability.VulnerabilityFixHistory, error) @@ -539,6 +543,50 @@ func (ec *executionContext) field_Application_valkeys_args(ctx context.Context, return args, nil } +func (ec *executionContext) field_Application_vulnerabilityFindingSummary_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + return ec.unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Application_vulnerabilityFindings_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + return ec.unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*pagination.Cursor, error) { + return ec.unmarshalOCursor2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + func (ec *executionContext) field_Application_vulnerabilityFixHistory_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1640,6 +1688,126 @@ func (ec *executionContext) fieldContext_Application_utilization(_ context.Conte return fc, nil } +func (ec *executionContext) _Application_vulnerabilityFindings(ctx context.Context, field graphql.CollectedField, obj *application.Application) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_vulnerabilityFindings(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Application().VulnerabilityFindings(ctx, obj, fc.Args["filter"].(*v0s.VulnerabilityFindingFilter), fc.Args["first"].(*int), fc.Args["after"].(*pagination.Cursor)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *pagination.Connection[*v0s.VulnerabilityFinding]) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Application_vulnerabilityFindings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Application", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Application_vulnerabilityFindings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Application_vulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField, obj *application.Application) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_vulnerabilityFindingSummary(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Application().VulnerabilityFindingSummary(ctx, obj, fc.Args["filter"].(*v0s.VulnerabilityFindingFilter)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityFindingSummary) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingSummary2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingSummary(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Application_vulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Application", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingSummary(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Application_vulnerabilityFindingSummary_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Application_vulnerabilityCoverage(ctx context.Context, field graphql.CollectedField, obj *application.Application) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Application_vulnerabilityCoverage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Application().VulnerabilityCoverage(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityCoverage) graphql.Marshaler { + return ec.marshalNVulnerabilityCoverage2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverage(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Application_vulnerabilityCoverage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Application", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityCoverage(ctx, field) + }, + } + return fc, nil +} + func (ec *executionContext) _Application_valkeys(ctx context.Context, field graphql.CollectedField, obj *application.Application) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -5881,6 +6049,114 @@ func (ec *executionContext) _Application(ctx context.Context, sel ast.SelectionS continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "vulnerabilityFindings": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_vulnerabilityFindings(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "vulnerabilityFindingSummary": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_vulnerabilityFindingSummary(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "vulnerabilityCoverage": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Application_vulnerabilityCoverage(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "valkeys": field := field diff --git a/internal/graph/gengql/jobs.generated.go b/internal/graph/gengql/jobs.generated.go index cf1fe4018..ad2502f53 100644 --- a/internal/graph/gengql/jobs.generated.go +++ b/internal/graph/gengql/jobs.generated.go @@ -32,6 +32,7 @@ import ( "github.com/nais/api/internal/serviceaccount" "github.com/nais/api/internal/slug" "github.com/nais/api/internal/team" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/config" @@ -75,6 +76,9 @@ type JobResolver interface { Secrets(ctx context.Context, obj *job.Job, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) (*pagination.FacetableConnection[*secret.Secret, *secret.SecretFilter], error) ServiceAccount(ctx context.Context, obj *job.Job) (*serviceaccount.ServiceAccount, error) SQLInstances(ctx context.Context, obj *job.Job, orderBy *sqlinstance.SQLInstanceOrder) (*pagination.Connection[*sqlinstance.SQLInstance], error) + VulnerabilityFindings(ctx context.Context, obj *job.Job, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilityFinding], error) + VulnerabilityFindingSummary(ctx context.Context, obj *job.Job, filter *v0s.VulnerabilityFindingFilter) (*v0s.VulnerabilityFindingSummary, error) + VulnerabilityCoverage(ctx context.Context, obj *job.Job) (*v0s.VulnerabilityCoverage, error) Valkeys(ctx context.Context, obj *job.Job, orderBy *valkey.ValkeyOrder) (*pagination.FacetableConnection[*valkey.Valkey, *valkey.ValkeyFilter], error) ImageVulnerabilityHistory(ctx context.Context, obj *job.Job, from scalar.Date) (*vulnerability.ImageVulnerabilityHistory, error) VulnerabilityFixHistory(ctx context.Context, obj *job.Job, from scalar.Date) (*vulnerability.VulnerabilityFixHistory, error) @@ -556,6 +560,50 @@ func (ec *executionContext) field_Job_valkeys_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Job_vulnerabilityFindingSummary_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + return ec.unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Job_vulnerabilityFindings_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + return ec.unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*pagination.Cursor, error) { + return ec.unmarshalOCursor2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + func (ec *executionContext) field_Job_vulnerabilityFixHistory_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1671,6 +1719,126 @@ func (ec *executionContext) fieldContext_Job_sqlInstances(ctx context.Context, f return fc, nil } +func (ec *executionContext) _Job_vulnerabilityFindings(ctx context.Context, field graphql.CollectedField, obj *job.Job) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Job_vulnerabilityFindings(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Job().VulnerabilityFindings(ctx, obj, fc.Args["filter"].(*v0s.VulnerabilityFindingFilter), fc.Args["first"].(*int), fc.Args["after"].(*pagination.Cursor)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *pagination.Connection[*v0s.VulnerabilityFinding]) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Job_vulnerabilityFindings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Job", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Job_vulnerabilityFindings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Job_vulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField, obj *job.Job) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Job_vulnerabilityFindingSummary(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Job().VulnerabilityFindingSummary(ctx, obj, fc.Args["filter"].(*v0s.VulnerabilityFindingFilter)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityFindingSummary) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingSummary2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingSummary(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Job_vulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Job", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingSummary(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Job_vulnerabilityFindingSummary_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Job_vulnerabilityCoverage(ctx context.Context, field graphql.CollectedField, obj *job.Job) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Job_vulnerabilityCoverage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Job().VulnerabilityCoverage(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityCoverage) graphql.Marshaler { + return ec.marshalNVulnerabilityCoverage2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverage(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Job_vulnerabilityCoverage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Job", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityCoverage(ctx, field) + }, + } + return fc, nil +} + func (ec *executionContext) _Job_valkeys(ctx context.Context, field graphql.CollectedField, obj *job.Job) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -5969,6 +6137,114 @@ func (ec *executionContext) _Job(ctx context.Context, sel ast.SelectionSet, obj continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "vulnerabilityFindings": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Job_vulnerabilityFindings(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "vulnerabilityFindingSummary": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Job_vulnerabilityFindingSummary(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "vulnerabilityCoverage": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Job_vulnerabilityCoverage(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "valkeys": field := field diff --git a/internal/graph/gengql/root_.generated.go b/internal/graph/gengql/root_.generated.go index 79d80dabb..b621eacbe 100644 --- a/internal/graph/gengql/root_.generated.go +++ b/internal/graph/gengql/root_.generated.go @@ -41,6 +41,7 @@ import ( "github.com/nais/api/internal/unleash" "github.com/nais/api/internal/user" "github.com/nais/api/internal/utilization" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" @@ -156,6 +157,7 @@ type ResolverRoot interface { ValkeyConnection() ValkeyConnectionResolver ValkeyIssue() ValkeyIssueResolver ValkeyMaintenance() ValkeyMaintenanceResolver + VulnerabilityFinding() VulnerabilityFindingResolver VulnerableImageIssue() VulnerableImageIssueResolver WebhookSubscription() WebhookSubscriptionResolver WorkloadCost() WorkloadCostResolver @@ -247,41 +249,44 @@ type ComplexityRoot struct { } Application struct { - ActivityLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *activitylog.ActivityLogFilter) int - AuthIntegrations func(childComplexity int) int - BigQueryDatasets func(childComplexity int, orderBy *bigquery.BigQueryDatasetOrder) int - Buckets func(childComplexity int, orderBy *bucket.BucketOrder) int - Configs func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Cost func(childComplexity int) int - DeletionStartedAt func(childComplexity int) int - Deployments func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Events func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *event.WorkloadEventFilter) int - History func(childComplexity int) int - ID func(childComplexity int) int - Image func(childComplexity int) int - ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int - Ingresses func(childComplexity int) int - InstanceGroups func(childComplexity int) int - Instances func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Issues func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *issue.IssueOrder, filter *issue.ResourceIssueFilter) int - KafkaTopicAcls func(childComplexity int, orderBy *kafkatopic.KafkaTopicACLOrder) int - Labels func(childComplexity int) int - LogDestinations func(childComplexity int) int - Manifest func(childComplexity int) int - Name func(childComplexity int) int - NetworkPolicy func(childComplexity int) int - OpenSearch func(childComplexity int) int - Postgreses func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Resources func(childComplexity int) int - SQLInstances func(childComplexity int, orderBy *sqlinstance.SQLInstanceOrder) int - Secrets func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - ServiceAccount func(childComplexity int) int - State func(childComplexity int) int - Team func(childComplexity int) int - TeamEnvironment func(childComplexity int) int - Utilization func(childComplexity int) int - Valkeys func(childComplexity int, orderBy *valkey.ValkeyOrder) int - VulnerabilityFixHistory func(childComplexity int, from scalar.Date) int + ActivityLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *activitylog.ActivityLogFilter) int + AuthIntegrations func(childComplexity int) int + BigQueryDatasets func(childComplexity int, orderBy *bigquery.BigQueryDatasetOrder) int + Buckets func(childComplexity int, orderBy *bucket.BucketOrder) int + Configs func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Cost func(childComplexity int) int + DeletionStartedAt func(childComplexity int) int + Deployments func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Events func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *event.WorkloadEventFilter) int + History func(childComplexity int) int + ID func(childComplexity int) int + Image func(childComplexity int) int + ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int + Ingresses func(childComplexity int) int + InstanceGroups func(childComplexity int) int + Instances func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Issues func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *issue.IssueOrder, filter *issue.ResourceIssueFilter) int + KafkaTopicAcls func(childComplexity int, orderBy *kafkatopic.KafkaTopicACLOrder) int + Labels func(childComplexity int) int + LogDestinations func(childComplexity int) int + Manifest func(childComplexity int) int + Name func(childComplexity int) int + NetworkPolicy func(childComplexity int) int + OpenSearch func(childComplexity int) int + Postgreses func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Resources func(childComplexity int) int + SQLInstances func(childComplexity int, orderBy *sqlinstance.SQLInstanceOrder) int + Secrets func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + ServiceAccount func(childComplexity int) int + State func(childComplexity int) int + Team func(childComplexity int) int + TeamEnvironment func(childComplexity int) int + Utilization func(childComplexity int) int + Valkeys func(childComplexity int, orderBy *valkey.ValkeyOrder) int + VulnerabilityCoverage func(childComplexity int) int + VulnerabilityFindingSummary func(childComplexity int, filter *v0s.VulnerabilityFindingFilter) int + VulnerabilityFindings func(childComplexity int, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) int + VulnerabilityFixHistory func(childComplexity int, from scalar.Date) int } ApplicationConnection struct { @@ -882,6 +887,10 @@ type ComplexityRoot struct { ValkeyDeleted func(childComplexity int) int } + DeleteVulnerabilitySuppressionsPayload struct { + Deleted func(childComplexity int) int + } + DeleteWebhookPayload struct { WebhookID func(childComplexity int) int } @@ -1287,38 +1296,41 @@ type ComplexityRoot struct { } Job struct { - ActivityLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *activitylog.ActivityLogFilter) int - AuthIntegrations func(childComplexity int) int - BigQueryDatasets func(childComplexity int, orderBy *bigquery.BigQueryDatasetOrder) int - Buckets func(childComplexity int, orderBy *bucket.BucketOrder) int - Configs func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Cost func(childComplexity int) int - DeletionStartedAt func(childComplexity int) int - Deployments func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Events func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *event.WorkloadEventFilter) int - ID func(childComplexity int) int - Image func(childComplexity int) int - ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int - Issues func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *issue.IssueOrder, filter *issue.ResourceIssueFilter) int - KafkaTopicAcls func(childComplexity int, orderBy *kafkatopic.KafkaTopicACLOrder) int - Labels func(childComplexity int) int - LogDestinations func(childComplexity int) int - Manifest func(childComplexity int) int - Name func(childComplexity int) int - NetworkPolicy func(childComplexity int) int - OpenSearch func(childComplexity int) int - Postgreses func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Resources func(childComplexity int) int - Runs func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - SQLInstances func(childComplexity int, orderBy *sqlinstance.SQLInstanceOrder) int - Schedule func(childComplexity int) int - Secrets func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - ServiceAccount func(childComplexity int) int - State func(childComplexity int) int - Team func(childComplexity int) int - TeamEnvironment func(childComplexity int) int - Valkeys func(childComplexity int, orderBy *valkey.ValkeyOrder) int - VulnerabilityFixHistory func(childComplexity int, from scalar.Date) int + ActivityLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *activitylog.ActivityLogFilter) int + AuthIntegrations func(childComplexity int) int + BigQueryDatasets func(childComplexity int, orderBy *bigquery.BigQueryDatasetOrder) int + Buckets func(childComplexity int, orderBy *bucket.BucketOrder) int + Configs func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Cost func(childComplexity int) int + DeletionStartedAt func(childComplexity int) int + Deployments func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Events func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *event.WorkloadEventFilter) int + ID func(childComplexity int) int + Image func(childComplexity int) int + ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int + Issues func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *issue.IssueOrder, filter *issue.ResourceIssueFilter) int + KafkaTopicAcls func(childComplexity int, orderBy *kafkatopic.KafkaTopicACLOrder) int + Labels func(childComplexity int) int + LogDestinations func(childComplexity int) int + Manifest func(childComplexity int) int + Name func(childComplexity int) int + NetworkPolicy func(childComplexity int) int + OpenSearch func(childComplexity int) int + Postgreses func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Resources func(childComplexity int) int + Runs func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + SQLInstances func(childComplexity int, orderBy *sqlinstance.SQLInstanceOrder) int + Schedule func(childComplexity int) int + Secrets func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + ServiceAccount func(childComplexity int) int + State func(childComplexity int) int + Team func(childComplexity int) int + TeamEnvironment func(childComplexity int) int + Valkeys func(childComplexity int, orderBy *valkey.ValkeyOrder) int + VulnerabilityCoverage func(childComplexity int) int + VulnerabilityFindingSummary func(childComplexity int, filter *v0s.VulnerabilityFindingFilter) int + VulnerabilityFindings func(childComplexity int, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) int + VulnerabilityFixHistory func(childComplexity int, from scalar.Date) int } JobConnection struct { @@ -1722,6 +1734,7 @@ type ComplexityRoot struct { DeleteTunnel func(childComplexity int, input tunnel.DeleteTunnelInput) int DeleteUnleashInstance func(childComplexity int, input unleash.DeleteUnleashInstanceInput) int DeleteValkey func(childComplexity int, input valkey.DeleteValkeyInput) int + DeleteVulnerabilitySuppressions func(childComplexity int, input v0s.DeleteVulnerabilitySuppressionsInput) int DeleteWebhook func(childComplexity int, input webhook.DeleteWebhookInput) int DisableReconciler func(childComplexity int, input reconciler.DisableReconcilerInput) int EnableReconciler func(childComplexity int, input reconciler.EnableReconcilerInput) int @@ -1735,6 +1748,7 @@ type ComplexityRoot struct { RevokeRoleFromServiceAccount func(childComplexity int, input serviceaccount.RevokeRoleFromServiceAccountInput) int RevokeTeamAccessToUnleash func(childComplexity int, input unleash.RevokeTeamAccessToUnleashInput) int SetTeamMemberRole func(childComplexity int, input team.SetTeamMemberRoleInput) int + SetVulnerabilitySuppressions func(childComplexity int, input v0s.SetVulnerabilitySuppressionsInput) int StartOpenSearchMaintenance func(childComplexity int, input servicemaintenance.StartOpenSearchMaintenanceInput) int StartValkeyMaintenance func(childComplexity int, input servicemaintenance.StartValkeyMaintenanceInput) int TestWebhook func(childComplexity int, input webhook.TestWebhookInput) int @@ -1963,13 +1977,13 @@ type ComplexityRoot struct { } PageInfo struct { + Count func(childComplexity int) int EndCursor func(childComplexity int) int HasNextPage func(childComplexity int) int HasPreviousPage func(childComplexity int) int PageEnd func(childComplexity int) int PageStart func(childComplexity int) int StartCursor func(childComplexity int) int - TotalCount func(childComplexity int) int } Postgres struct { @@ -2212,36 +2226,41 @@ type ComplexityRoot struct { } Query struct { - ActivityLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *activitylog.TenantActivityLogFilter) int - CVE func(childComplexity int, identifier string) int - CostMonthlySummary func(childComplexity int, from scalar.Date, to scalar.Date) int - CurrentUnitPrices func(childComplexity int) int - Cves func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *vulnerability.CVEOrder, filter *vulnerability.CVEFilter) int - Deployments func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *deployment.DeploymentOrder, filter *deployment.DeploymentFilter) int - Environment func(childComplexity int, name string) int - Environments func(childComplexity int, orderBy *environment.EnvironmentOrder) int - Features func(childComplexity int) int - GlobalWebhooks func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int - Issues func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *issue.IssueOrder, filter *issue.TenantIssueFilter) int - Me func(childComplexity int) int - Node func(childComplexity int, id ident.Ident) int - Reconcilers func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Roles func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *authz.RoleFilter) int - Search func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter search.SearchFilter) int - ServiceAccount func(childComplexity int, id ident.Ident) int - ServiceAccounts func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Team func(childComplexity int, slug slug.Slug) int - Teams func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *team.TeamOrder, filter *team.TeamFilter) int - TeamsUtilization func(childComplexity int, resourceType utilization.UtilizationResourceType) int - UnleashReleaseChannels func(childComplexity int) int - User func(childComplexity int, email *string) int - UserSyncLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int - Users func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *user.UserOrder) int - VulnerabilityFixHistory func(childComplexity int, from scalar.Date) int - VulnerabilitySummaries func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *vulnerability.TenantVulnerabilitySummaryFilter, orderBy *vulnerability.VulnerabilitySummaryOrder) int - VulnerabilitySummary func(childComplexity int, filter *vulnerability.TenantVulnerabilitySummaryFilter) int - WebhookEventTypes func(childComplexity int) int + ActivityLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *activitylog.TenantActivityLogFilter) int + CVE func(childComplexity int, identifier string) int + CostMonthlySummary func(childComplexity int, from scalar.Date, to scalar.Date) int + CurrentUnitPrices func(childComplexity int) int + Cves func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *vulnerability.CVEOrder, filter *vulnerability.CVEFilter) int + Deployments func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *deployment.DeploymentOrder, filter *deployment.DeploymentFilter) int + Environment func(childComplexity int, name string) int + Environments func(childComplexity int, orderBy *environment.EnvironmentOrder) int + Features func(childComplexity int) int + GlobalWebhooks func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + ImageVulnerabilityHistory func(childComplexity int, from scalar.Date) int + Issues func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *issue.IssueOrder, filter *issue.TenantIssueFilter) int + Me func(childComplexity int) int + Node func(childComplexity int, id ident.Ident) int + Reconcilers func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Roles func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *authz.RoleFilter) int + Search func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter search.SearchFilter) int + ServiceAccount func(childComplexity int, id ident.Ident) int + ServiceAccounts func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Team func(childComplexity int, slug slug.Slug) int + Teams func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *team.TeamOrder, filter *team.TeamFilter) int + TeamsUtilization func(childComplexity int, resourceType utilization.UtilizationResourceType) int + UnleashReleaseChannels func(childComplexity int) int + User func(childComplexity int, email *string) int + UserSyncLog func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) int + Users func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, orderBy *user.UserOrder) int + Vulnerability func(childComplexity int, identifier string) int + VulnerabilityCoverage func(childComplexity int, scope *v0s.VulnerabilityScopeInput) int + VulnerabilityFindingSummary func(childComplexity int, filter *v0s.VulnerabilityFindingFilter) int + VulnerabilityFindings func(childComplexity int, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) int + VulnerabilityFixHistory func(childComplexity int, from scalar.Date) int + VulnerabilitySummaries func(childComplexity int, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *vulnerability.TenantVulnerabilitySummaryFilter, orderBy *vulnerability.VulnerabilitySummaryOrder) int + VulnerabilitySummary func(childComplexity int, filter *vulnerability.TenantVulnerabilitySummaryFilter) int + VulnerabilitySuppressions func(childComplexity int, filter *v0s.VulnerabilitySuppressionFilter, first *int, after *pagination.Cursor) int + WebhookEventTypes func(childComplexity int) int } Reconciler struct { @@ -2901,6 +2920,10 @@ type ComplexityRoot struct { Member func(childComplexity int) int } + SetVulnerabilitySuppressionsPayload struct { + Suppressions func(childComplexity int) int + } + SqlDatabase struct { Charset func(childComplexity int) int Collation func(childComplexity int) int @@ -3968,6 +3991,18 @@ type ComplexityRoot struct { Values func(childComplexity int) int } + Vulnerability struct { + Aliases func(childComplexity int) int + Cvss func(childComplexity int) int + Description func(childComplexity int) int + Epss func(childComplexity int) int + ID func(childComplexity int) int + Identifier func(childComplexity int) int + KnownExploited func(childComplexity int) int + References func(childComplexity int) int + Title func(childComplexity int) int + } + VulnerabilityActivityLogEntryData struct { Identifier func(childComplexity int) int NewSuppression func(childComplexity int) int @@ -3976,6 +4011,71 @@ type ComplexityRoot struct { Severity func(childComplexity int) int } + VulnerabilityCoverage struct { + Error func(childComplexity int) int + ImageDigest func(childComplexity int) int + ImageName func(childComplexity int) int + ScannedAt func(childComplexity int) int + Status func(childComplexity int) int + } + + VulnerabilityCoverageCounts struct { + Failed func(childComplexity int) int + NoSbom func(childComplexity int) int + Pending func(childComplexity int) int + Scanned func(childComplexity int) int + TotalWorkloads func(childComplexity int) int + UnresolvedImage func(childComplexity int) int + } + + VulnerabilityCvss struct { + Score func(childComplexity int) int + Source func(childComplexity int) int + Vector func(childComplexity int) int + Version func(childComplexity int) int + } + + VulnerabilityEpss struct { + Date func(childComplexity int) int + Score func(childComplexity int) int + } + + VulnerabilityFinding struct { + DataSource func(childComplexity int) int + Epss func(childComplexity int) int + FixedVersion func(childComplexity int) int + ID func(childComplexity int) int + Image func(childComplexity int) int + InstalledVersion func(childComplexity int) int + KnownExploited func(childComplexity int) int + PackageKey func(childComplexity int) int + Purl func(childComplexity int) int + Severity func(childComplexity int) int + SeveritySource func(childComplexity int) int + Suppression func(childComplexity int) int + Vulnerability func(childComplexity int) int + VulnerabilityIdentifier func(childComplexity int) int + Workload func(childComplexity int) int + } + + VulnerabilityFindingConnection struct { + Edges func(childComplexity int) int + Nodes func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + VulnerabilityFindingEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + + VulnerabilityFindingSummary struct { + CountsBySeverity func(childComplexity int) int + FixableFindings func(childComplexity int) int + KnownExploitedFindings func(childComplexity int) int + TotalFindings func(childComplexity int) int + } + VulnerabilityFixHistory struct { Samples func(childComplexity int) int } @@ -3990,6 +4090,11 @@ type ComplexityRoot struct { TotalWorkloads func(childComplexity int) int } + VulnerabilityImage struct { + Digest func(childComplexity int) int + Name func(childComplexity int) int + } + VulnerabilityRemediation struct { FixVersion func(childComplexity int) int LatestVersion func(childComplexity int) int @@ -4004,6 +4109,56 @@ type ComplexityRoot struct { Priority func(childComplexity int) int } + VulnerabilitySeverityCounts struct { + Critical func(childComplexity int) int + High func(childComplexity int) int + Low func(childComplexity int) int + Medium func(childComplexity int) int + Unknown func(childComplexity int) int + } + + VulnerabilitySuppression struct { + Environment func(childComplexity int) int + ID func(childComplexity int) int + ImageName func(childComplexity int) int + PackageKey func(childComplexity int) int + Reason func(childComplexity int) int + State func(childComplexity int) int + Team func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int + VulnerabilityIdentifier func(childComplexity int) int + Workload func(childComplexity int) int + } + + VulnerabilitySuppressionActivityLogEntry struct { + Actor func(childComplexity int) int + CreatedAt func(childComplexity int) int + Data func(childComplexity int) int + EnvironmentName func(childComplexity int) int + GitHubActorClaims func(childComplexity int) int + ID func(childComplexity int) int + Message func(childComplexity int) int + ResourceName func(childComplexity int) int + ResourceType func(childComplexity int) int + TeamSlug func(childComplexity int) int + } + + VulnerabilitySuppressionActivityLogEntryData struct { + Assessment func(childComplexity int) int + } + + VulnerabilitySuppressionConnection struct { + Edges func(childComplexity int) int + Nodes func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + VulnerabilitySuppressionEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + VulnerabilityUpdatedActivityLogEntry struct { Actor func(childComplexity int) int CreatedAt func(childComplexity int) int @@ -4017,6 +4172,12 @@ type ComplexityRoot struct { TeamSlug func(childComplexity int) int } + VulnerabilityWorkloadRef struct { + Environment func(childComplexity int) int + Name func(childComplexity int) int + Team func(childComplexity int) int + } + VulnerableImageIssue struct { Critical func(childComplexity int) int ID func(childComplexity int) int @@ -4857,6 +5018,37 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Application.Valkeys(childComplexity, args["orderBy"].(*valkey.ValkeyOrder)), true + case "Application.vulnerabilityCoverage": + if e.ComplexityRoot.Application.VulnerabilityCoverage == nil { + break + } + + return e.ComplexityRoot.Application.VulnerabilityCoverage(childComplexity), true + + case "Application.vulnerabilityFindingSummary": + if e.ComplexityRoot.Application.VulnerabilityFindingSummary == nil { + break + } + + args, err := ec.field_Application_vulnerabilityFindingSummary_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Application.VulnerabilityFindingSummary(childComplexity, args["filter"].(*v0s.VulnerabilityFindingFilter)), true + + case "Application.vulnerabilityFindings": + if e.ComplexityRoot.Application.VulnerabilityFindings == nil { + break + } + + args, err := ec.field_Application_vulnerabilityFindings_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Application.VulnerabilityFindings(childComplexity, args["filter"].(*v0s.VulnerabilityFindingFilter), args["first"].(*int), args["after"].(*pagination.Cursor)), true + case "Application.vulnerabilityFixHistory": if e.ComplexityRoot.Application.VulnerabilityFixHistory == nil { break @@ -7131,6 +7323,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.DeleteValkeyPayload.ValkeyDeleted(childComplexity), true + case "DeleteVulnerabilitySuppressionsPayload.deleted": + if e.ComplexityRoot.DeleteVulnerabilitySuppressionsPayload.Deleted == nil { + break + } + + return e.ComplexityRoot.DeleteVulnerabilitySuppressionsPayload.Deleted(childComplexity), true + case "DeleteWebhookPayload.webhookID": if e.ComplexityRoot.DeleteWebhookPayload.WebhookID == nil { break @@ -9090,6 +9289,37 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Job.Valkeys(childComplexity, args["orderBy"].(*valkey.ValkeyOrder)), true + case "Job.vulnerabilityCoverage": + if e.ComplexityRoot.Job.VulnerabilityCoverage == nil { + break + } + + return e.ComplexityRoot.Job.VulnerabilityCoverage(childComplexity), true + + case "Job.vulnerabilityFindingSummary": + if e.ComplexityRoot.Job.VulnerabilityFindingSummary == nil { + break + } + + args, err := ec.field_Job_vulnerabilityFindingSummary_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Job.VulnerabilityFindingSummary(childComplexity, args["filter"].(*v0s.VulnerabilityFindingFilter)), true + + case "Job.vulnerabilityFindings": + if e.ComplexityRoot.Job.VulnerabilityFindings == nil { + break + } + + args, err := ec.field_Job_vulnerabilityFindings_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Job.VulnerabilityFindings(childComplexity, args["filter"].(*v0s.VulnerabilityFindingFilter), args["first"].(*int), args["after"].(*pagination.Cursor)), true + case "Job.vulnerabilityFixHistory": if e.ComplexityRoot.Job.VulnerabilityFixHistory == nil { break @@ -11005,6 +11235,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Mutation.DeleteValkey(childComplexity, args["input"].(valkey.DeleteValkeyInput)), true + case "Mutation.deleteVulnerabilitySuppressions": + if e.ComplexityRoot.Mutation.DeleteVulnerabilitySuppressions == nil { + break + } + + args, err := ec.field_Mutation_deleteVulnerabilitySuppressions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.DeleteVulnerabilitySuppressions(childComplexity, args["input"].(v0s.DeleteVulnerabilitySuppressionsInput)), true + case "Mutation.deleteWebhook": if e.ComplexityRoot.Mutation.DeleteWebhook == nil { break @@ -11161,6 +11403,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Mutation.SetTeamMemberRole(childComplexity, args["input"].(team.SetTeamMemberRoleInput)), true + case "Mutation.setVulnerabilitySuppressions": + if e.ComplexityRoot.Mutation.SetVulnerabilitySuppressions == nil { + break + } + + args, err := ec.field_Mutation_setVulnerabilitySuppressions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.SetVulnerabilitySuppressions(childComplexity, args["input"].(v0s.SetVulnerabilitySuppressionsInput)), true + case "Mutation.startOpenSearchMaintenance": if e.ComplexityRoot.Mutation.StartOpenSearchMaintenance == nil { break @@ -12299,6 +12553,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.OutboundNetworkPolicy.Rules(childComplexity), true + case "PageInfo.totalCount": + if e.ComplexityRoot.PageInfo.Count == nil { + break + } + + return e.ComplexityRoot.PageInfo.Count(childComplexity), true + case "PageInfo.endCursor": if e.ComplexityRoot.PageInfo.EndCursor == nil { break @@ -12341,13 +12602,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.PageInfo.StartCursor(childComplexity), true - case "PageInfo.totalCount": - if e.ComplexityRoot.PageInfo.TotalCount == nil { - break - } - - return e.ComplexityRoot.PageInfo.TotalCount(childComplexity), true - case "Postgres.activityLog": if e.ComplexityRoot.Postgres.ActivityLog == nil { break @@ -13724,6 +13978,54 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Query.Users(childComplexity, args["first"].(*int), args["after"].(*pagination.Cursor), args["last"].(*int), args["before"].(*pagination.Cursor), args["orderBy"].(*user.UserOrder)), true + case "Query.vulnerability": + if e.ComplexityRoot.Query.Vulnerability == nil { + break + } + + args, err := ec.field_Query_vulnerability_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.Vulnerability(childComplexity, args["identifier"].(string)), true + + case "Query.vulnerabilityCoverage": + if e.ComplexityRoot.Query.VulnerabilityCoverage == nil { + break + } + + args, err := ec.field_Query_vulnerabilityCoverage_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.VulnerabilityCoverage(childComplexity, args["scope"].(*v0s.VulnerabilityScopeInput)), true + + case "Query.vulnerabilityFindingSummary": + if e.ComplexityRoot.Query.VulnerabilityFindingSummary == nil { + break + } + + args, err := ec.field_Query_vulnerabilityFindingSummary_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.VulnerabilityFindingSummary(childComplexity, args["filter"].(*v0s.VulnerabilityFindingFilter)), true + + case "Query.vulnerabilityFindings": + if e.ComplexityRoot.Query.VulnerabilityFindings == nil { + break + } + + args, err := ec.field_Query_vulnerabilityFindings_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.VulnerabilityFindings(childComplexity, args["filter"].(*v0s.VulnerabilityFindingFilter), args["first"].(*int), args["after"].(*pagination.Cursor)), true + case "Query.vulnerabilityFixHistory": if e.ComplexityRoot.Query.VulnerabilityFixHistory == nil { break @@ -13760,6 +14062,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Query.VulnerabilitySummary(childComplexity, args["filter"].(*vulnerability.TenantVulnerabilitySummaryFilter)), true + case "Query.vulnerabilitySuppressions": + if e.ComplexityRoot.Query.VulnerabilitySuppressions == nil { + break + } + + args, err := ec.field_Query_vulnerabilitySuppressions_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.VulnerabilitySuppressions(childComplexity, args["filter"].(*v0s.VulnerabilitySuppressionFilter), args["first"].(*int), args["after"].(*pagination.Cursor)), true + case "Query.webhookEventTypes": if e.ComplexityRoot.Query.WebhookEventTypes == nil { break @@ -16631,6 +16945,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.SetTeamMemberRolePayload.Member(childComplexity), true + case "SetVulnerabilitySuppressionsPayload.suppressions": + if e.ComplexityRoot.SetVulnerabilitySuppressionsPayload.Suppressions == nil { + break + } + + return e.ComplexityRoot.SetVulnerabilitySuppressionsPayload.Suppressions(childComplexity), true + case "SqlDatabase.charset": if e.ComplexityRoot.SqlDatabase.Charset == nil { break @@ -21314,6 +21635,69 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ViewSecretValuesPayload.Values(childComplexity), true + case "Vulnerability.aliases": + if e.ComplexityRoot.Vulnerability.Aliases == nil { + break + } + + return e.ComplexityRoot.Vulnerability.Aliases(childComplexity), true + + case "Vulnerability.cvss": + if e.ComplexityRoot.Vulnerability.Cvss == nil { + break + } + + return e.ComplexityRoot.Vulnerability.Cvss(childComplexity), true + + case "Vulnerability.description": + if e.ComplexityRoot.Vulnerability.Description == nil { + break + } + + return e.ComplexityRoot.Vulnerability.Description(childComplexity), true + + case "Vulnerability.epss": + if e.ComplexityRoot.Vulnerability.Epss == nil { + break + } + + return e.ComplexityRoot.Vulnerability.Epss(childComplexity), true + + case "Vulnerability.id": + if e.ComplexityRoot.Vulnerability.ID == nil { + break + } + + return e.ComplexityRoot.Vulnerability.ID(childComplexity), true + + case "Vulnerability.identifier": + if e.ComplexityRoot.Vulnerability.Identifier == nil { + break + } + + return e.ComplexityRoot.Vulnerability.Identifier(childComplexity), true + + case "Vulnerability.knownExploited": + if e.ComplexityRoot.Vulnerability.KnownExploited == nil { + break + } + + return e.ComplexityRoot.Vulnerability.KnownExploited(childComplexity), true + + case "Vulnerability.references": + if e.ComplexityRoot.Vulnerability.References == nil { + break + } + + return e.ComplexityRoot.Vulnerability.References(childComplexity), true + + case "Vulnerability.title": + if e.ComplexityRoot.Vulnerability.Title == nil { + break + } + + return e.ComplexityRoot.Vulnerability.Title(childComplexity), true + case "VulnerabilityActivityLogEntryData.identifier": if e.ComplexityRoot.VulnerabilityActivityLogEntryData.Identifier == nil { break @@ -21349,6 +21733,293 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.VulnerabilityActivityLogEntryData.Severity(childComplexity), true + case "VulnerabilityCoverage.error": + if e.ComplexityRoot.VulnerabilityCoverage.Error == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverage.Error(childComplexity), true + + case "VulnerabilityCoverage.imageDigest": + if e.ComplexityRoot.VulnerabilityCoverage.ImageDigest == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverage.ImageDigest(childComplexity), true + + case "VulnerabilityCoverage.imageName": + if e.ComplexityRoot.VulnerabilityCoverage.ImageName == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverage.ImageName(childComplexity), true + + case "VulnerabilityCoverage.scannedAt": + if e.ComplexityRoot.VulnerabilityCoverage.ScannedAt == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverage.ScannedAt(childComplexity), true + + case "VulnerabilityCoverage.status": + if e.ComplexityRoot.VulnerabilityCoverage.Status == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverage.Status(childComplexity), true + + case "VulnerabilityCoverageCounts.failed": + if e.ComplexityRoot.VulnerabilityCoverageCounts.Failed == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverageCounts.Failed(childComplexity), true + + case "VulnerabilityCoverageCounts.noSbom": + if e.ComplexityRoot.VulnerabilityCoverageCounts.NoSbom == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverageCounts.NoSbom(childComplexity), true + + case "VulnerabilityCoverageCounts.pending": + if e.ComplexityRoot.VulnerabilityCoverageCounts.Pending == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverageCounts.Pending(childComplexity), true + + case "VulnerabilityCoverageCounts.scanned": + if e.ComplexityRoot.VulnerabilityCoverageCounts.Scanned == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverageCounts.Scanned(childComplexity), true + + case "VulnerabilityCoverageCounts.totalWorkloads": + if e.ComplexityRoot.VulnerabilityCoverageCounts.TotalWorkloads == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverageCounts.TotalWorkloads(childComplexity), true + + case "VulnerabilityCoverageCounts.unresolvedImage": + if e.ComplexityRoot.VulnerabilityCoverageCounts.UnresolvedImage == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCoverageCounts.UnresolvedImage(childComplexity), true + + case "VulnerabilityCvss.score": + if e.ComplexityRoot.VulnerabilityCvss.Score == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCvss.Score(childComplexity), true + + case "VulnerabilityCvss.source": + if e.ComplexityRoot.VulnerabilityCvss.Source == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCvss.Source(childComplexity), true + + case "VulnerabilityCvss.vector": + if e.ComplexityRoot.VulnerabilityCvss.Vector == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCvss.Vector(childComplexity), true + + case "VulnerabilityCvss.version": + if e.ComplexityRoot.VulnerabilityCvss.Version == nil { + break + } + + return e.ComplexityRoot.VulnerabilityCvss.Version(childComplexity), true + + case "VulnerabilityEpss.date": + if e.ComplexityRoot.VulnerabilityEpss.Date == nil { + break + } + + return e.ComplexityRoot.VulnerabilityEpss.Date(childComplexity), true + + case "VulnerabilityEpss.score": + if e.ComplexityRoot.VulnerabilityEpss.Score == nil { + break + } + + return e.ComplexityRoot.VulnerabilityEpss.Score(childComplexity), true + + case "VulnerabilityFinding.dataSource": + if e.ComplexityRoot.VulnerabilityFinding.DataSource == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.DataSource(childComplexity), true + + case "VulnerabilityFinding.epss": + if e.ComplexityRoot.VulnerabilityFinding.Epss == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Epss(childComplexity), true + + case "VulnerabilityFinding.fixedVersion": + if e.ComplexityRoot.VulnerabilityFinding.FixedVersion == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.FixedVersion(childComplexity), true + + case "VulnerabilityFinding.id": + if e.ComplexityRoot.VulnerabilityFinding.ID == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.ID(childComplexity), true + + case "VulnerabilityFinding.image": + if e.ComplexityRoot.VulnerabilityFinding.Image == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Image(childComplexity), true + + case "VulnerabilityFinding.installedVersion": + if e.ComplexityRoot.VulnerabilityFinding.InstalledVersion == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.InstalledVersion(childComplexity), true + + case "VulnerabilityFinding.knownExploited": + if e.ComplexityRoot.VulnerabilityFinding.KnownExploited == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.KnownExploited(childComplexity), true + + case "VulnerabilityFinding.packageKey": + if e.ComplexityRoot.VulnerabilityFinding.PackageKey == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.PackageKey(childComplexity), true + + case "VulnerabilityFinding.purl": + if e.ComplexityRoot.VulnerabilityFinding.Purl == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Purl(childComplexity), true + + case "VulnerabilityFinding.severity": + if e.ComplexityRoot.VulnerabilityFinding.Severity == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Severity(childComplexity), true + + case "VulnerabilityFinding.severitySource": + if e.ComplexityRoot.VulnerabilityFinding.SeveritySource == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.SeveritySource(childComplexity), true + + case "VulnerabilityFinding.suppression": + if e.ComplexityRoot.VulnerabilityFinding.Suppression == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Suppression(childComplexity), true + + case "VulnerabilityFinding.vulnerability": + if e.ComplexityRoot.VulnerabilityFinding.Vulnerability == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Vulnerability(childComplexity), true + + case "VulnerabilityFinding.vulnerabilityIdentifier": + if e.ComplexityRoot.VulnerabilityFinding.VulnerabilityIdentifier == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.VulnerabilityIdentifier(childComplexity), true + + case "VulnerabilityFinding.workload": + if e.ComplexityRoot.VulnerabilityFinding.Workload == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFinding.Workload(childComplexity), true + + case "VulnerabilityFindingConnection.edges": + if e.ComplexityRoot.VulnerabilityFindingConnection.Edges == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingConnection.Edges(childComplexity), true + + case "VulnerabilityFindingConnection.nodes": + if e.ComplexityRoot.VulnerabilityFindingConnection.Nodes == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingConnection.Nodes(childComplexity), true + + case "VulnerabilityFindingConnection.pageInfo": + if e.ComplexityRoot.VulnerabilityFindingConnection.PageInfo == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingConnection.PageInfo(childComplexity), true + + case "VulnerabilityFindingEdge.cursor": + if e.ComplexityRoot.VulnerabilityFindingEdge.Cursor == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingEdge.Cursor(childComplexity), true + + case "VulnerabilityFindingEdge.node": + if e.ComplexityRoot.VulnerabilityFindingEdge.Node == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingEdge.Node(childComplexity), true + + case "VulnerabilityFindingSummary.countsBySeverity": + if e.ComplexityRoot.VulnerabilityFindingSummary.CountsBySeverity == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingSummary.CountsBySeverity(childComplexity), true + + case "VulnerabilityFindingSummary.fixableFindings": + if e.ComplexityRoot.VulnerabilityFindingSummary.FixableFindings == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingSummary.FixableFindings(childComplexity), true + + case "VulnerabilityFindingSummary.knownExploitedFindings": + if e.ComplexityRoot.VulnerabilityFindingSummary.KnownExploitedFindings == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingSummary.KnownExploitedFindings(childComplexity), true + + case "VulnerabilityFindingSummary.totalFindings": + if e.ComplexityRoot.VulnerabilityFindingSummary.TotalFindings == nil { + break + } + + return e.ComplexityRoot.VulnerabilityFindingSummary.TotalFindings(childComplexity), true + case "VulnerabilityFixHistory.samples": if e.ComplexityRoot.VulnerabilityFixHistory.Samples == nil { break @@ -21405,6 +22076,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.VulnerabilityFixSample.TotalWorkloads(childComplexity), true + case "VulnerabilityImage.digest": + if e.ComplexityRoot.VulnerabilityImage.Digest == nil { + break + } + + return e.ComplexityRoot.VulnerabilityImage.Digest(childComplexity), true + + case "VulnerabilityImage.name": + if e.ComplexityRoot.VulnerabilityImage.Name == nil { + break + } + + return e.ComplexityRoot.VulnerabilityImage.Name(childComplexity), true + case "VulnerabilityRemediation.fixVersion": if e.ComplexityRoot.VulnerabilityRemediation.FixVersion == nil { break @@ -21461,6 +22146,230 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.VulnerabilityRiskAssessment.Priority(childComplexity), true + case "VulnerabilitySeverityCounts.critical": + if e.ComplexityRoot.VulnerabilitySeverityCounts.Critical == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySeverityCounts.Critical(childComplexity), true + + case "VulnerabilitySeverityCounts.high": + if e.ComplexityRoot.VulnerabilitySeverityCounts.High == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySeverityCounts.High(childComplexity), true + + case "VulnerabilitySeverityCounts.low": + if e.ComplexityRoot.VulnerabilitySeverityCounts.Low == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySeverityCounts.Low(childComplexity), true + + case "VulnerabilitySeverityCounts.medium": + if e.ComplexityRoot.VulnerabilitySeverityCounts.Medium == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySeverityCounts.Medium(childComplexity), true + + case "VulnerabilitySeverityCounts.unknown": + if e.ComplexityRoot.VulnerabilitySeverityCounts.Unknown == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySeverityCounts.Unknown(childComplexity), true + + case "VulnerabilitySuppression.environment": + if e.ComplexityRoot.VulnerabilitySuppression.Environment == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.Environment(childComplexity), true + + case "VulnerabilitySuppression.id": + if e.ComplexityRoot.VulnerabilitySuppression.ID == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.ID(childComplexity), true + + case "VulnerabilitySuppression.imageName": + if e.ComplexityRoot.VulnerabilitySuppression.ImageName == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.ImageName(childComplexity), true + + case "VulnerabilitySuppression.packageKey": + if e.ComplexityRoot.VulnerabilitySuppression.PackageKey == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.PackageKey(childComplexity), true + + case "VulnerabilitySuppression.reason": + if e.ComplexityRoot.VulnerabilitySuppression.Reason == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.Reason(childComplexity), true + + case "VulnerabilitySuppression.state": + if e.ComplexityRoot.VulnerabilitySuppression.State == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.State(childComplexity), true + + case "VulnerabilitySuppression.team": + if e.ComplexityRoot.VulnerabilitySuppression.Team == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.Team(childComplexity), true + + case "VulnerabilitySuppression.updatedAt": + if e.ComplexityRoot.VulnerabilitySuppression.UpdatedAt == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.UpdatedAt(childComplexity), true + + case "VulnerabilitySuppression.updatedBy": + if e.ComplexityRoot.VulnerabilitySuppression.UpdatedBy == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.UpdatedBy(childComplexity), true + + case "VulnerabilitySuppression.vulnerabilityIdentifier": + if e.ComplexityRoot.VulnerabilitySuppression.VulnerabilityIdentifier == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.VulnerabilityIdentifier(childComplexity), true + + case "VulnerabilitySuppression.workload": + if e.ComplexityRoot.VulnerabilitySuppression.Workload == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppression.Workload(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.actor": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.Actor == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.Actor(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.createdAt": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.CreatedAt == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.CreatedAt(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.data": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.Data == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.Data(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.environmentName": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.EnvironmentName == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.EnvironmentName(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.gitHubActorClaims": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.GitHubActorClaims == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.GitHubActorClaims(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.id": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.ID == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.ID(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.message": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.Message == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.Message(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.resourceName": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.ResourceName == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.ResourceName(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.resourceType": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.ResourceType == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.ResourceType(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntry.teamSlug": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.TeamSlug == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntry.TeamSlug(childComplexity), true + + case "VulnerabilitySuppressionActivityLogEntryData.assessment": + if e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntryData.Assessment == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionActivityLogEntryData.Assessment(childComplexity), true + + case "VulnerabilitySuppressionConnection.edges": + if e.ComplexityRoot.VulnerabilitySuppressionConnection.Edges == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionConnection.Edges(childComplexity), true + + case "VulnerabilitySuppressionConnection.nodes": + if e.ComplexityRoot.VulnerabilitySuppressionConnection.Nodes == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionConnection.Nodes(childComplexity), true + + case "VulnerabilitySuppressionConnection.pageInfo": + if e.ComplexityRoot.VulnerabilitySuppressionConnection.PageInfo == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionConnection.PageInfo(childComplexity), true + + case "VulnerabilitySuppressionEdge.cursor": + if e.ComplexityRoot.VulnerabilitySuppressionEdge.Cursor == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionEdge.Cursor(childComplexity), true + + case "VulnerabilitySuppressionEdge.node": + if e.ComplexityRoot.VulnerabilitySuppressionEdge.Node == nil { + break + } + + return e.ComplexityRoot.VulnerabilitySuppressionEdge.Node(childComplexity), true + case "VulnerabilityUpdatedActivityLogEntry.actor": if e.ComplexityRoot.VulnerabilityUpdatedActivityLogEntry.Actor == nil { break @@ -21531,6 +22440,27 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.VulnerabilityUpdatedActivityLogEntry.TeamSlug(childComplexity), true + case "VulnerabilityWorkloadRef.environment": + if e.ComplexityRoot.VulnerabilityWorkloadRef.Environment == nil { + break + } + + return e.ComplexityRoot.VulnerabilityWorkloadRef.Environment(childComplexity), true + + case "VulnerabilityWorkloadRef.name": + if e.ComplexityRoot.VulnerabilityWorkloadRef.Name == nil { + break + } + + return e.ComplexityRoot.VulnerabilityWorkloadRef.Name(childComplexity), true + + case "VulnerabilityWorkloadRef.team": + if e.ComplexityRoot.VulnerabilityWorkloadRef.Team == nil { + break + } + + return e.ComplexityRoot.VulnerabilityWorkloadRef.Team(childComplexity), true + case "VulnerableImageIssue.critical": if e.ComplexityRoot.VulnerableImageIssue.Critical == nil { break @@ -22903,6 +23833,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputDeleteTunnelInput, ec.unmarshalInputDeleteUnleashInstanceInput, ec.unmarshalInputDeleteValkeyInput, + ec.unmarshalInputDeleteVulnerabilitySuppressionsInput, ec.unmarshalInputDeleteWebhookInput, ec.unmarshalInputDeploymentFilter, ec.unmarshalInputDeploymentOrder, @@ -22925,6 +23856,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputLogSubscriptionInitialBatch, ec.unmarshalInputMetricsQueryInput, ec.unmarshalInputMetricsRangeInput, + ec.unmarshalInputNewVulnerabilitySuppressionInput, ec.unmarshalInputOpenSearchAccessOrder, ec.unmarshalInputOpenSearchFilter, ec.unmarshalInputOpenSearchOrder, @@ -22948,6 +23880,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputSecretOrder, ec.unmarshalInputSecretValueInput, ec.unmarshalInputSetTeamMemberRoleInput, + ec.unmarshalInputSetVulnerabilitySuppressionsInput, ec.unmarshalInputSqlInstanceFilter, ec.unmarshalInputSqlInstanceOrder, ec.unmarshalInputSqlInstanceUserOrder, @@ -22995,7 +23928,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputValkeyFilter, ec.unmarshalInputValkeyOrder, ec.unmarshalInputViewSecretValuesInput, + ec.unmarshalInputVulnerabilityFindingFilter, + ec.unmarshalInputVulnerabilityScopeInput, ec.unmarshalInputVulnerabilitySummaryOrder, + ec.unmarshalInputVulnerabilitySuppressionFilter, + ec.unmarshalInputVulnerabilitySuppressionKeyInput, ec.unmarshalInputWebhookEventSelection, ec.unmarshalInputWorkloadEventFilter, ec.unmarshalInputWorkloadLogSubscriptionFilter, @@ -35801,6 +36738,504 @@ type ApplicationInstanceUtilization { "Get the current usage for the requested resource type." current: Float! } +`, BuiltIn: false}, + {Name: "../schema/v0s.graphqls", Input: `extend type Query { + "Current vulnerability findings for deployed applications and jobs." + vulnerabilityFindings( + "Filter the full finding selection." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over the full filtered selection, not just the loaded page." + vulnerabilityFindingSummary( + "Filter the full finding selection." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed applications and jobs." + vulnerabilityCoverage( + "Limit coverage to a team, environment or workload. Omitted scope is tenant-wide." + scope: VulnerabilityScopeInput + ): VulnerabilityCoverageCounts! + "Advisory details for a vulnerability identifier or alias. Unknown identifiers return null." + vulnerability( + "The vulnerability identifier or an alias identifying exactly one vulnerability." + identifier: String! + ): Vulnerability + "Current workload assessments, including assessments without active findings." + vulnerabilitySuppressions( + "Filter the assessment selection." + filter: VulnerabilitySuppressionFilter + "Get the first n assessments, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilitySuppressionConnection! +} + +extend interface Workload { + "Current vulnerability findings in the deployed image." + vulnerabilityFindings( + "Filter this workload's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over this workload's full filtered finding selection." + vulnerabilityFindingSummary( + "Filter this workload's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed image." + vulnerabilityCoverage: VulnerabilityCoverage! +} + +extend type Application { + "Current vulnerability findings in the deployed image." + vulnerabilityFindings( + "Filter this application's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over this application's full filtered finding selection." + vulnerabilityFindingSummary( + "Filter this application's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed image." + vulnerabilityCoverage: VulnerabilityCoverage! +} + +extend type Job { + "Current vulnerability findings in the deployed image." + vulnerabilityFindings( + "Filter this job's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over this job's full filtered finding selection." + vulnerabilityFindingSummary( + "Filter this job's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed image." + vulnerabilityCoverage: VulnerabilityCoverage! +} + +"Limit a tenant-wide selection. A workload name requires both team and environment." +input VulnerabilityScopeInput { + "The team owning the workload." + team: Slug + "The environment where the workload is deployed." + environment: String + "The application or job name." + workload: String +} + +"Filters applied before finding pagination and aggregation." +input VulnerabilityFindingFilter { + "Limit a root query to a team, environment or workload. Workload fields are already scoped." + scope: VulnerabilityScopeInput + "Match a vulnerability identifier or alias." + vulnerabilityIdentifier: String + "Match a full package URL, or a version-independent package key." + package: String + "Include only findings with these severities." + severities: [VulnerabilitySeverity!] + "Include only findings with a known fixed version." + onlyWithFix: Boolean = false + "Include only vulnerabilities listed in CISA KEV." + onlyKnownExploited: Boolean = false + "Whether assessed findings are included." + suppressed: SuppressedFilter = EXCLUDE +} + +"How workload assessments affect the finding selection." +enum SuppressedFilter { + "Exclude findings with an assessment." + EXCLUDE + "Include both assessed and unassessed findings." + INCLUDE + "Include only findings with an assessment." + ONLY +} + +"Severity reported by the finding's advisory source." +enum VulnerabilitySeverity { + "The source did not provide a recognized severity." + UNKNOWN + "Low severity." + LOW + "Medium severity." + MEDIUM + "High severity." + HIGH + "Critical severity." + CRITICAL +} + +"A forward-paginated selection of vulnerability findings." +type VulnerabilityFindingConnection { + "Findings and their continuation cursors." + edges: [VulnerabilityFindingEdge!]! + "The findings in the same order as edges." + nodes: [VulnerabilityFinding!]! + "Pagination information and the full filtered total." + pageInfo: PageInfo! +} + +"A vulnerability finding and the cursor immediately after it." +type VulnerabilityFindingEdge { + "A cursor for continuing after this finding with the same filter." + cursor: Cursor! + "The vulnerability finding." + node: VulnerabilityFinding! +} + +"A vulnerability affecting one package in a workload's deployed image." +type VulnerabilityFinding implements Node { + "The globally unique identifier of this finding." + id: ID! + "The workload affected by the finding." + workload: VulnerabilityWorkloadRef! + "The deployed image in which the finding was detected." + image: VulnerabilityImage! + "The canonical vulnerability identifier." + vulnerabilityIdentifier: String! + "Advisory details, if the vulnerability is still known." + vulnerability: Vulnerability + "The full package URL identifying the affected component." + purl: String! + "The package URL without version, qualifiers or subpath." + packageKey: String! + "The installed package version." + installedVersion: String! + "The first known fixed version, if provided by the source." + fixedVersion: String + "Severity reported by the advisory source." + severity: VulnerabilitySeverity! + "The source supplying the severity." + severitySource: String! + "The advisory source supplying the finding." + dataSource: String! + "The estimated probability of exploitation, if available." + epss: VulnerabilityEpss + "Known exploited according to CISA KEV. False is not proof of no exploitation." + knownExploited: Boolean! + "The current assessment for this workload, image repository, package and vulnerability." + suppression: VulnerabilitySuppression +} + +"The identity of the application or job affected by a finding." +type VulnerabilityWorkloadRef { + "The team owning the workload." + team: Slug! + "The environment where the workload is deployed." + environment: String! + "The application or job name." + name: String! +} + +"A container image identified by repository name and manifest digest." +type VulnerabilityImage { + "The image repository name." + name: String! + "The immutable manifest digest." + digest: String! +} + +"Counts over the full filtered selection of current findings." +type VulnerabilityFindingSummary { + "The total number of findings." + totalFindings: Int! + "Finding counts by severity." + countsBySeverity: VulnerabilitySeverityCounts! + "The number of findings with a known fixed version." + fixableFindings: Int! + "The number of findings whose vulnerability is listed in CISA KEV." + knownExploitedFindings: Int! +} + +"Finding counts grouped by advisory severity." +type VulnerabilitySeverityCounts { + "Findings without a recognized severity." + unknown: Int! + "Low-severity findings." + low: Int! + "Medium-severity findings." + medium: Int! + "High-severity findings." + high: Int! + "Critical-severity findings." + critical: Int! +} + +"Coverage counts for the selected, currently deployed workloads." +type VulnerabilityCoverageCounts { + "The total number of workloads in the selection." + totalWorkloads: Int! + "Workloads with a completed scan. This does not mean they have no vulnerabilities." + scanned: Int! + "Workloads waiting for inventory, a package inventory or a scan." + pending: Int! + "Workloads whose image has no package inventory." + noSbom: Int! + "Workloads whose image has not been scanned successfully because of an error." + failed: Int! + "Workloads whose deployed image could not be resolved." + unresolvedImage: Int! +} + +"Scan coverage of one workload's currently deployed image." +type VulnerabilityCoverage { + "How far the deployed image has progressed towards a completed scan." + status: VulnerabilityCoverageStatus! + "The resolved image repository name, if known." + imageName: String + "The resolved image manifest digest, if known." + imageDigest: String + "The last successful scan time, if available." + scannedAt: Time + "The latest resolution, fetching or scanning error, if any." + error: String +} + +"How far a deployed image has progressed towards vulnerability findings." +enum VulnerabilityCoverageStatus { + "Waiting for inventory, a package inventory or a scan." + PENDING + "A scan completed. Findings from the last successful scan survive a failed rescan." + SCANNED + "No package inventory was found for the image." + NO_SBOM + "An error prevented the image's first successful scan." + FAILED + "The deployed image could not be resolved." + UNRESOLVED_IMAGE +} + +"A workload owner's current assessment of a vulnerability finding." +enum VulnerabilitySuppressionState { + "The workload is not affected by the vulnerability." + NOT_AFFECTED + "The finding is a false positive." + FALSE_POSITIVE + "The workload owner has accepted the risk." + ACCEPTED_RISK +} + +"Advisory information shared by findings for the same vulnerability." +type Vulnerability implements Node { + "The globally unique identifier of the advisory." + id: ID! + "The canonical vulnerability identifier." + identifier: String! + "Alternative identifiers for this vulnerability." + aliases: [String!]! + "The advisory title." + title: String! + "The advisory description." + description: String! + "CVSS scores and vectors supplied by the advisory sources." + cvss: [VulnerabilityCvss!]! + "Reference URLs supplied by the advisory sources." + references: [String!]! + "The estimated probability of exploitation, if available." + epss: VulnerabilityEpss + "Known exploited according to CISA KEV. False is not proof of no exploitation." + knownExploited: Boolean! +} + +"One source's CVSS score and vector, preserving absent values." +type VulnerabilityCvss { + "The source supplying the CVSS assessment." + source: String! + "The CVSS version supplied by the source." + version: String! + "The CVSS score, or null when the source did not supply one." + score: Float + "The CVSS vector, or null when the source did not supply one." + vector: String +} + +"An exploitation probability supplied by FIRST EPSS." +type VulnerabilityEpss { + "The estimated probability of exploitation, between zero and one." + score: Float! + "The date of the probability estimate." + date: Date! +} + +"Filters applied before assessment pagination." +input VulnerabilitySuppressionFilter { + "Limit a root query to a team, environment or workload." + scope: VulnerabilityScopeInput + "Match a vulnerability identifier or alias." + vulnerabilityIdentifier: String + "Match an image repository name." + imageName: String +} + +"A durable assessment for one workload, image repository, package and vulnerability." +type VulnerabilitySuppression implements Node { + "The globally unique identifier of the assessment." + id: ID! + "The team owning the assessment." + team: Slug! + "The environment where the assessment applies." + environment: String! + "The application or job name." + workload: String! + "The image repository name. The assessment survives image version changes." + imageName: String! + "The package URL without version, qualifiers or subpath." + packageKey: String! + "The canonical vulnerability identifier." + vulnerabilityIdentifier: String! + "The current assessment state." + state: VulnerabilitySuppressionState! + "The workload owner's reason for the assessment." + reason: String! + "The identity of the actor who last set the assessment." + updatedBy: String! + "The time the assessment was last set." + updatedAt: Time! +} + +"A forward-paginated selection of workload assessments." +type VulnerabilitySuppressionConnection { + "Assessments and their continuation cursors." + edges: [VulnerabilitySuppressionEdge!]! + "The assessments in the same order as edges." + nodes: [VulnerabilitySuppression!]! + "Pagination information and the full filtered total." + pageInfo: PageInfo! +} + +"A workload assessment and the cursor immediately after it." +type VulnerabilitySuppressionEdge { + "A cursor for continuing after this assessment with the same filter." + cursor: Cursor! + "The workload assessment." + node: VulnerabilitySuppression! +} + +"Identifies an assessment within the mutation's team." +input VulnerabilitySuppressionKeyInput { + "The environment where the assessment applies." + environment: String! + "The application or job name." + workload: String! + "The image repository name, without a tag or digest." + imageName: String! + "A package key or full package URL. Version, qualifiers and subpath are ignored." + packageKey: String! + "A vulnerability identifier or an alias identifying exactly one vulnerability." + vulnerabilityIdentifier: String! +} + +"An assessment to set for a workload." +input NewVulnerabilitySuppressionInput { + "The workload, image repository, package and vulnerability being assessed." + key: VulnerabilitySuppressionKeyInput! + "The workload owner's assessment." + state: VulnerabilitySuppressionState! + "A non-empty explanation for the assessment." + reason: String! +} + +"An atomic batch of assessments for one team." +input SetVulnerabilitySuppressionsInput { + "The team owning every assessment in the batch." + team: Slug! + "The assessments to set. At least one item is required." + items: [NewVulnerabilitySuppressionInput!]! +} + +"An atomic batch of assessments to delete for one team." +input DeleteVulnerabilitySuppressionsInput { + "The team owning every assessment in the batch." + team: Slug! + "The assessments to delete. Missing assessments are ignored." + keys: [VulnerabilitySuppressionKeyInput!]! +} + +"The assessments set by the batch, using canonical package and vulnerability identifiers." +type SetVulnerabilitySuppressionsPayload { + "The assessments as stored." + suppressions: [VulnerabilitySuppression!]! +} + +"The assessments that existed and were deleted by the batch." +type DeleteVulnerabilitySuppressionsPayload { + "The deleted assessments." + deleted: [VulnerabilitySuppression!]! +} + +extend type Mutation { + "Set workload assessments atomically. Until assessment writes are enabled, use updateImageVulnerability." + setVulnerabilitySuppressions( + "The team and assessments to update." + input: SetVulnerabilitySuppressionsInput! + ): SetVulnerabilitySuppressionsPayload! + "Delete workload assessments atomically. Until assessment writes are enabled, use updateImageVulnerability." + deleteVulnerabilitySuppressions( + "The team and assessments to delete." + input: DeleteVulnerabilitySuppressionsInput! + ): DeleteVulnerabilitySuppressionsPayload! +} + +"An assessment change recorded in the activity log." +type VulnerabilitySuppressionActivityLogEntry implements ActivityLogEntry & Node { + "The globally unique identifier of the entry." + id: ID! + "The identity of the actor who changed the assessment." + actor: String! + "GitHub Actions OIDC claims when authenticated by a GitHub repository." + gitHubActorClaims: GitHubActorClaims + "The time the activity was recorded." + createdAt: Time! + "A summary of the assessment change." + message: String! + "The type of resource affected." + resourceType: ActivityLogEntryResourceType! + "The name of the affected workload." + resourceName: String! + "The team owning the assessment." + teamSlug: Slug + "The environment where the assessment applies." + environmentName: String + "The assessment as set, or as it existed before deletion." + data: VulnerabilitySuppressionActivityLogEntryData! +} + +"The assessment associated with an activity log entry." +type VulnerabilitySuppressionActivityLogEntryData { + "The assessment as set, or as it existed before deletion." + assessment: VulnerabilitySuppression! +} + +extend enum ActivityLogEntryResourceType { + "A workload vulnerability assessment." + VULNERABILITY_SUPPRESSION +} + +extend enum ActivityLogActivityType { + "A workload vulnerability assessment was set." + VULNERABILITY_SUPPRESSION_UPDATED + "A workload vulnerability assessment was deleted." + VULNERABILITY_SUPPRESSION_DELETED +} `, BuiltIn: false}, {Name: "../schema/valkey.graphqls", Input: `extend type Team { "Valkey instances owned by the team." @@ -38944,6 +40379,12 @@ func (ec *executionContext) childFields_Application(ctx context.Context, field g return ec.fieldContext_Application_sqlInstances(ctx, field) case "utilization": return ec.fieldContext_Application_utilization(ctx, field) + case "vulnerabilityFindings": + return ec.fieldContext_Application_vulnerabilityFindings(ctx, field) + case "vulnerabilityFindingSummary": + return ec.fieldContext_Application_vulnerabilityFindingSummary(ctx, field) + case "vulnerabilityCoverage": + return ec.fieldContext_Application_vulnerabilityCoverage(ctx, field) case "valkeys": return ec.fieldContext_Application_valkeys(ctx, field) case "imageVulnerabilityHistory": @@ -39878,6 +41319,14 @@ func (ec *executionContext) childFields_DeleteValkeyPayload(ctx context.Context, return nil, fmt.Errorf("no field named %q was found under type DeleteValkeyPayload", field.Name) } +func (ec *executionContext) childFields_DeleteVulnerabilitySuppressionsPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "deleted": + return ec.fieldContext_DeleteVulnerabilitySuppressionsPayload_deleted(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteVulnerabilitySuppressionsPayload", field.Name) +} + func (ec *executionContext) childFields_DeleteWebhookPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "webhookID": @@ -40570,6 +42019,12 @@ func (ec *executionContext) childFields_Job(ctx context.Context, field graphql.C return ec.fieldContext_Job_serviceAccount(ctx, field) case "sqlInstances": return ec.fieldContext_Job_sqlInstances(ctx, field) + case "vulnerabilityFindings": + return ec.fieldContext_Job_vulnerabilityFindings(ctx, field) + case "vulnerabilityFindingSummary": + return ec.fieldContext_Job_vulnerabilityFindingSummary(ctx, field) + case "vulnerabilityCoverage": + return ec.fieldContext_Job_vulnerabilityCoverage(ctx, field) case "valkeys": return ec.fieldContext_Job_valkeys(ctx, field) case "imageVulnerabilityHistory": @@ -42324,6 +43779,14 @@ func (ec *executionContext) childFields_SetTeamMemberRolePayload(ctx context.Con return nil, fmt.Errorf("no field named %q was found under type SetTeamMemberRolePayload", field.Name) } +func (ec *executionContext) childFields_SetVulnerabilitySuppressionsPayload(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "suppressions": + return ec.fieldContext_SetVulnerabilitySuppressionsPayload_suppressions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SetVulnerabilitySuppressionsPayload", field.Name) +} + func (ec *executionContext) childFields_SqlDatabase(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -43856,6 +45319,30 @@ func (ec *executionContext) childFields_ViewSecretValuesPayload(ctx context.Cont return nil, fmt.Errorf("no field named %q was found under type ViewSecretValuesPayload", field.Name) } +func (ec *executionContext) childFields_Vulnerability(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Vulnerability_id(ctx, field) + case "identifier": + return ec.fieldContext_Vulnerability_identifier(ctx, field) + case "aliases": + return ec.fieldContext_Vulnerability_aliases(ctx, field) + case "title": + return ec.fieldContext_Vulnerability_title(ctx, field) + case "description": + return ec.fieldContext_Vulnerability_description(ctx, field) + case "cvss": + return ec.fieldContext_Vulnerability_cvss(ctx, field) + case "references": + return ec.fieldContext_Vulnerability_references(ctx, field) + case "epss": + return ec.fieldContext_Vulnerability_epss(ctx, field) + case "knownExploited": + return ec.fieldContext_Vulnerability_knownExploited(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Vulnerability", field.Name) +} + func (ec *executionContext) childFields_VulnerabilityActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "identifier": @@ -43872,6 +45359,136 @@ func (ec *executionContext) childFields_VulnerabilityActivityLogEntryData(ctx co return nil, fmt.Errorf("no field named %q was found under type VulnerabilityActivityLogEntryData", field.Name) } +func (ec *executionContext) childFields_VulnerabilityCoverage(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "status": + return ec.fieldContext_VulnerabilityCoverage_status(ctx, field) + case "imageName": + return ec.fieldContext_VulnerabilityCoverage_imageName(ctx, field) + case "imageDigest": + return ec.fieldContext_VulnerabilityCoverage_imageDigest(ctx, field) + case "scannedAt": + return ec.fieldContext_VulnerabilityCoverage_scannedAt(ctx, field) + case "error": + return ec.fieldContext_VulnerabilityCoverage_error(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityCoverage", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityCoverageCounts(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "totalWorkloads": + return ec.fieldContext_VulnerabilityCoverageCounts_totalWorkloads(ctx, field) + case "scanned": + return ec.fieldContext_VulnerabilityCoverageCounts_scanned(ctx, field) + case "pending": + return ec.fieldContext_VulnerabilityCoverageCounts_pending(ctx, field) + case "noSbom": + return ec.fieldContext_VulnerabilityCoverageCounts_noSbom(ctx, field) + case "failed": + return ec.fieldContext_VulnerabilityCoverageCounts_failed(ctx, field) + case "unresolvedImage": + return ec.fieldContext_VulnerabilityCoverageCounts_unresolvedImage(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityCoverageCounts", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityCvss(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "source": + return ec.fieldContext_VulnerabilityCvss_source(ctx, field) + case "version": + return ec.fieldContext_VulnerabilityCvss_version(ctx, field) + case "score": + return ec.fieldContext_VulnerabilityCvss_score(ctx, field) + case "vector": + return ec.fieldContext_VulnerabilityCvss_vector(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityCvss", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityEpss(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "score": + return ec.fieldContext_VulnerabilityEpss_score(ctx, field) + case "date": + return ec.fieldContext_VulnerabilityEpss_date(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityEpss", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityFinding(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_VulnerabilityFinding_id(ctx, field) + case "workload": + return ec.fieldContext_VulnerabilityFinding_workload(ctx, field) + case "image": + return ec.fieldContext_VulnerabilityFinding_image(ctx, field) + case "vulnerabilityIdentifier": + return ec.fieldContext_VulnerabilityFinding_vulnerabilityIdentifier(ctx, field) + case "vulnerability": + return ec.fieldContext_VulnerabilityFinding_vulnerability(ctx, field) + case "purl": + return ec.fieldContext_VulnerabilityFinding_purl(ctx, field) + case "packageKey": + return ec.fieldContext_VulnerabilityFinding_packageKey(ctx, field) + case "installedVersion": + return ec.fieldContext_VulnerabilityFinding_installedVersion(ctx, field) + case "fixedVersion": + return ec.fieldContext_VulnerabilityFinding_fixedVersion(ctx, field) + case "severity": + return ec.fieldContext_VulnerabilityFinding_severity(ctx, field) + case "severitySource": + return ec.fieldContext_VulnerabilityFinding_severitySource(ctx, field) + case "dataSource": + return ec.fieldContext_VulnerabilityFinding_dataSource(ctx, field) + case "epss": + return ec.fieldContext_VulnerabilityFinding_epss(ctx, field) + case "knownExploited": + return ec.fieldContext_VulnerabilityFinding_knownExploited(ctx, field) + case "suppression": + return ec.fieldContext_VulnerabilityFinding_suppression(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityFinding", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityFindingConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_VulnerabilityFindingConnection_edges(ctx, field) + case "nodes": + return ec.fieldContext_VulnerabilityFindingConnection_nodes(ctx, field) + case "pageInfo": + return ec.fieldContext_VulnerabilityFindingConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityFindingConnection", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityFindingEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_VulnerabilityFindingEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_VulnerabilityFindingEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityFindingEdge", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "totalFindings": + return ec.fieldContext_VulnerabilityFindingSummary_totalFindings(ctx, field) + case "countsBySeverity": + return ec.fieldContext_VulnerabilityFindingSummary_countsBySeverity(ctx, field) + case "fixableFindings": + return ec.fieldContext_VulnerabilityFindingSummary_fixableFindings(ctx, field) + case "knownExploitedFindings": + return ec.fieldContext_VulnerabilityFindingSummary_knownExploitedFindings(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityFindingSummary", field.Name) +} + func (ec *executionContext) childFields_VulnerabilityFixHistory(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "samples": @@ -43900,6 +45517,16 @@ func (ec *executionContext) childFields_VulnerabilityFixSample(ctx context.Conte return nil, fmt.Errorf("no field named %q was found under type VulnerabilityFixSample", field.Name) } +func (ec *executionContext) childFields_VulnerabilityImage(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_VulnerabilityImage_name(ctx, field) + case "digest": + return ec.fieldContext_VulnerabilityImage_digest(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityImage", field.Name) +} + func (ec *executionContext) childFields_VulnerabilityRemediation(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "fixVersion": @@ -43928,6 +45555,92 @@ func (ec *executionContext) childFields_VulnerabilityRiskAssessment(ctx context. return nil, fmt.Errorf("no field named %q was found under type VulnerabilityRiskAssessment", field.Name) } +func (ec *executionContext) childFields_VulnerabilitySeverityCounts(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "unknown": + return ec.fieldContext_VulnerabilitySeverityCounts_unknown(ctx, field) + case "low": + return ec.fieldContext_VulnerabilitySeverityCounts_low(ctx, field) + case "medium": + return ec.fieldContext_VulnerabilitySeverityCounts_medium(ctx, field) + case "high": + return ec.fieldContext_VulnerabilitySeverityCounts_high(ctx, field) + case "critical": + return ec.fieldContext_VulnerabilitySeverityCounts_critical(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilitySeverityCounts", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilitySuppression(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_VulnerabilitySuppression_id(ctx, field) + case "team": + return ec.fieldContext_VulnerabilitySuppression_team(ctx, field) + case "environment": + return ec.fieldContext_VulnerabilitySuppression_environment(ctx, field) + case "workload": + return ec.fieldContext_VulnerabilitySuppression_workload(ctx, field) + case "imageName": + return ec.fieldContext_VulnerabilitySuppression_imageName(ctx, field) + case "packageKey": + return ec.fieldContext_VulnerabilitySuppression_packageKey(ctx, field) + case "vulnerabilityIdentifier": + return ec.fieldContext_VulnerabilitySuppression_vulnerabilityIdentifier(ctx, field) + case "state": + return ec.fieldContext_VulnerabilitySuppression_state(ctx, field) + case "reason": + return ec.fieldContext_VulnerabilitySuppression_reason(ctx, field) + case "updatedBy": + return ec.fieldContext_VulnerabilitySuppression_updatedBy(ctx, field) + case "updatedAt": + return ec.fieldContext_VulnerabilitySuppression_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilitySuppression", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilitySuppressionActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "assessment": + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntryData_assessment(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilitySuppressionActivityLogEntryData", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilitySuppressionConnection(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_VulnerabilitySuppressionConnection_edges(ctx, field) + case "nodes": + return ec.fieldContext_VulnerabilitySuppressionConnection_nodes(ctx, field) + case "pageInfo": + return ec.fieldContext_VulnerabilitySuppressionConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilitySuppressionConnection", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilitySuppressionEdge(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_VulnerabilitySuppressionEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_VulnerabilitySuppressionEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilitySuppressionEdge", field.Name) +} + +func (ec *executionContext) childFields_VulnerabilityWorkloadRef(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "team": + return ec.fieldContext_VulnerabilityWorkloadRef_team(ctx, field) + case "environment": + return ec.fieldContext_VulnerabilityWorkloadRef_environment(ctx, field) + case "name": + return ec.fieldContext_VulnerabilityWorkloadRef_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VulnerabilityWorkloadRef", field.Name) +} + func (ec *executionContext) childFields_WebhookActivityLogEntryData(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": diff --git a/internal/graph/gengql/schema.generated.go b/internal/graph/gengql/schema.generated.go index 760e5e8dd..17c3a6162 100644 --- a/internal/graph/gengql/schema.generated.go +++ b/internal/graph/gengql/schema.generated.go @@ -51,6 +51,7 @@ import ( "github.com/nais/api/internal/user" "github.com/nais/api/internal/usersync" "github.com/nais/api/internal/utilization" + "github.com/nais/api/internal/v0s" "github.com/nais/api/internal/vulnerability" "github.com/nais/api/internal/workload" "github.com/nais/api/internal/workload/application" @@ -129,6 +130,8 @@ type MutationResolver interface { AllowTeamAccessToUnleash(ctx context.Context, input unleash.AllowTeamAccessToUnleashInput) (*unleash.AllowTeamAccessToUnleashPayload, error) RevokeTeamAccessToUnleash(ctx context.Context, input unleash.RevokeTeamAccessToUnleashInput) (*unleash.RevokeTeamAccessToUnleashPayload, error) DeleteUnleashInstance(ctx context.Context, input unleash.DeleteUnleashInstanceInput) (*unleash.DeleteUnleashInstancePayload, error) + SetVulnerabilitySuppressions(ctx context.Context, input v0s.SetVulnerabilitySuppressionsInput) (*v0s.SetVulnerabilitySuppressionsPayload, error) + DeleteVulnerabilitySuppressions(ctx context.Context, input v0s.DeleteVulnerabilitySuppressionsInput) (*v0s.DeleteVulnerabilitySuppressionsPayload, error) CreateValkey(ctx context.Context, input valkey.CreateValkeyInput) (*valkey.CreateValkeyPayload, error) UpdateValkey(ctx context.Context, input valkey.UpdateValkeyInput) (*valkey.UpdateValkeyPayload, error) DeleteValkey(ctx context.Context, input valkey.DeleteValkeyInput) (*valkey.DeleteValkeyPayload, error) @@ -162,6 +165,11 @@ type QueryResolver interface { Me(ctx context.Context) (authz.AuthenticatedUser, error) UserSyncLog(ctx context.Context, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor) (*pagination.Connection[usersync.UserSyncLogEntry], error) TeamsUtilization(ctx context.Context, resourceType utilization.UtilizationResourceType) ([]*utilization.TeamUtilizationData, error) + VulnerabilityFindings(ctx context.Context, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilityFinding], error) + VulnerabilityFindingSummary(ctx context.Context, filter *v0s.VulnerabilityFindingFilter) (*v0s.VulnerabilityFindingSummary, error) + VulnerabilityCoverage(ctx context.Context, scope *v0s.VulnerabilityScopeInput) (*v0s.VulnerabilityCoverageCounts, error) + Vulnerability(ctx context.Context, identifier string) (*v0s.Vulnerability, error) + VulnerabilitySuppressions(ctx context.Context, filter *v0s.VulnerabilitySuppressionFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilitySuppression], error) ImageVulnerabilityHistory(ctx context.Context, from scalar.Date) (*vulnerability.ImageVulnerabilityHistory, error) VulnerabilitySummary(ctx context.Context, filter *vulnerability.TenantVulnerabilitySummaryFilter) (*vulnerability.TenantVulnerabilitySummary, error) VulnerabilitySummaries(ctx context.Context, first *int, after *pagination.Cursor, last *int, before *pagination.Cursor, filter *vulnerability.TenantVulnerabilitySummaryFilter, orderBy *vulnerability.VulnerabilitySummaryOrder) (*pagination.Connection[*vulnerability.WorkloadVulnerabilitySummary], error) @@ -698,6 +706,20 @@ func (ec *executionContext) field_Mutation_deleteValkey_args(ctx context.Context return args, nil } +func (ec *executionContext) field_Mutation_deleteVulnerabilitySuppressions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (v0s.DeleteVulnerabilitySuppressionsInput, error) { + return ec.unmarshalNDeleteVulnerabilitySuppressionsInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐDeleteVulnerabilitySuppressionsInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_deleteWebhook_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -880,6 +902,20 @@ func (ec *executionContext) field_Mutation_setTeamMemberRole_args(ctx context.Co return args, nil } +func (ec *executionContext) field_Mutation_setVulnerabilitySuppressions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (v0s.SetVulnerabilitySuppressionsInput, error) { + return ec.unmarshalNSetVulnerabilitySuppressionsInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSetVulnerabilitySuppressionsInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_startOpenSearchMaintenance_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1902,6 +1938,64 @@ func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_vulnerabilityCoverage_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "scope", + func(ctx context.Context, v any) (*v0s.VulnerabilityScopeInput, error) { + return ec.unmarshalOVulnerabilityScopeInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityScopeInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["scope"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_vulnerabilityFindingSummary_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + return ec.unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_vulnerabilityFindings_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + return ec.unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*pagination.Cursor, error) { + return ec.unmarshalOCursor2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + func (ec *executionContext) field_Query_vulnerabilityFixHistory_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1984,6 +2078,50 @@ func (ec *executionContext) field_Query_vulnerabilitySummary_args(ctx context.Co return args, nil } +func (ec *executionContext) field_Query_vulnerabilitySuppressions_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "filter", + func(ctx context.Context, v any) (*v0s.VulnerabilitySuppressionFilter, error) { + return ec.unmarshalOVulnerabilitySuppressionFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionFilter(ctx, v) + }) + if err != nil { + return nil, err + } + args["filter"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", + func(ctx context.Context, v any) (*int, error) { + return ec.unmarshalOInt2ᚖint(ctx, v) + }) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "after", + func(ctx context.Context, v any) (*pagination.Cursor, error) { + return ec.unmarshalOCursor2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, v) + }) + if err != nil { + return nil, err + } + args["after"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_vulnerability_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "identifier", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["identifier"] = arg0 + return args, nil +} + func (ec *executionContext) field_Subscription_log_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -4792,6 +4930,94 @@ func (ec *executionContext) fieldContext_Mutation_deleteUnleashInstance(ctx cont return fc, nil } +func (ec *executionContext) _Mutation_setVulnerabilitySuppressions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_setVulnerabilitySuppressions(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().SetVulnerabilitySuppressions(ctx, fc.Args["input"].(v0s.SetVulnerabilitySuppressionsInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.SetVulnerabilitySuppressionsPayload) graphql.Marshaler { + return ec.marshalNSetVulnerabilitySuppressionsPayload2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSetVulnerabilitySuppressionsPayload(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_setVulnerabilitySuppressions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_SetVulnerabilitySuppressionsPayload(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_setVulnerabilitySuppressions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteVulnerabilitySuppressions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_deleteVulnerabilitySuppressions(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().DeleteVulnerabilitySuppressions(ctx, fc.Args["input"].(v0s.DeleteVulnerabilitySuppressionsInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.DeleteVulnerabilitySuppressionsPayload) graphql.Marshaler { + return ec.marshalNDeleteVulnerabilitySuppressionsPayload2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐDeleteVulnerabilitySuppressionsPayload(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_deleteVulnerabilitySuppressions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_DeleteVulnerabilitySuppressionsPayload(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteVulnerabilitySuppressions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Mutation_createValkey(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -5289,7 +5515,7 @@ func (ec *executionContext) _PageInfo_totalCount(ctx context.Context, field grap return ec.fieldContext_PageInfo_totalCount(ctx, field) }, func(ctx context.Context) (any, error) { - return obj.TotalCount, nil + return obj.Count(ctx) }, nil, func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { @@ -5300,7 +5526,7 @@ func (ec *executionContext) _PageInfo_totalCount(ctx context.Context, field grap ) } func (ec *executionContext) fieldContext_PageInfo_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - return graphql.NewScalarFieldContext("PageInfo", field, false, false, errors.New("field of type Int does not have child fields")) + return graphql.NewScalarFieldContext("PageInfo", field, true, false, errors.New("field of type Int does not have child fields")) } func (ec *executionContext) _PageInfo_pageStart(ctx context.Context, field graphql.CollectedField, obj *pagination.PageInfo) (ret graphql.Marshaler) { @@ -6260,6 +6486,226 @@ func (ec *executionContext) fieldContext_Query_teamsUtilization(ctx context.Cont return fc, nil } +func (ec *executionContext) _Query_vulnerabilityFindings(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_vulnerabilityFindings(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().VulnerabilityFindings(ctx, fc.Args["filter"].(*v0s.VulnerabilityFindingFilter), fc.Args["first"].(*int), fc.Args["after"].(*pagination.Cursor)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *pagination.Connection[*v0s.VulnerabilityFinding]) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_vulnerabilityFindings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_vulnerabilityFindings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_vulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_vulnerabilityFindingSummary(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().VulnerabilityFindingSummary(ctx, fc.Args["filter"].(*v0s.VulnerabilityFindingFilter)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityFindingSummary) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingSummary2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingSummary(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_vulnerabilityFindingSummary(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingSummary(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_vulnerabilityFindingSummary_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_vulnerabilityCoverage(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_vulnerabilityCoverage(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().VulnerabilityCoverage(ctx, fc.Args["scope"].(*v0s.VulnerabilityScopeInput)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityCoverageCounts) graphql.Marshaler { + return ec.marshalNVulnerabilityCoverageCounts2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverageCounts(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_vulnerabilityCoverage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityCoverageCounts(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_vulnerabilityCoverage_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_vulnerability(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_vulnerability(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().Vulnerability(ctx, fc.Args["identifier"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.Vulnerability) graphql.Marshaler { + return ec.marshalOVulnerability2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerability(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query_vulnerability(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Vulnerability(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_vulnerability_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_vulnerabilitySuppressions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_vulnerabilitySuppressions(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().VulnerabilitySuppressions(ctx, fc.Args["filter"].(*v0s.VulnerabilitySuppressionFilter), fc.Args["first"].(*int), fc.Args["after"].(*pagination.Cursor)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *pagination.Connection[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppressionConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_vulnerabilitySuppressions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppressionConnection(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_vulnerabilitySuppressions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_imageVulnerabilityHistory(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -6879,6 +7325,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._VulnerabilityUpdatedActivityLogEntry(ctx, sel, obj) + case v0s.VulnerabilitySuppressionActivityLogEntry: + return ec._VulnerabilitySuppressionActivityLogEntry(ctx, sel, &obj) + case *v0s.VulnerabilitySuppressionActivityLogEntry: + if obj == nil { + return graphql.Null + } + return ec._VulnerabilitySuppressionActivityLogEntry(ctx, sel, obj) case valkey.ValkeyUpdatedActivityLogEntry: return ec._ValkeyUpdatedActivityLogEntry(ctx, sel, &obj) case *valkey.ValkeyUpdatedActivityLogEntry: @@ -7647,6 +8100,21 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._WebhookDelivery(ctx, sel, obj) + case *v0s.VulnerabilitySuppression: + if obj == nil { + return graphql.Null + } + return ec._VulnerabilitySuppression(ctx, sel, obj) + case *v0s.VulnerabilityFinding: + if obj == nil { + return graphql.Null + } + return ec._VulnerabilityFinding(ctx, sel, obj) + case *v0s.Vulnerability: + if obj == nil { + return graphql.Null + } + return ec._Vulnerability(ctx, sel, obj) case usersync.UserSyncLogEntry: if obj == nil { return graphql.Null @@ -8350,6 +8818,20 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "setVulnerabilitySuppressions": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_setVulnerabilitySuppressions(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteVulnerabilitySuppressions": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteVulnerabilitySuppressions(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "createValkey": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_createValkey(ctx, field) @@ -8450,31 +8932,62 @@ func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, case "hasNextPage": out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "endCursor": out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) case "hasPreviousPage": out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "startCursor": out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) case "totalCount": - out.Values[i] = ec._PageInfo_totalCount(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._PageInfo_totalCount(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "pageStart": out.Values[i] = ec._PageInfo_pageStart(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "pageEnd": out.Values[i] = ec._PageInfo_pageEnd(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } default: panic("unknown field " + strconv.Quote(field.Name)) @@ -8998,6 +9511,113 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "vulnerabilityFindings": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vulnerabilityFindings(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "vulnerabilityFindingSummary": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vulnerabilityFindingSummary(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "vulnerabilityCoverage": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vulnerabilityCoverage(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "vulnerability": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vulnerability(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "vulnerabilitySuppressions": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_vulnerabilitySuppressions(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "imageVulnerabilityHistory": field := field diff --git a/internal/graph/gengql/v0s.generated.go b/internal/graph/gengql/v0s.generated.go new file mode 100644 index 000000000..9f985c5a5 --- /dev/null +++ b/internal/graph/gengql/v0s.generated.go @@ -0,0 +1,4154 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package gengql + +import ( + "context" + "errors" + "math" + "strconv" + "sync/atomic" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/nais/api/internal/activitylog" + "github.com/nais/api/internal/auth/middleware/github" + "github.com/nais/api/internal/graph/ident" + "github.com/nais/api/internal/graph/pagination" + "github.com/nais/api/internal/graph/scalar" + "github.com/nais/api/internal/slug" + "github.com/nais/api/internal/v0s" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +type VulnerabilityFindingResolver interface { + Vulnerability(ctx context.Context, obj *v0s.VulnerabilityFinding) (*v0s.Vulnerability, error) +} + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _DeleteVulnerabilitySuppressionsPayload_deleted(ctx context.Context, field graphql.CollectedField, obj *v0s.DeleteVulnerabilitySuppressionsPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_DeleteVulnerabilitySuppressionsPayload_deleted(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Deleted, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*v0s.VulnerabilitySuppression) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppression2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_DeleteVulnerabilitySuppressionsPayload_deleted(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteVulnerabilitySuppressionsPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppression(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _SetVulnerabilitySuppressionsPayload_suppressions(ctx context.Context, field graphql.CollectedField, obj *v0s.SetVulnerabilitySuppressionsPayload) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_SetVulnerabilitySuppressionsPayload_suppressions(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Suppressions, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*v0s.VulnerabilitySuppression) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppression2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_SetVulnerabilitySuppressionsPayload_suppressions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SetVulnerabilitySuppressionsPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppression(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Vulnerability_id(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _Vulnerability_identifier(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_identifier(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Identifier, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_identifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Vulnerability_aliases(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_aliases(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Aliases, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_aliases(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Vulnerability_title(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_title(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Title, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Vulnerability_description(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_description(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Description, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Vulnerability_cvss(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_cvss(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cvss, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*v0s.VulnerabilityCvss) graphql.Marshaler { + return ec.marshalNVulnerabilityCvss2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCvssᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_cvss(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vulnerability", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityCvss(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Vulnerability_references(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_references(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.References, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalNString2ᚕstringᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_references(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _Vulnerability_epss(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_epss(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Epss, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityEpss) graphql.Marshaler { + return ec.marshalOVulnerabilityEpss2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityEpss(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_epss(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Vulnerability", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityEpss(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Vulnerability_knownExploited(ctx context.Context, field graphql.CollectedField, obj *v0s.Vulnerability) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Vulnerability_knownExploited(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.KnownExploited, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Vulnerability_knownExploited(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Vulnerability", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverage_status(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverage_status(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Status, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v v0s.VulnerabilityCoverageStatus) graphql.Marshaler { + return ec.marshalNVulnerabilityCoverageStatus2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverageStatus(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverage_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverage", field, false, false, errors.New("field of type VulnerabilityCoverageStatus does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverage_imageName(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverage_imageName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ImageName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverage_imageName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverage", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverage_imageDigest(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverage_imageDigest(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ImageDigest, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverage_imageDigest(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverage", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverage_scannedAt(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverage_scannedAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ScannedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverage_scannedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverage", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverage_error(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverage_error(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Error, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverage_error(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverage", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverageCounts_totalWorkloads(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverageCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverageCounts_totalWorkloads(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TotalWorkloads, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverageCounts_totalWorkloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverageCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverageCounts_scanned(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverageCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverageCounts_scanned(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Scanned, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverageCounts_scanned(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverageCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverageCounts_pending(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverageCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverageCounts_pending(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Pending, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverageCounts_pending(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverageCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverageCounts_noSbom(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverageCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverageCounts_noSbom(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.NoSbom, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverageCounts_noSbom(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverageCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverageCounts_failed(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverageCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverageCounts_failed(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Failed, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverageCounts_failed(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverageCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCoverageCounts_unresolvedImage(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCoverageCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCoverageCounts_unresolvedImage(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.UnresolvedImage, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCoverageCounts_unresolvedImage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCoverageCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCvss_source(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCvss) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCvss_source(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Source, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCvss_source(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCvss", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCvss_version(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCvss) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCvss_version(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Version, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCvss_version(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCvss", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCvss_score(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCvss) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCvss_score(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Score, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *float64) graphql.Marshaler { + return ec.marshalOFloat2ᚖfloat64(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCvss_score(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCvss", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityCvss_vector(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityCvss) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityCvss_vector(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Vector, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityCvss_vector(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityCvss", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityEpss_score(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityEpss) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityEpss_score(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Score, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v float64) graphql.Marshaler { + return ec.marshalNFloat2float64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityEpss_score(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityEpss", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityEpss_date(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityEpss) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityEpss_date(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Date, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v scalar.Date) graphql.Marshaler { + return ec.marshalNDate2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋscalarᚐDate(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityEpss_date(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityEpss", field, false, false, errors.New("field of type Date does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_id(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_workload(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_workload(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Workload, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityWorkloadRef) graphql.Marshaler { + return ec.marshalNVulnerabilityWorkloadRef2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityWorkloadRef(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_workload(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFinding", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityWorkloadRef(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFinding_image(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_image(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Image, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityImage) graphql.Marshaler { + return ec.marshalNVulnerabilityImage2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityImage(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_image(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFinding", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityImage(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFinding_vulnerabilityIdentifier(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_vulnerabilityIdentifier(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.VulnerabilityIdentifier, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_vulnerabilityIdentifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_vulnerability(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_vulnerability(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.VulnerabilityFinding().Vulnerability(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.Vulnerability) graphql.Marshaler { + return ec.marshalOVulnerability2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerability(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_vulnerability(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFinding", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Vulnerability(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFinding_purl(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_purl(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Purl, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_purl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_packageKey(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_packageKey(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PackageKey, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_packageKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_installedVersion(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_installedVersion(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.InstalledVersion, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_installedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_fixedVersion(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_fixedVersion(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.FixedVersion, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_fixedVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_severity(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_severity(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Severity, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v v0s.VulnerabilitySeverity) graphql.Marshaler { + return ec.marshalNVulnerabilitySeverity2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverity(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_severity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type VulnerabilitySeverity does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_severitySource(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_severitySource(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.SeveritySource, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_severitySource(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_dataSource(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_dataSource(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DataSource, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_dataSource(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_epss(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_epss(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Epss, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityEpss) graphql.Marshaler { + return ec.marshalOVulnerabilityEpss2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityEpss(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_epss(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFinding", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityEpss(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFinding_knownExploited(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_knownExploited(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.KnownExploited, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_knownExploited(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFinding", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFinding_suppression(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFinding) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFinding_suppression(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Suppression, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilitySuppression) graphql.Marshaler { + return ec.marshalOVulnerabilitySuppression2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppression(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFinding_suppression(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFinding", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppression(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFindingConnection_edges(ctx context.Context, field graphql.CollectedField, obj *pagination.Connection[*v0s.VulnerabilityFinding]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingConnection_edges(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []pagination.Edge[*v0s.VulnerabilityFinding]) graphql.Marshaler { + return ec.marshalNVulnerabilityFindingEdge2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdgeᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFindingConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFindingEdge(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFindingConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *pagination.Connection[*v0s.VulnerabilityFinding]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingConnection_nodes(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Nodes(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*v0s.VulnerabilityFinding) graphql.Marshaler { + return ec.marshalNVulnerabilityFinding2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingConnection_nodes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFindingConnection", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFinding(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFindingConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *pagination.Connection[*v0s.VulnerabilityFinding]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingConnection_pageInfo(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PageInfo, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v pagination.PageInfo) graphql.Marshaler { + return ec.marshalNPageInfo2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐPageInfo(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFindingConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PageInfo(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFindingEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*v0s.VulnerabilityFinding]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingEdge_cursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v pagination.Cursor) graphql.Marshaler { + return ec.marshalNCursor2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFindingEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFindingEdge_node(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*v0s.VulnerabilityFinding]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingEdge_node(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilityFinding) graphql.Marshaler { + return ec.marshalNVulnerabilityFinding2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFinding(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFindingEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilityFinding(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFindingSummary_totalFindings(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFindingSummary) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingSummary_totalFindings(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TotalFindings, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingSummary_totalFindings(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFindingSummary", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFindingSummary_countsBySeverity(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFindingSummary) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingSummary_countsBySeverity(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CountsBySeverity, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilitySeverityCounts) graphql.Marshaler { + return ec.marshalNVulnerabilitySeverityCounts2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverityCounts(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingSummary_countsBySeverity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilityFindingSummary", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySeverityCounts(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityFindingSummary_fixableFindings(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFindingSummary) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingSummary_fixableFindings(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.FixableFindings, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingSummary_fixableFindings(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFindingSummary", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityFindingSummary_knownExploitedFindings(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityFindingSummary) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityFindingSummary_knownExploitedFindings(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.KnownExploitedFindings, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityFindingSummary_knownExploitedFindings(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityFindingSummary", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityImage_name(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityImage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityImage_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityImage_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityImage", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityImage_digest(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityImage) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityImage_digest(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Digest, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityImage_digest(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityImage", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySeverityCounts_unknown(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySeverityCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySeverityCounts_unknown(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Unknown, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySeverityCounts_unknown(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySeverityCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySeverityCounts_low(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySeverityCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySeverityCounts_low(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Low, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySeverityCounts_low(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySeverityCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySeverityCounts_medium(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySeverityCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySeverityCounts_medium(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Medium, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySeverityCounts_medium(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySeverityCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySeverityCounts_high(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySeverityCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySeverityCounts_high(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.High, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySeverityCounts_high(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySeverityCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySeverityCounts_critical(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySeverityCounts) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySeverityCounts_critical(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Critical, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int64) graphql.Marshaler { + return ec.marshalNInt2int64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySeverityCounts_critical(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySeverityCounts", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_id(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_team(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_team(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Team, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v slug.Slug) graphql.Marshaler { + return ec.marshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_environment(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_environment(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Environment, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_workload(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_workload(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Workload, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_workload(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_imageName(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_imageName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ImageName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_imageName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_packageKey(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_packageKey(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PackageKey, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_packageKey(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_vulnerabilityIdentifier(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_vulnerabilityIdentifier(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.VulnerabilityIdentifier, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_vulnerabilityIdentifier(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_state(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_state(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.State, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v v0s.VulnerabilitySuppressionState) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppressionState2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionState(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_state(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type VulnerabilitySuppressionState does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_reason(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_reason(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Reason, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_updatedBy(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_updatedBy(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.UpdatedBy, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_updatedBy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppression_updatedAt(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppression) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppression_updatedAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.UpdatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppression_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppression", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_id(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v ident.Ident) graphql.Marshaler { + return ec.marshalNID2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋidentᚐIdent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, true, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_actor(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_actor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Actor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_actor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_gitHubActorClaims(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_gitHubActorClaims(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.GitHubActorClaims, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *github.GitHubActorClaims) graphql.Marshaler { + return ec.marshalOGitHubActorClaims2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋauthᚋmiddlewareᚋgithubᚐGitHubActorClaims(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_gitHubActorClaims(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionActivityLogEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_GitHubActorClaims(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_createdAt(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_createdAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CreatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_message(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_message(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Message, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_resourceType(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_resourceType(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResourceType, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v activitylog.ActivityLogEntryResourceType) graphql.Marshaler { + return ec.marshalNActivityLogEntryResourceType2githubᚗcomᚋnaisᚋapiᚋinternalᚋactivitylogᚐActivityLogEntryResourceType(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_resourceType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type ActivityLogEntryResourceType does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_resourceName(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_resourceName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResourceName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_resourceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_teamSlug(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_teamSlug(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TeamSlug, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *slug.Slug) graphql.Marshaler { + return ec.marshalOSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_teamSlug(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_environmentName(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_environmentName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.EnvironmentName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_environmentName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionActivityLogEntry", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry_data(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntry) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntry_data(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Data, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilitySuppressionActivityLogEntryData) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppressionActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionActivityLogEntryData(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntry_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionActivityLogEntry", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppressionActivityLogEntryData(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntryData_assessment(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilitySuppressionActivityLogEntryData) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionActivityLogEntryData_assessment(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Assessment, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilitySuppression) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppression2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppression(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionActivityLogEntryData_assessment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionActivityLogEntryData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppression(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilitySuppressionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *pagination.Connection[*v0s.VulnerabilitySuppression]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionConnection_edges(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Edges, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []pagination.Edge[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppressionEdge2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdgeᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppressionEdge(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilitySuppressionConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *pagination.Connection[*v0s.VulnerabilitySuppression]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionConnection_nodes(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Nodes(), nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*v0s.VulnerabilitySuppression) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppression2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionConnection_nodes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionConnection", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppression(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilitySuppressionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *pagination.Connection[*v0s.VulnerabilitySuppression]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionConnection_pageInfo(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PageInfo, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v pagination.PageInfo) graphql.Marshaler { + return ec.marshalNPageInfo2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐPageInfo(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_PageInfo(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilitySuppressionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*v0s.VulnerabilitySuppression]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionEdge_cursor(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Cursor, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v pagination.Cursor) graphql.Marshaler { + return ec.marshalNCursor2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐCursor(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilitySuppressionEdge", field, false, false, errors.New("field of type Cursor does not have child fields")) +} + +func (ec *executionContext) _VulnerabilitySuppressionEdge_node(ctx context.Context, field graphql.CollectedField, obj *pagination.Edge[*v0s.VulnerabilitySuppression]) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilitySuppressionEdge_node(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Node, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *v0s.VulnerabilitySuppression) graphql.Marshaler { + return ec.marshalNVulnerabilitySuppression2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppression(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilitySuppressionEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "VulnerabilitySuppressionEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_VulnerabilitySuppression(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _VulnerabilityWorkloadRef_team(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityWorkloadRef) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityWorkloadRef_team(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Team, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v slug.Slug) graphql.Marshaler { + return ec.marshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityWorkloadRef_team(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityWorkloadRef", field, false, false, errors.New("field of type Slug does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityWorkloadRef_environment(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityWorkloadRef) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityWorkloadRef_environment(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Environment, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityWorkloadRef_environment(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityWorkloadRef", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _VulnerabilityWorkloadRef_name(ctx context.Context, field graphql.CollectedField, obj *v0s.VulnerabilityWorkloadRef) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_VulnerabilityWorkloadRef_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_VulnerabilityWorkloadRef_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("VulnerabilityWorkloadRef", field, false, false, errors.New("field of type String does not have child fields")) +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputDeleteVulnerabilitySuppressionsInput(ctx context.Context, obj any) (v0s.DeleteVulnerabilitySuppressionsInput, error) { + var it v0s.DeleteVulnerabilitySuppressionsInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"team", "keys"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "team": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("team")) + data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.Team = data + case "keys": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keys")) + data, err := ec.unmarshalNVulnerabilitySuppressionKeyInput2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionKeyInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Keys = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputNewVulnerabilitySuppressionInput(ctx context.Context, obj any) (v0s.NewVulnerabilitySuppressionInput, error) { + var it v0s.NewVulnerabilitySuppressionInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"key", "state", "reason"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "key": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) + data, err := ec.unmarshalNVulnerabilitySuppressionKeyInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionKeyInput(ctx, v) + if err != nil { + return it, err + } + it.Key = data + case "state": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) + data, err := ec.unmarshalNVulnerabilitySuppressionState2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionState(ctx, v) + if err != nil { + return it, err + } + it.State = data + case "reason": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reason")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Reason = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputSetVulnerabilitySuppressionsInput(ctx context.Context, obj any) (v0s.SetVulnerabilitySuppressionsInput, error) { + var it v0s.SetVulnerabilitySuppressionsInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"team", "items"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "team": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("team")) + data, err := ec.unmarshalNSlug2githubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.Team = data + case "items": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("items")) + data, err := ec.unmarshalNNewVulnerabilitySuppressionInput2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐNewVulnerabilitySuppressionInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Items = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputVulnerabilityFindingFilter(ctx context.Context, obj any) (v0s.VulnerabilityFindingFilter, error) { + var it v0s.VulnerabilityFindingFilter + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + if _, present := asMap["onlyWithFix"]; !present { + asMap["onlyWithFix"] = false + } + if _, present := asMap["onlyKnownExploited"]; !present { + asMap["onlyKnownExploited"] = false + } + if _, present := asMap["suppressed"]; !present { + asMap["suppressed"] = "EXCLUDE" + } + + fieldsInOrder := [...]string{"scope", "vulnerabilityIdentifier", "package", "severities", "onlyWithFix", "onlyKnownExploited", "suppressed"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "scope": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("scope")) + data, err := ec.unmarshalOVulnerabilityScopeInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityScopeInput(ctx, v) + if err != nil { + return it, err + } + it.Scope = data + case "vulnerabilityIdentifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vulnerabilityIdentifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VulnerabilityIdentifier = data + case "package": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Package = data + case "severities": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("severities")) + data, err := ec.unmarshalOVulnerabilitySeverity2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverityᚄ(ctx, v) + if err != nil { + return it, err + } + it.Severities = data + case "onlyWithFix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyWithFix")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.OnlyWithFix = data + case "onlyKnownExploited": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyKnownExploited")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.OnlyKnownExploited = data + case "suppressed": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("suppressed")) + data, err := ec.unmarshalOSuppressedFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSuppressedFilter(ctx, v) + if err != nil { + return it, err + } + it.Suppressed = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputVulnerabilityScopeInput(ctx context.Context, obj any) (v0s.VulnerabilityScopeInput, error) { + var it v0s.VulnerabilityScopeInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"team", "environment", "workload"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "team": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("team")) + data, err := ec.unmarshalOSlug2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋslugᚐSlug(ctx, v) + if err != nil { + return it, err + } + it.Team = data + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Environment = data + case "workload": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("workload")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Workload = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputVulnerabilitySuppressionFilter(ctx context.Context, obj any) (v0s.VulnerabilitySuppressionFilter, error) { + var it v0s.VulnerabilitySuppressionFilter + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"scope", "vulnerabilityIdentifier", "imageName"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "scope": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("scope")) + data, err := ec.unmarshalOVulnerabilityScopeInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityScopeInput(ctx, v) + if err != nil { + return it, err + } + it.Scope = data + case "vulnerabilityIdentifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vulnerabilityIdentifier")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.VulnerabilityIdentifier = data + case "imageName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("imageName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ImageName = data + } + } + return it, nil +} + +func (ec *executionContext) unmarshalInputVulnerabilitySuppressionKeyInput(ctx context.Context, obj any) (v0s.VulnerabilitySuppressionKeyInput, error) { + var it v0s.VulnerabilitySuppressionKeyInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"environment", "workload", "imageName", "packageKey", "vulnerabilityIdentifier"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "environment": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("environment")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Environment = data + case "workload": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("workload")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Workload = data + case "imageName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("imageName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.ImageName = data + case "packageKey": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("packageKey")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.PackageKey = data + case "vulnerabilityIdentifier": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vulnerabilityIdentifier")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.VulnerabilityIdentifier = data + } + } + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var deleteVulnerabilitySuppressionsPayloadImplementors = []string{"DeleteVulnerabilitySuppressionsPayload"} + +func (ec *executionContext) _DeleteVulnerabilitySuppressionsPayload(ctx context.Context, sel ast.SelectionSet, obj *v0s.DeleteVulnerabilitySuppressionsPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteVulnerabilitySuppressionsPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DeleteVulnerabilitySuppressionsPayload") + case "deleted": + out.Values[i] = ec._DeleteVulnerabilitySuppressionsPayload_deleted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var setVulnerabilitySuppressionsPayloadImplementors = []string{"SetVulnerabilitySuppressionsPayload"} + +func (ec *executionContext) _SetVulnerabilitySuppressionsPayload(ctx context.Context, sel ast.SelectionSet, obj *v0s.SetVulnerabilitySuppressionsPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, setVulnerabilitySuppressionsPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SetVulnerabilitySuppressionsPayload") + case "suppressions": + out.Values[i] = ec._SetVulnerabilitySuppressionsPayload_suppressions(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityImplementors = []string{"Vulnerability", "Node"} + +func (ec *executionContext) _Vulnerability(ctx context.Context, sel ast.SelectionSet, obj *v0s.Vulnerability) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Vulnerability") + case "id": + out.Values[i] = ec._Vulnerability_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "identifier": + out.Values[i] = ec._Vulnerability_identifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "aliases": + out.Values[i] = ec._Vulnerability_aliases(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._Vulnerability_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec._Vulnerability_description(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "cvss": + out.Values[i] = ec._Vulnerability_cvss(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "references": + out.Values[i] = ec._Vulnerability_references(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "epss": + out.Values[i] = ec._Vulnerability_epss(ctx, field, obj) + case "knownExploited": + out.Values[i] = ec._Vulnerability_knownExploited(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityCoverageImplementors = []string{"VulnerabilityCoverage"} + +func (ec *executionContext) _VulnerabilityCoverage(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityCoverage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityCoverageImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityCoverage") + case "status": + out.Values[i] = ec._VulnerabilityCoverage_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "imageName": + out.Values[i] = ec._VulnerabilityCoverage_imageName(ctx, field, obj) + case "imageDigest": + out.Values[i] = ec._VulnerabilityCoverage_imageDigest(ctx, field, obj) + case "scannedAt": + out.Values[i] = ec._VulnerabilityCoverage_scannedAt(ctx, field, obj) + case "error": + out.Values[i] = ec._VulnerabilityCoverage_error(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityCoverageCountsImplementors = []string{"VulnerabilityCoverageCounts"} + +func (ec *executionContext) _VulnerabilityCoverageCounts(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityCoverageCounts) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityCoverageCountsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityCoverageCounts") + case "totalWorkloads": + out.Values[i] = ec._VulnerabilityCoverageCounts_totalWorkloads(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "scanned": + out.Values[i] = ec._VulnerabilityCoverageCounts_scanned(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pending": + out.Values[i] = ec._VulnerabilityCoverageCounts_pending(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "noSbom": + out.Values[i] = ec._VulnerabilityCoverageCounts_noSbom(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "failed": + out.Values[i] = ec._VulnerabilityCoverageCounts_failed(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "unresolvedImage": + out.Values[i] = ec._VulnerabilityCoverageCounts_unresolvedImage(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityCvssImplementors = []string{"VulnerabilityCvss"} + +func (ec *executionContext) _VulnerabilityCvss(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityCvss) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityCvssImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityCvss") + case "source": + out.Values[i] = ec._VulnerabilityCvss_source(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "version": + out.Values[i] = ec._VulnerabilityCvss_version(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "score": + out.Values[i] = ec._VulnerabilityCvss_score(ctx, field, obj) + case "vector": + out.Values[i] = ec._VulnerabilityCvss_vector(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityEpssImplementors = []string{"VulnerabilityEpss"} + +func (ec *executionContext) _VulnerabilityEpss(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityEpss) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityEpssImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityEpss") + case "score": + out.Values[i] = ec._VulnerabilityEpss_score(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "date": + out.Values[i] = ec._VulnerabilityEpss_date(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityFindingImplementors = []string{"VulnerabilityFinding", "Node"} + +func (ec *executionContext) _VulnerabilityFinding(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityFinding) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityFindingImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityFinding") + case "id": + out.Values[i] = ec._VulnerabilityFinding_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "workload": + out.Values[i] = ec._VulnerabilityFinding_workload(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "image": + out.Values[i] = ec._VulnerabilityFinding_image(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "vulnerabilityIdentifier": + out.Values[i] = ec._VulnerabilityFinding_vulnerabilityIdentifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "vulnerability": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._VulnerabilityFinding_vulnerability(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "purl": + out.Values[i] = ec._VulnerabilityFinding_purl(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "packageKey": + out.Values[i] = ec._VulnerabilityFinding_packageKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "installedVersion": + out.Values[i] = ec._VulnerabilityFinding_installedVersion(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "fixedVersion": + out.Values[i] = ec._VulnerabilityFinding_fixedVersion(ctx, field, obj) + case "severity": + out.Values[i] = ec._VulnerabilityFinding_severity(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "severitySource": + out.Values[i] = ec._VulnerabilityFinding_severitySource(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "dataSource": + out.Values[i] = ec._VulnerabilityFinding_dataSource(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "epss": + out.Values[i] = ec._VulnerabilityFinding_epss(ctx, field, obj) + case "knownExploited": + out.Values[i] = ec._VulnerabilityFinding_knownExploited(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "suppression": + out.Values[i] = ec._VulnerabilityFinding_suppression(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityFindingConnectionImplementors = []string{"VulnerabilityFindingConnection"} + +func (ec *executionContext) _VulnerabilityFindingConnection(ctx context.Context, sel ast.SelectionSet, obj *pagination.Connection[*v0s.VulnerabilityFinding]) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityFindingConnectionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityFindingConnection") + case "edges": + out.Values[i] = ec._VulnerabilityFindingConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nodes": + out.Values[i] = ec._VulnerabilityFindingConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._VulnerabilityFindingConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityFindingEdgeImplementors = []string{"VulnerabilityFindingEdge"} + +func (ec *executionContext) _VulnerabilityFindingEdge(ctx context.Context, sel ast.SelectionSet, obj *pagination.Edge[*v0s.VulnerabilityFinding]) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityFindingEdgeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityFindingEdge") + case "cursor": + out.Values[i] = ec._VulnerabilityFindingEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._VulnerabilityFindingEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityFindingSummaryImplementors = []string{"VulnerabilityFindingSummary"} + +func (ec *executionContext) _VulnerabilityFindingSummary(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityFindingSummary) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityFindingSummaryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityFindingSummary") + case "totalFindings": + out.Values[i] = ec._VulnerabilityFindingSummary_totalFindings(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "countsBySeverity": + out.Values[i] = ec._VulnerabilityFindingSummary_countsBySeverity(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "fixableFindings": + out.Values[i] = ec._VulnerabilityFindingSummary_fixableFindings(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "knownExploitedFindings": + out.Values[i] = ec._VulnerabilityFindingSummary_knownExploitedFindings(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityImageImplementors = []string{"VulnerabilityImage"} + +func (ec *executionContext) _VulnerabilityImage(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityImage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityImageImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityImage") + case "name": + out.Values[i] = ec._VulnerabilityImage_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "digest": + out.Values[i] = ec._VulnerabilityImage_digest(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilitySeverityCountsImplementors = []string{"VulnerabilitySeverityCounts"} + +func (ec *executionContext) _VulnerabilitySeverityCounts(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilitySeverityCounts) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilitySeverityCountsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilitySeverityCounts") + case "unknown": + out.Values[i] = ec._VulnerabilitySeverityCounts_unknown(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "low": + out.Values[i] = ec._VulnerabilitySeverityCounts_low(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "medium": + out.Values[i] = ec._VulnerabilitySeverityCounts_medium(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "high": + out.Values[i] = ec._VulnerabilitySeverityCounts_high(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "critical": + out.Values[i] = ec._VulnerabilitySeverityCounts_critical(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilitySuppressionImplementors = []string{"VulnerabilitySuppression", "Node"} + +func (ec *executionContext) _VulnerabilitySuppression(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilitySuppression) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilitySuppressionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilitySuppression") + case "id": + out.Values[i] = ec._VulnerabilitySuppression_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "team": + out.Values[i] = ec._VulnerabilitySuppression_team(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environment": + out.Values[i] = ec._VulnerabilitySuppression_environment(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "workload": + out.Values[i] = ec._VulnerabilitySuppression_workload(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "imageName": + out.Values[i] = ec._VulnerabilitySuppression_imageName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "packageKey": + out.Values[i] = ec._VulnerabilitySuppression_packageKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "vulnerabilityIdentifier": + out.Values[i] = ec._VulnerabilitySuppression_vulnerabilityIdentifier(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "state": + out.Values[i] = ec._VulnerabilitySuppression_state(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "reason": + out.Values[i] = ec._VulnerabilitySuppression_reason(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedBy": + out.Values[i] = ec._VulnerabilitySuppression_updatedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedAt": + out.Values[i] = ec._VulnerabilitySuppression_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilitySuppressionActivityLogEntryImplementors = []string{"VulnerabilitySuppressionActivityLogEntry", "ActivityLogEntry", "Node"} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntry(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilitySuppressionActivityLogEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilitySuppressionActivityLogEntryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilitySuppressionActivityLogEntry") + case "id": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actor": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_actor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "gitHubActorClaims": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_gitHubActorClaims(ctx, field, obj) + case "createdAt": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceType": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_resourceType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resourceName": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_resourceName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamSlug": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_teamSlug(ctx, field, obj) + case "environmentName": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_environmentName(ctx, field, obj) + case "data": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntry_data(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilitySuppressionActivityLogEntryDataImplementors = []string{"VulnerabilitySuppressionActivityLogEntryData"} + +func (ec *executionContext) _VulnerabilitySuppressionActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilitySuppressionActivityLogEntryData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilitySuppressionActivityLogEntryDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilitySuppressionActivityLogEntryData") + case "assessment": + out.Values[i] = ec._VulnerabilitySuppressionActivityLogEntryData_assessment(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilitySuppressionConnectionImplementors = []string{"VulnerabilitySuppressionConnection"} + +func (ec *executionContext) _VulnerabilitySuppressionConnection(ctx context.Context, sel ast.SelectionSet, obj *pagination.Connection[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilitySuppressionConnectionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilitySuppressionConnection") + case "edges": + out.Values[i] = ec._VulnerabilitySuppressionConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nodes": + out.Values[i] = ec._VulnerabilitySuppressionConnection_nodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._VulnerabilitySuppressionConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilitySuppressionEdgeImplementors = []string{"VulnerabilitySuppressionEdge"} + +func (ec *executionContext) _VulnerabilitySuppressionEdge(ctx context.Context, sel ast.SelectionSet, obj *pagination.Edge[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilitySuppressionEdgeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilitySuppressionEdge") + case "cursor": + out.Values[i] = ec._VulnerabilitySuppressionEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._VulnerabilitySuppressionEdge_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var vulnerabilityWorkloadRefImplementors = []string{"VulnerabilityWorkloadRef"} + +func (ec *executionContext) _VulnerabilityWorkloadRef(ctx context.Context, sel ast.SelectionSet, obj *v0s.VulnerabilityWorkloadRef) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, vulnerabilityWorkloadRefImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("VulnerabilityWorkloadRef") + case "team": + out.Values[i] = ec._VulnerabilityWorkloadRef_team(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environment": + out.Values[i] = ec._VulnerabilityWorkloadRef_environment(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._VulnerabilityWorkloadRef_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) unmarshalNDeleteVulnerabilitySuppressionsInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐDeleteVulnerabilitySuppressionsInput(ctx context.Context, v any) (v0s.DeleteVulnerabilitySuppressionsInput, error) { + res, err := ec.unmarshalInputDeleteVulnerabilitySuppressionsInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDeleteVulnerabilitySuppressionsPayload2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐDeleteVulnerabilitySuppressionsPayload(ctx context.Context, sel ast.SelectionSet, v v0s.DeleteVulnerabilitySuppressionsPayload) graphql.Marshaler { + return ec._DeleteVulnerabilitySuppressionsPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDeleteVulnerabilitySuppressionsPayload2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐDeleteVulnerabilitySuppressionsPayload(ctx context.Context, sel ast.SelectionSet, v *v0s.DeleteVulnerabilitySuppressionsPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DeleteVulnerabilitySuppressionsPayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNNewVulnerabilitySuppressionInput2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐNewVulnerabilitySuppressionInputᚄ(ctx context.Context, v any) ([]*v0s.NewVulnerabilitySuppressionInput, error) { + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*v0s.NewVulnerabilitySuppressionInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNNewVulnerabilitySuppressionInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐNewVulnerabilitySuppressionInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNNewVulnerabilitySuppressionInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐNewVulnerabilitySuppressionInput(ctx context.Context, v any) (*v0s.NewVulnerabilitySuppressionInput, error) { + res, err := ec.unmarshalInputNewVulnerabilitySuppressionInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNSetVulnerabilitySuppressionsInput2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSetVulnerabilitySuppressionsInput(ctx context.Context, v any) (v0s.SetVulnerabilitySuppressionsInput, error) { + res, err := ec.unmarshalInputSetVulnerabilitySuppressionsInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNSetVulnerabilitySuppressionsPayload2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSetVulnerabilitySuppressionsPayload(ctx context.Context, sel ast.SelectionSet, v v0s.SetVulnerabilitySuppressionsPayload) graphql.Marshaler { + return ec._SetVulnerabilitySuppressionsPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNSetVulnerabilitySuppressionsPayload2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSetVulnerabilitySuppressionsPayload(ctx context.Context, sel ast.SelectionSet, v *v0s.SetVulnerabilitySuppressionsPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._SetVulnerabilitySuppressionsPayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilityCoverage2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverage(ctx context.Context, sel ast.SelectionSet, v v0s.VulnerabilityCoverage) graphql.Marshaler { + return ec._VulnerabilityCoverage(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilityCoverage2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverage(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityCoverage) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityCoverage(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilityCoverageCounts2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverageCounts(ctx context.Context, sel ast.SelectionSet, v v0s.VulnerabilityCoverageCounts) graphql.Marshaler { + return ec._VulnerabilityCoverageCounts(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilityCoverageCounts2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverageCounts(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityCoverageCounts) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityCoverageCounts(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNVulnerabilityCoverageStatus2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverageStatus(ctx context.Context, v any) (v0s.VulnerabilityCoverageStatus, error) { + var res v0s.VulnerabilityCoverageStatus + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNVulnerabilityCoverageStatus2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCoverageStatus(ctx context.Context, sel ast.SelectionSet, v v0s.VulnerabilityCoverageStatus) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNVulnerabilityCvss2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCvssᚄ(ctx context.Context, sel ast.SelectionSet, v []*v0s.VulnerabilityCvss) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNVulnerabilityCvss2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCvss(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNVulnerabilityCvss2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityCvss(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityCvss) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityCvss(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilityFinding2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingᚄ(ctx context.Context, sel ast.SelectionSet, v []*v0s.VulnerabilityFinding) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNVulnerabilityFinding2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFinding(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNVulnerabilityFinding2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFinding(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityFinding) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityFinding(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilityFindingConnection2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx context.Context, sel ast.SelectionSet, v pagination.Connection[*v0s.VulnerabilityFinding]) graphql.Marshaler { + return ec._VulnerabilityFindingConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilityFindingConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx context.Context, sel ast.SelectionSet, v *pagination.Connection[*v0s.VulnerabilityFinding]) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityFindingConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilityFindingEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx context.Context, sel ast.SelectionSet, v pagination.Edge[*v0s.VulnerabilityFinding]) graphql.Marshaler { + return ec._VulnerabilityFindingEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilityFindingEdge2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []pagination.Edge[*v0s.VulnerabilityFinding]) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNVulnerabilityFindingEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNVulnerabilityFindingSummary2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingSummary(ctx context.Context, sel ast.SelectionSet, v v0s.VulnerabilityFindingSummary) graphql.Marshaler { + return ec._VulnerabilityFindingSummary(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilityFindingSummary2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingSummary(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityFindingSummary) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityFindingSummary(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilityImage2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityImage(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityImage) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityImage(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNVulnerabilitySeverity2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverity(ctx context.Context, v any) (v0s.VulnerabilitySeverity, error) { + var res v0s.VulnerabilitySeverity + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNVulnerabilitySeverity2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverity(ctx context.Context, sel ast.SelectionSet, v v0s.VulnerabilitySeverity) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNVulnerabilitySeverityCounts2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverityCounts(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilitySeverityCounts) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilitySeverityCounts(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilitySuppression2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionᚄ(ctx context.Context, sel ast.SelectionSet, v []*v0s.VulnerabilitySuppression) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNVulnerabilitySuppression2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppression(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNVulnerabilitySuppression2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppression(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilitySuppression) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilitySuppression(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilitySuppressionActivityLogEntryData2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionActivityLogEntryData(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilitySuppressionActivityLogEntryData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilitySuppressionActivityLogEntryData(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilitySuppressionConnection2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx context.Context, sel ast.SelectionSet, v pagination.Connection[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + return ec._VulnerabilitySuppressionConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilitySuppressionConnection2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐConnection(ctx context.Context, sel ast.SelectionSet, v *pagination.Connection[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilitySuppressionConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNVulnerabilitySuppressionEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx context.Context, sel ast.SelectionSet, v pagination.Edge[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + return ec._VulnerabilitySuppressionEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNVulnerabilitySuppressionEdge2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []pagination.Edge[*v0s.VulnerabilitySuppression]) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNVulnerabilitySuppressionEdge2githubᚗcomᚋnaisᚋapiᚋinternalᚋgraphᚋpaginationᚐEdge(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNVulnerabilitySuppressionKeyInput2ᚕᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionKeyInputᚄ(ctx context.Context, v any) ([]*v0s.VulnerabilitySuppressionKeyInput, error) { + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*v0s.VulnerabilitySuppressionKeyInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNVulnerabilitySuppressionKeyInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionKeyInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNVulnerabilitySuppressionKeyInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionKeyInput(ctx context.Context, v any) (*v0s.VulnerabilitySuppressionKeyInput, error) { + res, err := ec.unmarshalInputVulnerabilitySuppressionKeyInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNVulnerabilitySuppressionState2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionState(ctx context.Context, v any) (v0s.VulnerabilitySuppressionState, error) { + var res v0s.VulnerabilitySuppressionState + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNVulnerabilitySuppressionState2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionState(ctx context.Context, sel ast.SelectionSet, v v0s.VulnerabilitySuppressionState) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNVulnerabilityWorkloadRef2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityWorkloadRef(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityWorkloadRef) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._VulnerabilityWorkloadRef(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOSuppressedFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSuppressedFilter(ctx context.Context, v any) (*v0s.SuppressedFilter, error) { + if v == nil { + return nil, nil + } + var res = new(v0s.SuppressedFilter) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOSuppressedFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐSuppressedFilter(ctx context.Context, sel ast.SelectionSet, v *v0s.SuppressedFilter) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) marshalOVulnerability2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerability(ctx context.Context, sel ast.SelectionSet, v *v0s.Vulnerability) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Vulnerability(ctx, sel, v) +} + +func (ec *executionContext) marshalOVulnerabilityEpss2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityEpss(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilityEpss) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._VulnerabilityEpss(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOVulnerabilityFindingFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityFindingFilter(ctx context.Context, v any) (*v0s.VulnerabilityFindingFilter, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputVulnerabilityFindingFilter(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOVulnerabilityScopeInput2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilityScopeInput(ctx context.Context, v any) (*v0s.VulnerabilityScopeInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputVulnerabilityScopeInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOVulnerabilitySeverity2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverityᚄ(ctx context.Context, v any) ([]v0s.VulnerabilitySeverity, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]v0s.VulnerabilitySeverity, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNVulnerabilitySeverity2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverity(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOVulnerabilitySeverity2ᚕgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverityᚄ(ctx context.Context, sel ast.SelectionSet, v []v0s.VulnerabilitySeverity) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNVulnerabilitySeverity2githubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySeverity(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalOVulnerabilitySuppression2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppression(ctx context.Context, sel ast.SelectionSet, v *v0s.VulnerabilitySuppression) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._VulnerabilitySuppression(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOVulnerabilitySuppressionFilter2ᚖgithubᚗcomᚋnaisᚋapiᚋinternalᚋv0sᚐVulnerabilitySuppressionFilter(ctx context.Context, v any) (*v0s.VulnerabilitySuppressionFilter, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputVulnerabilitySuppressionFilter(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/internal/graph/pagination/cursor.go b/internal/graph/pagination/cursor.go index 92e885d62..c037cce1d 100644 --- a/internal/graph/pagination/cursor.go +++ b/internal/graph/pagination/cursor.go @@ -14,10 +14,18 @@ import ( var cursorVersions = map[string]func(c *Cursor, i []byte) error{ "v1": parseCursorV1, + "v0s1": func(c *Cursor, token []byte) error { + if len(token) == 0 || len(token) > 16384 { + return apierror.Errorf("Invalid vulnerability cursor") + } + c.Opaque = string(token) + return nil + }, } type Cursor struct { - Offset int `json:"offset"` + Offset int `json:"offset"` + Opaque string `json:"-"` empty bool } @@ -27,7 +35,11 @@ func (c *Cursor) valid() bool { func (c Cursor) MarshalGQLContext(_ context.Context, w io.Writer) error { b := []byte{'v', '1', ':'} - b = strconv.AppendInt(b, int64(c.Offset), 10) + if c.Opaque != "" { + b = append([]byte("v0s1:"), c.Opaque...) + } else { + b = strconv.AppendInt(b, int64(c.Offset), 10) + } _, _ = w.Write([]byte{'"'}) _, err := w.Write([]byte(base58.Encode(b))) @@ -36,6 +48,7 @@ func (c Cursor) MarshalGQLContext(_ context.Context, w io.Writer) error { } func (c *Cursor) UnmarshalGQLContext(_ context.Context, v any) error { + *c = Cursor{} if s, ok := v.(string); ok { if s == "" { c.empty = true diff --git a/internal/graph/pagination/cursor_test.go b/internal/graph/pagination/cursor_test.go index 64b46790b..24e290afd 100644 --- a/internal/graph/pagination/cursor_test.go +++ b/internal/graph/pagination/cursor_test.go @@ -3,12 +3,35 @@ package pagination import ( "bytes" "context" + "encoding/json" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" ) +func TestOpaqueVulnerabilityCursorDoesNotChangeOffsetPagination(t *testing.T) { + cursor := Cursor{Opaque: "opaque-v0s-page"} + var buffer bytes.Buffer + if err := cursor.MarshalGQLContext(t.Context(), &buffer); err != nil { + t.Fatal(err) + } + var encoded string + if err := json.Unmarshal(buffer.Bytes(), &encoded); err != nil { + t.Fatal(err) + } + parsed := Cursor{Offset: 13} + if err := parsed.UnmarshalGQLContext(t.Context(), encoded); err != nil || parsed.Opaque != cursor.Opaque || parsed.Offset != 0 { + t.Fatalf("opaque cursor roundtrip: %+v, %v", parsed, err) + } + if _, err := ParsePage(new(1), &parsed, nil, nil); err == nil { + t.Fatal("vulnerability cursor was accepted by legacy offset pagination") + } + if err := parsed.UnmarshalGQLContext(t.Context(), "ELQhtKc"); err != nil || parsed.Offset != 13 || parsed.Opaque != "" { + t.Fatalf("legacy cursor roundtrip changed: %+v, %v", parsed, err) + } +} + func TestCursor_MarshalGQLContext(t *testing.T) { tests := map[string]struct { c Cursor diff --git a/internal/graph/pagination/models.go b/internal/graph/pagination/models.go index 3e5980dad..75efd6c7d 100644 --- a/internal/graph/pagination/models.go +++ b/internal/graph/pagination/models.go @@ -1,5 +1,7 @@ package pagination +import "context" + type Edge[T any] struct { Node T `json:"node"` Cursor Cursor `json:"cursor"` @@ -19,11 +21,20 @@ func (c *Connection[T]) Nodes() []T { } type PageInfo struct { - TotalCount int `json:"totalCount"` - HasNextPage bool `json:"hasNextPage"` - HasPreviousPage bool `json:"hasPreviousPage"` - StartCursor *Cursor `json:"startCursor"` - EndCursor *Cursor `json:"endCursor"` + TotalCount int `json:"totalCount"` + HasNextPage bool `json:"hasNextPage"` + HasPreviousPage bool `json:"hasPreviousPage"` + StartCursor *Cursor `json:"startCursor"` + EndCursor *Cursor `json:"endCursor"` + CountLoader func(context.Context) (int, error) `json:"-"` +} + +// Count resolves a deferred total, or returns the total supplied with the page. +func (p *PageInfo) Count(ctx context.Context) (int, error) { + if p.CountLoader != nil { + return p.CountLoader(ctx) + } + return p.TotalCount, nil } func (p *PageInfo) PageStart() int { diff --git a/internal/graph/pagination/relay.go b/internal/graph/pagination/relay.go index 8bbed1c11..330e65c03 100644 --- a/internal/graph/pagination/relay.go +++ b/internal/graph/pagination/relay.go @@ -44,6 +44,9 @@ func (p *Pagination) resultLimit() int32 { } func ParsePage(first *int, after *Cursor, last *int, before *Cursor) (*Pagination, error) { + if (after != nil && after.Opaque != "") || (before != nil && before.Opaque != "") { + return nil, apierror.Errorf("Vulnerability cursors cannot be used with offset pagination") + } p := &Pagination{} if first != nil && last != nil { diff --git a/internal/graph/schema/v0s.graphqls b/internal/graph/schema/v0s.graphqls new file mode 100644 index 000000000..7c6afb741 --- /dev/null +++ b/internal/graph/schema/v0s.graphqls @@ -0,0 +1,497 @@ +extend type Query { + "Current vulnerability findings for deployed applications and jobs." + vulnerabilityFindings( + "Filter the full finding selection." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over the full filtered selection, not just the loaded page." + vulnerabilityFindingSummary( + "Filter the full finding selection." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed applications and jobs." + vulnerabilityCoverage( + "Limit coverage to a team, environment or workload. Omitted scope is tenant-wide." + scope: VulnerabilityScopeInput + ): VulnerabilityCoverageCounts! + "Advisory details for a vulnerability identifier or alias. Unknown identifiers return null." + vulnerability( + "The vulnerability identifier or an alias identifying exactly one vulnerability." + identifier: String! + ): Vulnerability + "Current workload assessments, including assessments without active findings." + vulnerabilitySuppressions( + "Filter the assessment selection." + filter: VulnerabilitySuppressionFilter + "Get the first n assessments, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilitySuppressionConnection! +} + +extend interface Workload { + "Current vulnerability findings in the deployed image." + vulnerabilityFindings( + "Filter this workload's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over this workload's full filtered finding selection." + vulnerabilityFindingSummary( + "Filter this workload's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed image." + vulnerabilityCoverage: VulnerabilityCoverage! +} + +extend type Application { + "Current vulnerability findings in the deployed image." + vulnerabilityFindings( + "Filter this application's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over this application's full filtered finding selection." + vulnerabilityFindingSummary( + "Filter this application's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed image." + vulnerabilityCoverage: VulnerabilityCoverage! +} + +extend type Job { + "Current vulnerability findings in the deployed image." + vulnerabilityFindings( + "Filter this job's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + "Get the first n findings, between 1 and 200. Defaults to 20." + first: Int + "Continue after this cursor, using the same filter." + after: Cursor + ): VulnerabilityFindingConnection! + "Counts over this job's full filtered finding selection." + vulnerabilityFindingSummary( + "Filter this job's findings. Do not provide scope." + filter: VulnerabilityFindingFilter + ): VulnerabilityFindingSummary! + "Scan coverage of the currently deployed image." + vulnerabilityCoverage: VulnerabilityCoverage! +} + +"Limit a tenant-wide selection. A workload name requires both team and environment." +input VulnerabilityScopeInput { + "The team owning the workload." + team: Slug + "The environment where the workload is deployed." + environment: String + "The application or job name." + workload: String +} + +"Filters applied before finding pagination and aggregation." +input VulnerabilityFindingFilter { + "Limit a root query to a team, environment or workload. Workload fields are already scoped." + scope: VulnerabilityScopeInput + "Match a vulnerability identifier or alias." + vulnerabilityIdentifier: String + "Match a full package URL, or a version-independent package key." + package: String + "Include only findings with these severities." + severities: [VulnerabilitySeverity!] + "Include only findings with a known fixed version." + onlyWithFix: Boolean = false + "Include only vulnerabilities listed in CISA KEV." + onlyKnownExploited: Boolean = false + "Whether assessed findings are included." + suppressed: SuppressedFilter = EXCLUDE +} + +"How workload assessments affect the finding selection." +enum SuppressedFilter { + "Exclude findings with an assessment." + EXCLUDE + "Include both assessed and unassessed findings." + INCLUDE + "Include only findings with an assessment." + ONLY +} + +"Severity reported by the finding's advisory source." +enum VulnerabilitySeverity { + "The source did not provide a recognized severity." + UNKNOWN + "Low severity." + LOW + "Medium severity." + MEDIUM + "High severity." + HIGH + "Critical severity." + CRITICAL +} + +"A forward-paginated selection of vulnerability findings." +type VulnerabilityFindingConnection { + "Findings and their continuation cursors." + edges: [VulnerabilityFindingEdge!]! + "The findings in the same order as edges." + nodes: [VulnerabilityFinding!]! + "Pagination information and the full filtered total." + pageInfo: PageInfo! +} + +"A vulnerability finding and the cursor immediately after it." +type VulnerabilityFindingEdge { + "A cursor for continuing after this finding with the same filter." + cursor: Cursor! + "The vulnerability finding." + node: VulnerabilityFinding! +} + +"A vulnerability affecting one package in a workload's deployed image." +type VulnerabilityFinding implements Node { + "The globally unique identifier of this finding." + id: ID! + "The workload affected by the finding." + workload: VulnerabilityWorkloadRef! + "The deployed image in which the finding was detected." + image: VulnerabilityImage! + "The canonical vulnerability identifier." + vulnerabilityIdentifier: String! + "Advisory details, if the vulnerability is still known." + vulnerability: Vulnerability + "The full package URL identifying the affected component." + purl: String! + "The package URL without version, qualifiers or subpath." + packageKey: String! + "The installed package version." + installedVersion: String! + "The first known fixed version, if provided by the source." + fixedVersion: String + "Severity reported by the advisory source." + severity: VulnerabilitySeverity! + "The source supplying the severity." + severitySource: String! + "The advisory source supplying the finding." + dataSource: String! + "The estimated probability of exploitation, if available." + epss: VulnerabilityEpss + "Known exploited according to CISA KEV. False is not proof of no exploitation." + knownExploited: Boolean! + "The current assessment for this workload, image repository, package and vulnerability." + suppression: VulnerabilitySuppression +} + +"The identity of the application or job affected by a finding." +type VulnerabilityWorkloadRef { + "The team owning the workload." + team: Slug! + "The environment where the workload is deployed." + environment: String! + "The application or job name." + name: String! +} + +"A container image identified by repository name and manifest digest." +type VulnerabilityImage { + "The image repository name." + name: String! + "The immutable manifest digest." + digest: String! +} + +"Counts over the full filtered selection of current findings." +type VulnerabilityFindingSummary { + "The total number of findings." + totalFindings: Int! + "Finding counts by severity." + countsBySeverity: VulnerabilitySeverityCounts! + "The number of findings with a known fixed version." + fixableFindings: Int! + "The number of findings whose vulnerability is listed in CISA KEV." + knownExploitedFindings: Int! +} + +"Finding counts grouped by advisory severity." +type VulnerabilitySeverityCounts { + "Findings without a recognized severity." + unknown: Int! + "Low-severity findings." + low: Int! + "Medium-severity findings." + medium: Int! + "High-severity findings." + high: Int! + "Critical-severity findings." + critical: Int! +} + +"Coverage counts for the selected, currently deployed workloads." +type VulnerabilityCoverageCounts { + "The total number of workloads in the selection." + totalWorkloads: Int! + "Workloads with a completed scan. This does not mean they have no vulnerabilities." + scanned: Int! + "Workloads waiting for inventory, a package inventory or a scan." + pending: Int! + "Workloads whose image has no package inventory." + noSbom: Int! + "Workloads whose image has not been scanned successfully because of an error." + failed: Int! + "Workloads whose deployed image could not be resolved." + unresolvedImage: Int! +} + +"Scan coverage of one workload's currently deployed image." +type VulnerabilityCoverage { + "How far the deployed image has progressed towards a completed scan." + status: VulnerabilityCoverageStatus! + "The resolved image repository name, if known." + imageName: String + "The resolved image manifest digest, if known." + imageDigest: String + "The last successful scan time, if available." + scannedAt: Time + "The latest resolution, fetching or scanning error, if any." + error: String +} + +"How far a deployed image has progressed towards vulnerability findings." +enum VulnerabilityCoverageStatus { + "Waiting for inventory, a package inventory or a scan." + PENDING + "A scan completed. Findings from the last successful scan survive a failed rescan." + SCANNED + "No package inventory was found for the image." + NO_SBOM + "An error prevented the image's first successful scan." + FAILED + "The deployed image could not be resolved." + UNRESOLVED_IMAGE +} + +"A workload owner's current assessment of a vulnerability finding." +enum VulnerabilitySuppressionState { + "The workload is not affected by the vulnerability." + NOT_AFFECTED + "The finding is a false positive." + FALSE_POSITIVE + "The workload owner has accepted the risk." + ACCEPTED_RISK +} + +"Advisory information shared by findings for the same vulnerability." +type Vulnerability implements Node { + "The globally unique identifier of the advisory." + id: ID! + "The canonical vulnerability identifier." + identifier: String! + "Alternative identifiers for this vulnerability." + aliases: [String!]! + "The advisory title." + title: String! + "The advisory description." + description: String! + "CVSS scores and vectors supplied by the advisory sources." + cvss: [VulnerabilityCvss!]! + "Reference URLs supplied by the advisory sources." + references: [String!]! + "The estimated probability of exploitation, if available." + epss: VulnerabilityEpss + "Known exploited according to CISA KEV. False is not proof of no exploitation." + knownExploited: Boolean! +} + +"One source's CVSS score and vector, preserving absent values." +type VulnerabilityCvss { + "The source supplying the CVSS assessment." + source: String! + "The CVSS version supplied by the source." + version: String! + "The CVSS score, or null when the source did not supply one." + score: Float + "The CVSS vector, or null when the source did not supply one." + vector: String +} + +"An exploitation probability supplied by FIRST EPSS." +type VulnerabilityEpss { + "The estimated probability of exploitation, between zero and one." + score: Float! + "The date of the probability estimate." + date: Date! +} + +"Filters applied before assessment pagination." +input VulnerabilitySuppressionFilter { + "Limit a root query to a team, environment or workload." + scope: VulnerabilityScopeInput + "Match a vulnerability identifier or alias." + vulnerabilityIdentifier: String + "Match an image repository name." + imageName: String +} + +"A durable assessment for one workload, image repository, package and vulnerability." +type VulnerabilitySuppression implements Node { + "The globally unique identifier of the assessment." + id: ID! + "The team owning the assessment." + team: Slug! + "The environment where the assessment applies." + environment: String! + "The application or job name." + workload: String! + "The image repository name. The assessment survives image version changes." + imageName: String! + "The package URL without version, qualifiers or subpath." + packageKey: String! + "The canonical vulnerability identifier." + vulnerabilityIdentifier: String! + "The current assessment state." + state: VulnerabilitySuppressionState! + "The workload owner's reason for the assessment." + reason: String! + "The identity of the actor who last set the assessment." + updatedBy: String! + "The time the assessment was last set." + updatedAt: Time! +} + +"A forward-paginated selection of workload assessments." +type VulnerabilitySuppressionConnection { + "Assessments and their continuation cursors." + edges: [VulnerabilitySuppressionEdge!]! + "The assessments in the same order as edges." + nodes: [VulnerabilitySuppression!]! + "Pagination information and the full filtered total." + pageInfo: PageInfo! +} + +"A workload assessment and the cursor immediately after it." +type VulnerabilitySuppressionEdge { + "A cursor for continuing after this assessment with the same filter." + cursor: Cursor! + "The workload assessment." + node: VulnerabilitySuppression! +} + +"Identifies an assessment within the mutation's team." +input VulnerabilitySuppressionKeyInput { + "The environment where the assessment applies." + environment: String! + "The application or job name." + workload: String! + "The image repository name, without a tag or digest." + imageName: String! + "A package key or full package URL. Version, qualifiers and subpath are ignored." + packageKey: String! + "A vulnerability identifier or an alias identifying exactly one vulnerability." + vulnerabilityIdentifier: String! +} + +"An assessment to set for a workload." +input NewVulnerabilitySuppressionInput { + "The workload, image repository, package and vulnerability being assessed." + key: VulnerabilitySuppressionKeyInput! + "The workload owner's assessment." + state: VulnerabilitySuppressionState! + "A non-empty explanation for the assessment." + reason: String! +} + +"An atomic batch of assessments for one team." +input SetVulnerabilitySuppressionsInput { + "The team owning every assessment in the batch." + team: Slug! + "The assessments to set. At least one item is required." + items: [NewVulnerabilitySuppressionInput!]! +} + +"An atomic batch of assessments to delete for one team." +input DeleteVulnerabilitySuppressionsInput { + "The team owning every assessment in the batch." + team: Slug! + "The assessments to delete. Missing assessments are ignored." + keys: [VulnerabilitySuppressionKeyInput!]! +} + +"The assessments set by the batch, using canonical package and vulnerability identifiers." +type SetVulnerabilitySuppressionsPayload { + "The assessments as stored." + suppressions: [VulnerabilitySuppression!]! +} + +"The assessments that existed and were deleted by the batch." +type DeleteVulnerabilitySuppressionsPayload { + "The deleted assessments." + deleted: [VulnerabilitySuppression!]! +} + +extend type Mutation { + "Set workload assessments atomically. Until assessment writes are enabled, use updateImageVulnerability." + setVulnerabilitySuppressions( + "The team and assessments to update." + input: SetVulnerabilitySuppressionsInput! + ): SetVulnerabilitySuppressionsPayload! + "Delete workload assessments atomically. Until assessment writes are enabled, use updateImageVulnerability." + deleteVulnerabilitySuppressions( + "The team and assessments to delete." + input: DeleteVulnerabilitySuppressionsInput! + ): DeleteVulnerabilitySuppressionsPayload! +} + +"An assessment change recorded in the activity log." +type VulnerabilitySuppressionActivityLogEntry implements ActivityLogEntry & Node { + "The globally unique identifier of the entry." + id: ID! + "The identity of the actor who changed the assessment." + actor: String! + "GitHub Actions OIDC claims when authenticated by a GitHub repository." + gitHubActorClaims: GitHubActorClaims + "The time the activity was recorded." + createdAt: Time! + "A summary of the assessment change." + message: String! + "The type of resource affected." + resourceType: ActivityLogEntryResourceType! + "The name of the affected workload." + resourceName: String! + "The team owning the assessment." + teamSlug: Slug + "The environment where the assessment applies." + environmentName: String + "The assessment as set, or as it existed before deletion." + data: VulnerabilitySuppressionActivityLogEntryData! +} + +"The assessment associated with an activity log entry." +type VulnerabilitySuppressionActivityLogEntryData { + "The assessment as set, or as it existed before deletion." + assessment: VulnerabilitySuppression! +} + +extend enum ActivityLogEntryResourceType { + "A workload vulnerability assessment." + VULNERABILITY_SUPPRESSION +} + +extend enum ActivityLogActivityType { + "A workload vulnerability assessment was set." + VULNERABILITY_SUPPRESSION_UPDATED + "A workload vulnerability assessment was deleted." + VULNERABILITY_SUPPRESSION_DELETED +} diff --git a/internal/graph/v0s.resolvers.go b/internal/graph/v0s.resolvers.go new file mode 100644 index 000000000..508401627 --- /dev/null +++ b/internal/graph/v0s.resolvers.go @@ -0,0 +1,73 @@ +package graph + +import ( + "context" + + "github.com/nais/api/internal/graph/gengql" + "github.com/nais/api/internal/graph/pagination" + "github.com/nais/api/internal/v0s" + "github.com/nais/api/internal/workload/application" + "github.com/nais/api/internal/workload/job" +) + +func (r *applicationResolver) VulnerabilityFindings(ctx context.Context, obj *application.Application, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilityFinding], error) { + return v0s.Findings(ctx, v0s.WorkloadScope(obj), filter, first, after) +} + +func (r *applicationResolver) VulnerabilityFindingSummary(ctx context.Context, obj *application.Application, filter *v0s.VulnerabilityFindingFilter) (*v0s.VulnerabilityFindingSummary, error) { + return v0s.FindingSummary(ctx, v0s.WorkloadScope(obj), filter) +} + +func (r *applicationResolver) VulnerabilityCoverage(ctx context.Context, obj *application.Application) (*v0s.VulnerabilityCoverage, error) { + return v0s.WorkloadCoverage(ctx, obj) +} + +func (r *jobResolver) VulnerabilityFindings(ctx context.Context, obj *job.Job, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilityFinding], error) { + return v0s.Findings(ctx, v0s.WorkloadScope(obj), filter, first, after) +} + +func (r *jobResolver) VulnerabilityFindingSummary(ctx context.Context, obj *job.Job, filter *v0s.VulnerabilityFindingFilter) (*v0s.VulnerabilityFindingSummary, error) { + return v0s.FindingSummary(ctx, v0s.WorkloadScope(obj), filter) +} + +func (r *jobResolver) VulnerabilityCoverage(ctx context.Context, obj *job.Job) (*v0s.VulnerabilityCoverage, error) { + return v0s.WorkloadCoverage(ctx, obj) +} + +func (r *mutationResolver) SetVulnerabilitySuppressions(ctx context.Context, input v0s.SetVulnerabilitySuppressionsInput) (*v0s.SetVulnerabilitySuppressionsPayload, error) { + return v0s.SetSuppressions(ctx, input) +} + +func (r *mutationResolver) DeleteVulnerabilitySuppressions(ctx context.Context, input v0s.DeleteVulnerabilitySuppressionsInput) (*v0s.DeleteVulnerabilitySuppressionsPayload, error) { + return v0s.DeleteSuppressions(ctx, input) +} + +func (r *queryResolver) VulnerabilityFindings(ctx context.Context, filter *v0s.VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilityFinding], error) { + return v0s.Findings(ctx, nil, filter, first, after) +} + +func (r *queryResolver) VulnerabilityFindingSummary(ctx context.Context, filter *v0s.VulnerabilityFindingFilter) (*v0s.VulnerabilityFindingSummary, error) { + return v0s.FindingSummary(ctx, nil, filter) +} + +func (r *queryResolver) VulnerabilityCoverage(ctx context.Context, scope *v0s.VulnerabilityScopeInput) (*v0s.VulnerabilityCoverageCounts, error) { + return v0s.Coverage(ctx, scope) +} + +func (r *queryResolver) Vulnerability(ctx context.Context, identifier string) (*v0s.Vulnerability, error) { + return v0s.VulnerabilityByIdentifier(ctx, identifier) +} + +func (r *queryResolver) VulnerabilitySuppressions(ctx context.Context, filter *v0s.VulnerabilitySuppressionFilter, first *int, after *pagination.Cursor) (*pagination.Connection[*v0s.VulnerabilitySuppression], error) { + return v0s.Suppressions(ctx, nil, filter, first, after) +} + +func (r *vulnerabilityFindingResolver) Vulnerability(ctx context.Context, obj *v0s.VulnerabilityFinding) (*v0s.Vulnerability, error) { + return v0s.VulnerabilityByIdentifier(ctx, obj.VulnerabilityIdentifier) +} + +func (r *Resolver) VulnerabilityFinding() gengql.VulnerabilityFindingResolver { + return &vulnerabilityFindingResolver{r} +} + +type vulnerabilityFindingResolver struct{ *Resolver } diff --git a/internal/graph/v0s.resolvers_test.go b/internal/graph/v0s.resolvers_test.go new file mode 100644 index 000000000..627336ec2 --- /dev/null +++ b/internal/graph/v0s.resolvers_test.go @@ -0,0 +1,192 @@ +package graph + +import ( + "bytes" + "context" + "encoding/json" + "net/http/httptest" + "strings" + "testing" + + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/graph/apierror" + "github.com/nais/api/internal/graph/gengql" + "github.com/nais/api/internal/v0s" + v0sapi "github.com/nais/api/internal/v0s/protoapi" + "github.com/nais/api/internal/vulnerability" + inventoryapi "github.com/nais/api/pkg/apiclient/protoapi" + "github.com/nais/v13s/pkg/api/vulnerabilities" + "github.com/sirupsen/logrus" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type v0sGraphActor struct{ authz.AuthenticatedUser } + +type v0sGraphClient struct { + v0sapi.VulnerabilityServiceClient + v0sapi.SuppressionServiceClient + err error +} + +func (v0sGraphClient) ListWorkloads(context.Context, *v0sapi.ListWorkloadsRequest, ...grpc.CallOption) (*v0sapi.ListWorkloadsResponse, error) { + return &v0sapi.ListWorkloadsResponse{Workloads: []*v0sapi.Workload{{ + Team: "team-one", Environment: "dev", Name: "app", ImageReference: "repo/app:1", + Image: &v0sapi.Image{Name: "repo/app", Digest: "sha256:one", Status: v0sapi.ImageStatus_IMAGE_STATUS_SCANNED}, + }}}, nil +} + +func (v0sGraphClient) ListFindings(context.Context, *v0sapi.ListFindingsRequest, ...grpc.CallOption) (*v0sapi.ListFindingsResponse, error) { + return &v0sapi.ListFindingsResponse{Findings: []*v0sapi.Finding{{ + Workload: &v0sapi.WorkloadRef{Team: "team-one", Environment: "dev", Name: "app"}, + Image: &v0sapi.Image{Name: "repo/app", Digest: "sha256:one"}, + VulnerabilityId: "CVE-new", Purl: "pkg:npm/example@1", PackageKey: "pkg:npm/example", + Severity: v0sapi.Severity_SEVERITY_HIGH, + }}, Cursors: []string{"finding-1"}}, nil +} + +func (v0sGraphClient) CountFindings(_ context.Context, req *v0sapi.CountFindingsRequest, _ ...grpc.CallOption) (*v0sapi.CountFindingsResponse, error) { + f := req.GetFilter() + if f.GetHasFix() || f.GetOnlyKnownExploited() || (len(f.GetSeverities()) > 0 && f.Severities[0] != v0sapi.Severity_SEVERITY_HIGH) { + return &v0sapi.CountFindingsResponse{}, nil + } + return &v0sapi.CountFindingsResponse{Buckets: []*v0sapi.CountFindingsResponse_Bucket{{Key: "dev/team-one/app", Count: 1}}}, nil +} + +func (c v0sGraphClient) GetVulnerability(context.Context, *v0sapi.GetVulnerabilityRequest, ...grpc.CallOption) (*v0sapi.GetVulnerabilityResponse, error) { + return &v0sapi.GetVulnerabilityResponse{Vulnerability: &v0sapi.Vulnerability{ + Id: "CVE-new", Cvss: []*v0sapi.Cvss{{Source: "source", Version: "3.x"}, {Source: "source", Version: "3.1", Score: new(0.0)}}, + }}, c.err +} + +func (v0sGraphClient) ListSuppressions(context.Context, *v0sapi.ListSuppressionsRequest, ...grpc.CallOption) (*v0sapi.ListSuppressionsResponse, error) { + return &v0sapi.ListSuppressionsResponse{}, nil +} + +func executeV0sQuery(t *testing.T, manager *v0s.Manager, legacy *cveAliasClient, query string) []byte { + t.Helper() + server := handler.New(gengql.NewExecutableSchema(gengql.Config{Resolvers: NewResolver("test", nil)})) + server.SetErrorPresenter(apierror.GetErrorPresenter(logrus.New())) + server.AddTransport(transport.POST{}) + ctx := authz.ContextWithActor(t.Context(), v0sGraphActor{}, nil) + ctx = vulnerability.NewLoaderContext(ctx, &vulnerability.Manager{Client: legacy}, logrus.New()) + ctx = v0s.WithManager(ctx, manager) + ctx = v0s.NewLoaderContext(ctx, func(context.Context) (*inventoryapi.ListWorkloadImagesResponse, error) { + return &inventoryapi.ListWorkloadImagesResponse{Environments: []*inventoryapi.EnvironmentWorkloadImages{{ + Environment: "dev", Workloads: []*inventoryapi.WorkloadImage{{TeamSlug: "team-one", Name: "app", Image: "repo/app:1"}}, + }}}, nil + }) + body, err := json.Marshal(map[string]string{"query": query}) + if err != nil { + t.Fatal(err) + } + req := httptest.NewRequest("POST", "/graphql", bytes.NewReader(body)).WithContext(ctx) + req.Header.Set("Content-Type", "application/json") + recorder := httptest.NewRecorder() + server.ServeHTTP(recorder, req) + if recorder.Code != 200 { + t.Fatalf("GraphQL status %d: %s", recorder.Code, recorder.Body.String()) + } + return recorder.Body.Bytes() +} + +func TestV0sQueriesCoexistWithLegacyV13s(t *testing.T) { + client := v0sGraphClient{} + legacy := &cveAliasClient{nodes: []*vulnerabilities.CveSummary{{Cve: &vulnerabilities.Cve{Id: "CVE-old"}}}} + body := executeV0sQuery(t, &v0s.Manager{Vulnerabilities: client, Suppressions: client}, legacy, `query { + vulnerabilityFindings(filter: {scope: {team: "team-one", environment: "dev", workload: "app"}}, first: 1) { + edges { cursor node { id vulnerabilityIdentifier severity fixedVersion suppression { state } workload { team environment name } } } + nodes { id vulnerabilityIdentifier } + pageInfo { hasNextPage hasPreviousPage startCursor endCursor totalCount } + } + vulnerabilityFindingSummary { totalFindings countsBySeverity { high } fixableFindings knownExploitedFindings } + vulnerabilityCoverage { totalWorkloads scanned pending } + vulnerability(identifier: "CVE-new") { id identifier aliases cvss { score vector } } + vulnerabilitySuppressions { edges { node { state } } pageInfo { hasNextPage endCursor } } + cves(first: 1) { edges { node { __typename } } } + }`) + var response struct { + Data struct { + VulnerabilityFindings struct { + Edges []struct { + Cursor string + Node struct { + ID string + VulnerabilityIdentifier string + Severity string + FixedVersion *string + } + } + Nodes []struct{ ID, VulnerabilityIdentifier string } + PageInfo struct { + TotalCount int + HasNextPage, HasPreviousPage bool + StartCursor, EndCursor string + } + } + VulnerabilityFindingSummary struct{ TotalFindings, FixableFindings int } + VulnerabilityCoverage struct{ TotalWorkloads, Scanned int } + Vulnerability struct{ Cvss []struct{ Score *float64 } } + } + Errors []json.RawMessage + } + if err := json.Unmarshal(body, &response); err != nil { + t.Fatal(err) + } + if len(response.Errors) != 0 { + t.Fatalf("GraphQL failed: %s", body) + } + data := response.Data + if len(data.VulnerabilityFindings.Edges) != 1 || data.VulnerabilityFindings.Edges[0].Node.VulnerabilityIdentifier != "CVE-new" || + data.VulnerabilityFindings.Edges[0].Node.Severity != "HIGH" || data.VulnerabilityFindings.Edges[0].Node.FixedVersion != nil || + data.VulnerabilityFindings.Edges[0].Cursor == "" || data.VulnerabilityFindingSummary.TotalFindings != 1 || + data.VulnerabilityFindingSummary.FixableFindings != 0 || data.VulnerabilityCoverage.TotalWorkloads != 1 || + data.VulnerabilityCoverage.Scanned != 1 || len(data.Vulnerability.Cvss) != 2 || + data.Vulnerability.Cvss[0].Score != nil || data.Vulnerability.Cvss[1].Score == nil || + *data.Vulnerability.Cvss[1].Score != 0 || legacy.calls.Load() != 1 { + t.Fatalf("new and old GraphQL sources were not preserved: %s", body) + } + connection := data.VulnerabilityFindings + if len(connection.Nodes) != 1 || connection.Nodes[0].ID == "" || connection.Nodes[0].ID != connection.Edges[0].Node.ID || + connection.Nodes[0].VulnerabilityIdentifier != connection.Edges[0].Node.VulnerabilityIdentifier || + connection.PageInfo.TotalCount != 1 || connection.PageInfo.HasNextPage || connection.PageInfo.HasPreviousPage || + connection.PageInfo.StartCursor != connection.Edges[0].Cursor || connection.PageInfo.EndCursor != connection.Edges[0].Cursor { + t.Fatalf("connection contract was not preserved: %s", body) + } +} + +func TestV0sValidationUsesProductionErrorPresenter(t *testing.T) { + client := v0sGraphClient{err: status.Error(codes.InvalidArgument, "alias names several vulnerabilities")} + body := executeV0sQuery(t, &v0s.Manager{Vulnerabilities: client, Suppressions: client}, &cveAliasClient{}, + `{ vulnerability(identifier: "ambiguous-alias") { identifier } }`) + if !strings.Contains(string(body), "alias names several vulnerabilities") || strings.Contains(string(body), "server errored out") { + t.Fatalf("client validation became a server failure: %s", body) + } +} + +func TestUnconfiguredV0sDoesNotBreakLegacyQueries(t *testing.T) { + legacy := &cveAliasClient{nodes: []*vulnerabilities.CveSummary{{Cve: &vulnerabilities.Cve{Id: "CVE-old"}}}} + body := executeV0sQuery(t, nil, legacy, `{ cves(first: 1) { edges { node { __typename } } } }`) + if strings.Contains(string(body), `"errors"`) || legacy.calls.Load() != 1 { + t.Fatalf("legacy query depends on v0s: %s", body) + } + body = executeV0sQuery(t, nil, legacy, `{ vulnerabilityCoverage { totalWorkloads scanned } }`) + if !strings.Contains(string(body), `"errors"`) || strings.Contains(string(body), `"totalWorkloads":0`) { + t.Fatalf("unconfigured v0s returned clean coverage: %s", body) + } +} + +func TestV0sGraphQLWritesAreDisabledDuringMigration(t *testing.T) { + for _, mutation := range []string{ + `setVulnerabilitySuppressions(input: {team: "team-one", items: [{key: {environment: "dev", workload: "app", imageName: "repo/app", packageKey: "pkg:npm/example", vulnerabilityIdentifier: "CVE-1"}, state: ACCEPTED_RISK, reason: "reason"}]}) { suppressions { state } }`, + `deleteVulnerabilitySuppressions(input: {team: "team-one", keys: [{environment: "dev", workload: "app", imageName: "repo/app", packageKey: "pkg:npm/example", vulnerabilityIdentifier: "CVE-1"}]}) { deleted { state } }`, + } { + body := executeV0sQuery(t, &v0s.Manager{}, &cveAliasClient{}, "mutation { "+mutation+" }") + if !strings.Contains(string(body), "writes are disabled during migration") { + t.Fatalf("new writes were not migration-gated: %s", body) + } + } +} diff --git a/internal/integration/manager.go b/internal/integration/manager.go index e5563d60c..f2299530b 100644 --- a/internal/integration/manager.go +++ b/internal/integration/manager.go @@ -296,6 +296,7 @@ func newGQLRunner( }, }, vMgr, + nil, config.TenantName, clusters(), fakeHookd.New(), diff --git a/internal/v0s/activitylog.go b/internal/v0s/activitylog.go new file mode 100644 index 000000000..360e93bb3 --- /dev/null +++ b/internal/v0s/activitylog.go @@ -0,0 +1,54 @@ +package v0s + +import ( + "context" + "fmt" + + "github.com/nais/api/internal/activitylog" + "github.com/nais/api/internal/auth/authz" +) + +const activityLogResourceType activitylog.ActivityLogEntryResourceType = "VULNERABILITY_SUPPRESSION" + +func init() { + activitylog.RegisterTransformer(activityLogResourceType, func(entry activitylog.GenericActivityLogEntry) (activitylog.ActivityLogEntry, error) { + data, err := activitylog.UnmarshalData[VulnerabilitySuppressionActivityLogEntryData](entry) + if err != nil { + return nil, err + } + var message string + switch entry.Action { + case activitylog.ActivityLogEntryActionUpdated: + message = "Updated vulnerability assessment" + case activitylog.ActivityLogEntryActionDeleted: + message = "Deleted vulnerability assessment" + default: + return nil, fmt.Errorf("unsupported vulnerability assessment activity: %q", entry.Action) + } + return VulnerabilitySuppressionActivityLogEntry{ + GenericActivityLogEntry: entry.WithMessage(message), Data: data, + }, nil + }) + activitylog.RegisterActivityType("VULNERABILITY_SUPPRESSION_UPDATED", activitylog.ActivityLogEntryActionUpdated, + activityLogResourceType, "A workload vulnerability assessment was set.", activitylog.IgnoreWebhook()) + activitylog.RegisterActivityType("VULNERABILITY_SUPPRESSION_DELETED", activitylog.ActivityLogEntryActionDeleted, + activityLogResourceType, "A workload vulnerability assessment was deleted.", activitylog.IgnoreWebhook()) +} + +type VulnerabilitySuppressionActivityLogEntry struct { + activitylog.GenericActivityLogEntry + Data *VulnerabilitySuppressionActivityLogEntryData `json:"data"` +} + +type VulnerabilitySuppressionActivityLogEntryData struct { + Assessment *VulnerabilitySuppression `json:"assessment"` +} + +func recordAssessment(ctx context.Context, action activitylog.ActivityLogEntryAction, assessment *VulnerabilitySuppression) error { + return activitylog.Create(ctx, activitylog.CreateInput{ + Action: action, Actor: authz.ActorFromContext(ctx).User, + ResourceType: activityLogResourceType, ResourceName: assessment.Workload, + TeamSlug: &assessment.Team, EnvironmentName: &assessment.Environment, + Data: VulnerabilitySuppressionActivityLogEntryData{Assessment: assessment}, + }) +} diff --git a/internal/v0s/client.go b/internal/v0s/client.go new file mode 100644 index 000000000..9bd2da319 --- /dev/null +++ b/internal/v0s/client.go @@ -0,0 +1,57 @@ +// Package v0s adapts the v0s gRPC contract without changing the legacy v13s API. +package v0s + +import ( + "context" + "fmt" + + "github.com/nais/api/internal/graph/apierror" + "github.com/nais/api/internal/v0s/protoapi" + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +type Manager struct { + Vulnerabilities protoapi.VulnerabilityServiceClient + Suppressions protoapi.SuppressionServiceClient + SuppressionsEnabled bool + conn *grpc.ClientConn +} + +// NewManager creates a lazy connection. An unset endpoint disables only the new API. +func NewManager(endpoint string, suppressionsEnabled bool) (*Manager, error) { + m := &Manager{SuppressionsEnabled: suppressionsEnabled} + if endpoint == "" { + return m, nil + } + conn, err := grpc.NewClient(endpoint, + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), + ) + if err != nil { + return nil, fmt.Errorf("create v0s client: %w", err) + } + m.conn = conn + m.Vulnerabilities = protoapi.NewVulnerabilityServiceClient(conn) + m.Suppressions = protoapi.NewSuppressionServiceClient(conn) + return m, nil +} + +func (m *Manager) Close() error { + if m == nil || m.conn == nil { + return nil + } + return m.conn.Close() +} + +func (m *Manager) available() error { + if m == nil || m.Vulnerabilities == nil { + return apierror.Errorf("Vulnerability data is not configured.") + } + return nil +} + +func WithManager(ctx context.Context, m *Manager) context.Context { + return context.WithValue(ctx, managerKey, m) +} diff --git a/internal/v0s/client_test.go b/internal/v0s/client_test.go new file mode 100644 index 000000000..cdbff515d --- /dev/null +++ b/internal/v0s/client_test.go @@ -0,0 +1,83 @@ +package v0s_test + +import ( + "context" + "errors" + "net" + "testing" + "time" + + "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/v0s" + "github.com/nais/api/internal/v0s/protoapi" + inventoryapi "github.com/nais/api/pkg/apiclient/protoapi" + "google.golang.org/grpc" +) + +type advisoryServer struct { + protoapi.UnimplementedVulnerabilityServiceServer +} + +func (advisoryServer) GetVulnerability(_ context.Context, request *protoapi.GetVulnerabilityRequest) (*protoapi.GetVulnerabilityResponse, error) { + return &protoapi.GetVulnerabilityResponse{Vulnerability: &protoapi.Vulnerability{ + Id: request.GetId(), Cvss: []*protoapi.Cvss{{Source: "source", Version: "3.x"}}, + }}, nil +} + +func TestClientReadsThroughGRPCWithoutInventoryDependency(t *testing.T) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + server := grpc.NewServer() + protoapi.RegisterVulnerabilityServiceServer(server, advisoryServer{}) + done := make(chan error, 1) + go func() { done <- server.Serve(listener) }() + t.Cleanup(func() { + server.Stop() + if err := <-done; err != nil && !errors.Is(err, grpc.ErrServerStopped) { + t.Error(err) + } + }) + m, err := v0s.NewManager(listener.Addr().String(), false) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + if err := m.Close(); err != nil { + t.Error(err) + } + }) + ctx, cancel := context.WithTimeout(t.Context(), 5*time.Second) + defer cancel() + ctx = v0s.WithManager(authz.ContextWithActor(ctx, actor{}, nil), m) + ctx = v0s.NewLoaderContext(ctx, func(context.Context) (*inventoryapi.ListWorkloadImagesResponse, error) { + t.Error("advisory read unexpectedly depends on inventory") + return nil, errors.New("inventory unavailable") + }) + got, err := v0s.VulnerabilityByIdentifier(ctx, "CVE-1") + if err != nil || got.Identifier != "CVE-1" || got.Cvss[0].Score != nil { + t.Fatalf("gRPC advisory: %+v, %v", got, err) + } +} + +func TestClientInitializationDoesNotRequireRunningV0s(t *testing.T) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + endpoint := listener.Addr().String() + if err := listener.Close(); err != nil { + t.Fatal(err) + } + m, err := v0s.NewManager(endpoint, false) + if err != nil { + t.Fatalf("client initialization contacted the unavailable backend: %v", err) + } + defer m.Close() + ctx, cancel := context.WithTimeout(t.Context(), time.Second) + defer cancel() + if _, err := m.Vulnerabilities.GetVulnerability(ctx, &protoapi.GetVulnerabilityRequest{Id: "CVE-1"}); err == nil { + t.Fatal("unavailable backend returned a successful read") + } +} diff --git a/internal/v0s/convert.go b/internal/v0s/convert.go new file mode 100644 index 000000000..f3c9d7ce1 --- /dev/null +++ b/internal/v0s/convert.go @@ -0,0 +1,152 @@ +package v0s + +import ( + "fmt" + "time" + + "github.com/nais/api/internal/graph/scalar" + "github.com/nais/api/internal/slug" + "github.com/nais/api/internal/v0s/protoapi" +) + +func optionalString(value string) *string { + if value == "" { + return nil + } + return &value +} + +func epss(value *protoapi.Epss) (*VulnerabilityEpss, error) { + if value == nil { + return nil, nil + } + date, err := time.Parse(time.DateOnly, value.GetDate()) + if err != nil { + return nil, fmt.Errorf("invalid v0s EPSS date: %w", err) + } + if value.GetScore() < 0 || value.GetScore() > 1 { + return nil, fmt.Errorf("invalid v0s EPSS score") + } + return &VulnerabilityEpss{Score: value.GetScore(), Date: scalar.NewDate(date)}, nil +} + +func severity(value protoapi.Severity) VulnerabilitySeverity { + switch value { + case protoapi.Severity_SEVERITY_LOW: + return VulnerabilitySeverityLow + case protoapi.Severity_SEVERITY_MEDIUM: + return VulnerabilitySeverityMedium + case protoapi.Severity_SEVERITY_HIGH: + return VulnerabilitySeverityHigh + case protoapi.Severity_SEVERITY_CRITICAL: + return VulnerabilitySeverityCritical + default: + return VulnerabilitySeverityUnknown + } +} + +func suppression(value *protoapi.Suppression) (*VulnerabilitySuppression, error) { + if value == nil { + return nil, nil + } + var state VulnerabilitySuppressionState + switch value.GetState() { + case protoapi.SuppressionState_SUPPRESSION_STATE_NOT_AFFECTED: + state = VulnerabilitySuppressionStateNotAffected + case protoapi.SuppressionState_SUPPRESSION_STATE_FALSE_POSITIVE: + state = VulnerabilitySuppressionStateFalsePositive + case protoapi.SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK: + state = VulnerabilitySuppressionStateAcceptedRisk + default: + return nil, fmt.Errorf("invalid v0s suppression state") + } + if !value.GetUpdatedAt().IsValid() { + return nil, fmt.Errorf("invalid v0s suppression timestamp") + } + return &VulnerabilitySuppression{ + Team: slug.Slug(value.GetTeam()), Environment: value.GetEnvironment(), Workload: value.GetWorkload(), + ImageName: value.GetImageName(), PackageKey: value.GetPackageKey(), + VulnerabilityIdentifier: value.GetVulnerabilityId(), State: state, + Reason: value.GetDetail(), UpdatedBy: value.GetUpdatedBy(), UpdatedAt: value.GetUpdatedAt().AsTime(), + }, nil +} + +func finding(value *protoapi.Finding) (*VulnerabilityFinding, error) { + if value.GetWorkload() == nil || value.GetImage() == nil { + return nil, fmt.Errorf("v0s finding is missing workload or image") + } + e, err := epss(value.GetEpss()) + if err != nil { + return nil, err + } + s, err := suppression(value.GetSuppression()) + if err != nil { + return nil, err + } + return &VulnerabilityFinding{ + Workload: &VulnerabilityWorkloadRef{ + Team: slug.Slug(value.GetWorkload().GetTeam()), Environment: value.GetWorkload().GetEnvironment(), + Name: value.GetWorkload().GetName(), + }, + Image: &VulnerabilityImage{Name: value.GetImage().GetName(), Digest: value.GetImage().GetDigest()}, + VulnerabilityIdentifier: value.GetVulnerabilityId(), Purl: value.GetPurl(), PackageKey: value.GetPackageKey(), + InstalledVersion: value.GetInstalledVersion(), FixedVersion: optionalString(value.GetFixedVersion()), + Severity: severity(value.GetSeverity()), SeveritySource: value.GetSeveritySource(), DataSource: value.GetDataSource(), + Epss: e, KnownExploited: value.GetKnownExploited(), Suppression: s, + }, nil +} + +func advisory(value *protoapi.Vulnerability) (*Vulnerability, error) { + if value == nil { + return nil, nil + } + e, err := epss(value.GetEpss()) + if err != nil { + return nil, err + } + cvss := make([]*VulnerabilityCvss, 0, len(value.GetCvss())) + for _, score := range value.GetCvss() { + // Do not use getters: absent CVSS scores and vectors must remain null. + cvss = append(cvss, &VulnerabilityCvss{ + Source: score.GetSource(), Version: score.GetVersion(), Score: score.Score, Vector: score.Vector, + }) + } + return &Vulnerability{ + Identifier: value.GetId(), Aliases: value.GetAliases(), Title: value.GetTitle(), + Description: value.GetDescription(), Cvss: cvss, References: value.GetReferences(), + Epss: e, KnownExploited: value.GetKnownExploited(), + }, nil +} + +func coverage(value *protoapi.Workload) (*VulnerabilityCoverage, error) { + result := &VulnerabilityCoverage{Status: VulnerabilityCoverageStatusPending} + if value == nil { + return result, nil + } + if value.GetImage() == nil { + if value.GetResolveError() != "" { + result.Status = VulnerabilityCoverageStatusUnresolvedImage + result.Error = optionalString(value.GetResolveError()) + } + return result, nil + } + image := value.GetImage() + result.ImageName = optionalString(image.GetName()) + result.ImageDigest = optionalString(image.GetDigest()) + result.Error = optionalString(image.GetError()) + if image.GetScannedAt() != nil { + if !image.GetScannedAt().IsValid() { + return nil, fmt.Errorf("invalid v0s scan timestamp") + } + result.ScannedAt = new(image.GetScannedAt().AsTime()) + } + switch image.GetStatus() { + case protoapi.ImageStatus_IMAGE_STATUS_SCANNED: + result.Status = VulnerabilityCoverageStatusScanned + case protoapi.ImageStatus_IMAGE_STATUS_NO_SBOM: + result.Status = VulnerabilityCoverageStatusNoSbom + case protoapi.ImageStatus_IMAGE_STATUS_FAILED: + result.Status = VulnerabilityCoverageStatusFailed + } + return result, nil +} diff --git a/internal/v0s/dataloader.go b/internal/v0s/dataloader.go new file mode 100644 index 000000000..9faaddb09 --- /dev/null +++ b/internal/v0s/dataloader.go @@ -0,0 +1,214 @@ +package v0s + +import ( + "context" + "fmt" + + "github.com/nais/api/internal/graph/loader" + "github.com/nais/api/internal/v0s/protoapi" + inventoryapi "github.com/nais/api/pkg/apiclient/protoapi" + "github.com/vikstrous/dataloadgen" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +type contextKey int + +const ( + managerKey contextKey = iota + loadersKey +) + +type workloadKey struct { + environment, team, name string +} + +type scope struct { + team, environment, workload string +} + +func (s scope) matches(k workloadKey) bool { + return (s.team == "" || s.team == k.team) && + (s.environment == "" || s.environment == k.environment) && + (s.workload == "" || s.workload == k.name) +} + +type loaders struct { + manager *Manager + inventory *dataloadgen.Loader[struct{}, map[workloadKey]string] + workloads *dataloadgen.Loader[scope, map[workloadKey]*protoapi.Workload] + counts *dataloadgen.Loader[string, map[string]int64] + advisories *dataloadgen.Loader[string, *Vulnerability] + suppressionCounts *dataloadgen.Loader[string, int] +} + +// NewLoaderContext caches inventory, coverage and grouped counts for one request. +func NewLoaderContext(ctx context.Context, inventory func(context.Context) (*inventoryapi.ListWorkloadImagesResponse, error)) context.Context { + m, _ := ctx.Value(managerKey).(*Manager) + l := &loaders{manager: m} + l.inventory = dataloadgen.NewLoader(func(ctx context.Context, keys []struct{}) ([]map[workloadKey]string, []error) { + resp, err := inventory(ctx) + result := make(map[workloadKey]string) + if err == nil { + for _, env := range resp.GetEnvironments() { + for _, w := range env.GetWorkloads() { + result[workloadKey{env.GetEnvironment(), w.GetTeamSlug(), w.GetName()}] = w.GetImage() + } + } + } + values := make([]map[workloadKey]string, len(keys)) + errs := make([]error, len(keys)) + for i := range keys { + values[i], errs[i] = result, err + } + return values, errs + }, loader.DefaultDataLoaderOptions...) + l.workloads = dataloadgen.NewLoader(func(ctx context.Context, keys []scope) ([]map[workloadKey]*protoapi.Workload, []error) { + values := make([]map[workloadKey]*protoapi.Workload, len(keys)) + errs := make([]error, len(keys)) + for i, key := range keys { + values[i], errs[i] = l.listWorkloads(ctx, key) + } + return values, errs + }, loader.DefaultDataLoaderOptions...) + l.counts = dataloadgen.NewLoader(func(ctx context.Context, keys []string) ([]map[string]int64, []error) { + values := make([]map[string]int64, len(keys)) + errs := make([]error, len(keys)) + for i, key := range keys { + filter := &protoapi.FindingFilter{} + if err := proto.Unmarshal([]byte(key), filter); err != nil { + errs[i] = fmt.Errorf("decode v0s count filter: %w", err) + continue + } + resp, err := m.Vulnerabilities.CountFindings(ctx, &protoapi.CountFindingsRequest{ + Filter: filter, GroupBy: protoapi.CountFindingsRequest_GROUP_BY_WORKLOAD, + }) + if err != nil { + errs[i] = backendError("count v0s findings", err) + continue + } + values[i] = make(map[string]int64) + for _, bucket := range resp.GetBuckets() { + values[i][bucket.GetKey()] += bucket.GetCount() + } + } + return values, errs + }, loader.DefaultDataLoaderOptions...) + l.advisories = dataloadgen.NewLoader(func(ctx context.Context, keys []string) ([]*Vulnerability, []error) { + values := make([]*Vulnerability, len(keys)) + errs := make([]error, len(keys)) + for i, key := range keys { + resp, err := m.Vulnerabilities.GetVulnerability(ctx, &protoapi.GetVulnerabilityRequest{Id: key}) + if status.Code(err) == codes.NotFound { + continue + } + if err != nil { + errs[i] = backendError("get v0s vulnerability", err) + continue + } + values[i], errs[i] = advisory(resp.GetVulnerability()) + } + return values, errs + }, loader.DefaultDataLoaderOptions...) + l.suppressionCounts = dataloadgen.NewLoader(func(ctx context.Context, keys []string) ([]int, []error) { + values := make([]int, len(keys)) + errs := make([]error, len(keys)) + for i, key := range keys { + req := &protoapi.ListSuppressionsRequest{} + if err := proto.Unmarshal([]byte(key), req); err != nil { + errs[i] = fmt.Errorf("decode v0s suppression filter: %w", err) + continue + } + req.PageSize = 1000 + for { + resp, err := m.Suppressions.ListSuppressions(ctx, req) + if err != nil { + errs[i] = backendError("count v0s suppressions", err) + break + } + values[i] += len(resp.GetSuppressions()) + if resp.GetNextPageToken() == "" { + break + } + if resp.GetNextPageToken() == req.PageToken { + errs[i] = fmt.Errorf("v0s returned a non-advancing suppression cursor") + break + } + req.PageToken = resp.GetNextPageToken() + } + } + return values, errs + }, loader.DefaultDataLoaderOptions...) + return context.WithValue(ctx, loadersKey, l) +} + +func fromContext(ctx context.Context) (*loaders, error) { + l, _ := ctx.Value(loadersKey).(*loaders) + if l == nil { + return nil, (&Manager{}).available() + } + if err := l.manager.available(); err != nil { + return nil, err + } + return l, nil +} + +func (l *loaders) listWorkloads(ctx context.Context, s scope) (map[workloadKey]*protoapi.Workload, error) { + result := make(map[workloadKey]*protoapi.Workload) + req := &protoapi.ListWorkloadsRequest{Team: s.team, Environment: s.environment, PageSize: 1000} + for { + resp, err := l.manager.Vulnerabilities.ListWorkloads(ctx, req) + if err != nil { + return nil, backendError("list v0s workloads", err) + } + for _, w := range resp.GetWorkloads() { + result[workloadKey{w.GetEnvironment(), w.GetTeam(), w.GetName()}] = w + } + if resp.GetNextPageToken() == "" { + return result, nil + } + if resp.GetNextPageToken() == req.PageToken { + return nil, fmt.Errorf("v0s returned a non-advancing workload cursor") + } + req.PageToken = resp.GetNextPageToken() + } +} + +// currentWorkloads excludes removed workloads and findings for an obsolete deployed image. +func (l *loaders) currentWorkloads(ctx context.Context, s scope) (map[workloadKey]*protoapi.Workload, error) { + inventory, err := l.inventory.Load(ctx, struct{}{}) + if err != nil { + return nil, err + } + all, err := l.workloads.Load(ctx, scope{team: s.team, environment: s.environment}) + if err != nil { + return nil, err + } + current := make(map[workloadKey]*protoapi.Workload) + for key, w := range all { + image, exists := inventory[key] + if exists && s.matches(key) && image == w.GetImageReference() { + current[key] = w + } + } + return current, nil +} + +func (l *loaders) countCurrent(ctx context.Context, filter *protoapi.FindingFilter, current map[workloadKey]*protoapi.Workload) (int64, error) { + data, err := proto.Marshal(filter) + if err != nil { + return 0, fmt.Errorf("encode v0s count filter: %w", err) + } + buckets, err := l.counts.Load(ctx, string(data)) + if err != nil { + return 0, err + } + var count int64 + for key, w := range current { + if w.GetImage() != nil { + count += buckets[key.environment+"/"+key.team+"/"+key.name] + } + } + return count, nil +} diff --git a/internal/v0s/errors.go b/internal/v0s/errors.go new file mode 100644 index 000000000..ed1b358b7 --- /dev/null +++ b/internal/v0s/errors.go @@ -0,0 +1,27 @@ +package v0s + +import ( + "context" + "fmt" + + "github.com/nais/api/internal/graph/apierror" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func backendError(operation string, err error) error { + switch status.Code(err) { + case codes.InvalidArgument: + return apierror.Errorf("%s", status.Convert(err).Message()) + case codes.NotFound: + return apierror.ErrNotFound + case codes.Unavailable: + return apierror.Errorf("Vulnerability data is temporarily unavailable. Please try again later.") + case codes.DeadlineExceeded: + return apierror.Errorf("The vulnerability request timed out. Please try again.") + case codes.Canceled: + return context.Canceled + default: + return fmt.Errorf("%s: %w", operation, err) + } +} diff --git a/internal/v0s/models.go b/internal/v0s/models.go new file mode 100644 index 000000000..0cdaf8e58 --- /dev/null +++ b/internal/v0s/models.go @@ -0,0 +1,245 @@ +package v0s + +import ( + "fmt" + "io" + "slices" + "strconv" + "time" + + "github.com/nais/api/internal/graph/pagination" + "github.com/nais/api/internal/graph/scalar" + "github.com/nais/api/internal/slug" +) + +type VulnerabilityScopeInput struct { + Team *slug.Slug + Environment *string + Workload *string +} + +type VulnerabilityFindingFilter struct { + Scope *VulnerabilityScopeInput + VulnerabilityIdentifier *string + Package *string + Severities []VulnerabilitySeverity + OnlyWithFix *bool + OnlyKnownExploited *bool + Suppressed *SuppressedFilter +} + +type ( + VulnerabilityFindingConnection = pagination.Connection[*VulnerabilityFinding] + VulnerabilityFindingEdge = pagination.Edge[*VulnerabilityFinding] +) + +type VulnerabilityFinding struct { + Workload *VulnerabilityWorkloadRef + Image *VulnerabilityImage + VulnerabilityIdentifier string + Purl string + PackageKey string + InstalledVersion string + FixedVersion *string + Severity VulnerabilitySeverity + SeveritySource string + DataSource string + Epss *VulnerabilityEpss + KnownExploited bool + Suppression *VulnerabilitySuppression +} + +type VulnerabilityWorkloadRef struct { + Team slug.Slug + Environment string + Name string +} + +type VulnerabilityImage struct { + Name string + Digest string +} + +type VulnerabilityFindingSummary struct { + TotalFindings int64 + CountsBySeverity *VulnerabilitySeverityCounts + FixableFindings int64 + KnownExploitedFindings int64 +} + +type VulnerabilitySeverityCounts struct { + Unknown, Low, Medium, High, Critical int64 +} + +type VulnerabilityCoverageCounts struct { + TotalWorkloads, Scanned, Pending, NoSbom, Failed, UnresolvedImage int +} + +type VulnerabilityCoverage struct { + Status VulnerabilityCoverageStatus + ImageName *string + ImageDigest *string + ScannedAt *time.Time + Error *string +} + +type Vulnerability struct { + Identifier string + Aliases []string + Title string + Description string + Cvss []*VulnerabilityCvss + References []string + Epss *VulnerabilityEpss + KnownExploited bool +} + +type VulnerabilityCvss struct { + Source string + Version string + Score *float64 + Vector *string +} + +type VulnerabilityEpss struct { + Score float64 + Date scalar.Date +} + +type VulnerabilitySuppressionFilter struct { + Scope *VulnerabilityScopeInput + VulnerabilityIdentifier *string + ImageName *string +} + +type VulnerabilitySuppression struct { + Team slug.Slug `json:"team"` + Environment string `json:"environment"` + Workload string `json:"workload"` + ImageName string `json:"imageName"` + PackageKey string `json:"packageKey"` + VulnerabilityIdentifier string `json:"vulnerabilityIdentifier"` + State VulnerabilitySuppressionState `json:"state"` + Reason string `json:"reason"` + UpdatedBy string `json:"updatedBy"` + UpdatedAt time.Time `json:"updatedAt"` +} + +type ( + VulnerabilitySuppressionConnection = pagination.Connection[*VulnerabilitySuppression] + VulnerabilitySuppressionEdge = pagination.Edge[*VulnerabilitySuppression] +) + +type VulnerabilitySuppressionKeyInput struct { + Environment string + Workload string + ImageName string + PackageKey string + VulnerabilityIdentifier string +} + +type NewVulnerabilitySuppressionInput struct { + Key *VulnerabilitySuppressionKeyInput + State VulnerabilitySuppressionState + Reason string +} + +type SetVulnerabilitySuppressionsInput struct { + Team slug.Slug + Items []*NewVulnerabilitySuppressionInput +} + +type DeleteVulnerabilitySuppressionsInput struct { + Team slug.Slug + Keys []*VulnerabilitySuppressionKeyInput +} + +type SetVulnerabilitySuppressionsPayload struct { + Suppressions []*VulnerabilitySuppression +} + +type DeleteVulnerabilitySuppressionsPayload struct { + Deleted []*VulnerabilitySuppression +} + +type VulnerabilitySeverity string + +const ( + VulnerabilitySeverityUnknown VulnerabilitySeverity = "UNKNOWN" + VulnerabilitySeverityLow VulnerabilitySeverity = "LOW" + VulnerabilitySeverityMedium VulnerabilitySeverity = "MEDIUM" + VulnerabilitySeverityHigh VulnerabilitySeverity = "HIGH" + VulnerabilitySeverityCritical VulnerabilitySeverity = "CRITICAL" +) + +func (v VulnerabilitySeverity) MarshalGQL(w io.Writer) { + _, _ = io.WriteString(w, strconv.Quote(string(v))) +} + +func (v *VulnerabilitySeverity) UnmarshalGQL(value any) error { + s, err := enumValue(value, "UNKNOWN", "LOW", "MEDIUM", "HIGH", "CRITICAL") + *v = VulnerabilitySeverity(s) + return err +} + +type SuppressedFilter string + +const ( + SuppressedFilterExclude SuppressedFilter = "EXCLUDE" + SuppressedFilterInclude SuppressedFilter = "INCLUDE" + SuppressedFilterOnly SuppressedFilter = "ONLY" +) + +func (v SuppressedFilter) MarshalGQL(w io.Writer) { _, _ = io.WriteString(w, strconv.Quote(string(v))) } + +func (v *SuppressedFilter) UnmarshalGQL(value any) error { + s, err := enumValue(value, "EXCLUDE", "INCLUDE", "ONLY") + *v = SuppressedFilter(s) + return err +} + +type VulnerabilityCoverageStatus string + +const ( + VulnerabilityCoverageStatusPending VulnerabilityCoverageStatus = "PENDING" + VulnerabilityCoverageStatusScanned VulnerabilityCoverageStatus = "SCANNED" + VulnerabilityCoverageStatusNoSbom VulnerabilityCoverageStatus = "NO_SBOM" + VulnerabilityCoverageStatusFailed VulnerabilityCoverageStatus = "FAILED" + VulnerabilityCoverageStatusUnresolvedImage VulnerabilityCoverageStatus = "UNRESOLVED_IMAGE" +) + +func (v VulnerabilityCoverageStatus) MarshalGQL(w io.Writer) { + _, _ = io.WriteString(w, strconv.Quote(string(v))) +} + +func (v *VulnerabilityCoverageStatus) UnmarshalGQL(value any) error { + s, err := enumValue(value, "PENDING", "SCANNED", "NO_SBOM", "FAILED", "UNRESOLVED_IMAGE") + *v = VulnerabilityCoverageStatus(s) + return err +} + +type VulnerabilitySuppressionState string + +const ( + VulnerabilitySuppressionStateNotAffected VulnerabilitySuppressionState = "NOT_AFFECTED" + VulnerabilitySuppressionStateFalsePositive VulnerabilitySuppressionState = "FALSE_POSITIVE" + VulnerabilitySuppressionStateAcceptedRisk VulnerabilitySuppressionState = "ACCEPTED_RISK" +) + +func (v VulnerabilitySuppressionState) MarshalGQL(w io.Writer) { + _, _ = io.WriteString(w, strconv.Quote(string(v))) +} + +func (v *VulnerabilitySuppressionState) UnmarshalGQL(value any) error { + s, err := enumValue(value, "NOT_AFFECTED", "FALSE_POSITIVE", "ACCEPTED_RISK") + *v = VulnerabilitySuppressionState(s) + return err +} + +func enumValue(value any, allowed ...string) (string, error) { + s, ok := value.(string) + if !ok || !slices.Contains(allowed, s) { + return "", fmt.Errorf("invalid enum value") + } + return s, nil +} diff --git a/internal/v0s/mutations.go b/internal/v0s/mutations.go new file mode 100644 index 000000000..1a873d1bd --- /dev/null +++ b/internal/v0s/mutations.go @@ -0,0 +1,131 @@ +package v0s + +import ( + "context" + "strings" + + "github.com/nais/api/internal/activitylog" + "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/graph/apierror" + "github.com/nais/api/internal/slug" + "github.com/nais/api/internal/v0s/protoapi" +) + +func writeManager(ctx context.Context, team slug.Slug) (*Manager, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + if err := team.Validate(); err != nil { + return nil, err + } + m, _ := ctx.Value(managerKey).(*Manager) + if m == nil || !m.SuppressionsEnabled { + return nil, apierror.Errorf("Assessment writes are disabled during migration; use updateImageVulnerability.") + } + if m.Suppressions == nil { + return nil, apierror.Errorf("Assessment writes are not configured.") + } + if err := authz.CanUpdateVulnerability(ctx, team); err != nil { + return nil, err + } + return m, nil +} + +func suppressionKey(input *VulnerabilitySuppressionKeyInput) (*protoapi.SuppressionKey, error) { + if input == nil || strings.TrimSpace(input.Environment) == "" || + strings.TrimSpace(input.Workload) == "" || strings.TrimSpace(input.ImageName) == "" || + strings.TrimSpace(input.PackageKey) == "" || strings.TrimSpace(input.VulnerabilityIdentifier) == "" { + return nil, apierror.Errorf("All suppression key fields must be non-empty") + } + return &protoapi.SuppressionKey{ + Environment: input.Environment, Workload: input.Workload, ImageName: input.ImageName, + Package: input.PackageKey, VulnerabilityId: input.VulnerabilityIdentifier, + }, nil +} + +func SetSuppressions(ctx context.Context, input SetVulnerabilitySuppressionsInput) (*SetVulnerabilitySuppressionsPayload, error) { + if len(input.Items) == 0 { + return nil, apierror.Errorf("items cannot be empty") + } + m, err := writeManager(ctx, input.Team) + if err != nil { + return nil, err + } + req := &protoapi.SetSuppressionsRequest{ + Team: input.Team.String(), Actor: authz.ActorFromContext(ctx).User.Identity(), + } + for _, item := range input.Items { + if item == nil { + return nil, apierror.Errorf("suppression item cannot be null") + } + if strings.TrimSpace(item.Reason) == "" { + return nil, apierror.Errorf("reason cannot be empty") + } + key, err := suppressionKey(item.Key) + if err != nil { + return nil, err + } + var state protoapi.SuppressionState + switch item.State { + case VulnerabilitySuppressionStateNotAffected: + state = protoapi.SuppressionState_SUPPRESSION_STATE_NOT_AFFECTED + case VulnerabilitySuppressionStateFalsePositive: + state = protoapi.SuppressionState_SUPPRESSION_STATE_FALSE_POSITIVE + case VulnerabilitySuppressionStateAcceptedRisk: + state = protoapi.SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK + default: + return nil, apierror.Errorf("invalid suppression state") + } + req.Suppressions = append(req.Suppressions, &protoapi.NewSuppression{Key: key, State: state, Detail: item.Reason}) + } + resp, err := m.Suppressions.SetSuppressions(ctx, req) + if err != nil { + return nil, backendError("set v0s suppressions", err) + } + result := &SetVulnerabilitySuppressionsPayload{Suppressions: make([]*VulnerabilitySuppression, 0, len(resp.GetSuppressions()))} + for _, value := range resp.GetSuppressions() { + s, err := suppression(value) + if err != nil { + return nil, err + } + if err := recordAssessment(ctx, activitylog.ActivityLogEntryActionUpdated, s); err != nil { + return nil, err + } + result.Suppressions = append(result.Suppressions, s) + } + return result, nil +} + +func DeleteSuppressions(ctx context.Context, input DeleteVulnerabilitySuppressionsInput) (*DeleteVulnerabilitySuppressionsPayload, error) { + if len(input.Keys) == 0 { + return nil, apierror.Errorf("keys cannot be empty") + } + m, err := writeManager(ctx, input.Team) + if err != nil { + return nil, err + } + req := &protoapi.DeleteSuppressionsRequest{Team: input.Team.String()} + for _, input := range input.Keys { + key, err := suppressionKey(input) + if err != nil { + return nil, err + } + req.Keys = append(req.Keys, key) + } + resp, err := m.Suppressions.DeleteSuppressions(ctx, req) + if err != nil { + return nil, backendError("delete v0s suppressions", err) + } + result := &DeleteVulnerabilitySuppressionsPayload{Deleted: make([]*VulnerabilitySuppression, 0, len(resp.GetDeleted()))} + for _, value := range resp.GetDeleted() { + s, err := suppression(value) + if err != nil { + return nil, err + } + if err := recordAssessment(ctx, activitylog.ActivityLogEntryActionDeleted, s); err != nil { + return nil, err + } + result.Deleted = append(result.Deleted, s) + } + return result, nil +} diff --git a/internal/v0s/mutations_integration_test.go b/internal/v0s/mutations_integration_test.go new file mode 100644 index 000000000..e9fb5f676 --- /dev/null +++ b/internal/v0s/mutations_integration_test.go @@ -0,0 +1,164 @@ +//go:build integration_test + +package v0s_test + +import ( + "context" + "encoding/json" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/uuid" + "github.com/nais/api/internal/activitylog" + "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/database" + "github.com/nais/api/internal/slug" + "github.com/nais/api/internal/v0s" + "github.com/nais/api/internal/v0s/protoapi" + logrustest "github.com/sirupsen/logrus/hooks/test" + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/modules/postgres" + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type writeClient struct { + *client + set *protoapi.SetSuppressionsRequest + delete *protoapi.DeleteSuppressionsRequest +} + +func (c *writeClient) SetSuppressions(_ context.Context, req *protoapi.SetSuppressionsRequest, _ ...grpc.CallOption) (*protoapi.SetSuppressionsResponse, error) { + c.set = req + return &protoapi.SetSuppressionsResponse{Suppressions: c.assessments}, nil +} + +func (c *writeClient) DeleteSuppressions(_ context.Context, req *protoapi.DeleteSuppressionsRequest, _ ...grpc.CallOption) (*protoapi.DeleteSuppressionsResponse, error) { + c.delete = req + return &protoapi.DeleteSuppressionsResponse{Deleted: c.assessments}, nil +} + +func TestAuthorizedAssessmentBatchesRecordActivity(t *testing.T) { + ctx := t.Context() + container, err := postgres.Run(ctx, "docker.io/postgres:16-alpine", + postgres.WithDatabase("test"), postgres.WithUsername("test"), postgres.WithPassword("test"), + postgres.BasicWaitStrategies()) + if err != nil { + t.Fatal(err) + } + testcontainers.CleanupContainer(t, container) + dsn, err := container.ConnectionString(ctx, "sslmode=disable") + if err != nil { + t.Fatal(err) + } + log, _ := logrustest.NewNullLogger() + pool, err := database.NewPool(ctx, dsn, log, true) + if err != nil { + t.Fatal(err) + } + t.Cleanup(pool.Close) + if _, err := pool.Exec(ctx, ` + INSERT INTO teams (slug, purpose, slack_channel) VALUES ('team-one', 'test', '#test'); + `); err != nil { + t.Fatal(err) + } + c := &writeClient{client: &client{}} + ctx = authz.ContextWithActor(ctx, actor{}, []*authz.Role{{Name: "Team member", TargetTeamSlug: new(slug.Slug("team-one"))}}) + ctx = authz.NewLoaderContext(ctx, pool) + ctx = activitylog.NewLoaderContext(ctx, pool) + ctx = v0s.WithManager(ctx, &v0s.Manager{Vulnerabilities: c, Suppressions: c, SuppressionsEnabled: true}) + keys := []*v0s.VulnerabilitySuppressionKeyInput{} + items := []*v0s.NewVulnerabilitySuppressionInput{} + for _, name := range []string{"app", "job"} { + key := &v0s.VulnerabilitySuppressionKeyInput{ + Environment: "dev", Workload: name, ImageName: "repo/shared", + PackageKey: "pkg:npm/example", VulnerabilityIdentifier: "CVE-1", + } + keys = append(keys, key) + items = append(items, &v0s.NewVulnerabilitySuppressionInput{ + Key: key, State: v0s.VulnerabilitySuppressionStateAcceptedRisk, Reason: "assessed", + }) + c.assessments = append(c.assessments, &protoapi.Suppression{ + Team: "team-one", Environment: "dev", Workload: name, ImageName: "repo/shared", + PackageKey: "pkg:npm/example", VulnerabilityId: "CVE-1", + State: protoapi.SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK, + Detail: "assessed", UpdatedBy: "actor-1", UpdatedAt: timestamppb.Now(), + }) + } + items[1].Reason = "" + if _, err := v0s.SetSuppressions(ctx, v0s.SetVulnerabilitySuppressionsInput{Team: "team-one", Items: items}); err == nil || c.set != nil { + t.Fatal("an invalid batch reached the backend") + } + items[1].Reason = "assessed" + set, err := v0s.SetSuppressions(ctx, v0s.SetVulnerabilitySuppressionsInput{Team: "team-one", Items: items}) + if err != nil { + t.Fatal(err) + } + if c.set.GetTeam() != "team-one" || c.set.GetActor() != "actor-1" || len(c.set.GetSuppressions()) != 2 || + c.set.GetSuppressions()[1].GetKey().GetWorkload() != "job" || len(set.Suppressions) != 2 { + t.Fatalf("assessment batch or authenticated actor was not preserved: %v", c.set) + } + deleted, err := v0s.DeleteSuppressions(ctx, v0s.DeleteVulnerabilitySuppressionsInput{Team: "team-one", Keys: keys}) + if err != nil { + t.Fatal(err) + } + if c.delete.GetTeam() != "team-one" || len(c.delete.GetKeys()) != 2 || len(deleted.Deleted) != 2 { + t.Fatalf("deletion batch was not preserved: %v", c.delete) + } + rows, err := pool.Query(ctx, ` + SELECT id, action, actor, team_slug, environment, resource_name, data + FROM activity_log_entries + WHERE resource_type = 'VULNERABILITY_SUPPRESSION' + ORDER BY action, resource_name`) + if err != nil { + t.Fatal(err) + } + defer rows.Close() + count := 0 + for rows.Next() { + var id uuid.UUID + var action, actorID, team, environment, name string + var data []byte + if err := rows.Scan(&id, &action, &actorID, &team, &environment, &name, &data); err != nil { + t.Fatal(err) + } + var entry v0s.VulnerabilitySuppressionActivityLogEntryData + if err := json.Unmarshal(data, &entry); err != nil { + t.Fatal(err) + } + if actorID != "actor-1" || team != "team-one" || environment != "dev" || + (action != "UPDATED" && action != "DELETED") || entry.Assessment == nil || + entry.Assessment.Workload != name || entry.Assessment.Reason != "assessed" { + t.Fatalf("incorrect activity: %s, %s, %s, %s, %s, %s", action, actorID, team, environment, name, data) + } + entries := set.Suppressions + if action == "DELETED" { + entries = deleted.Deleted + } + want := entries[0] + if name == "job" { + want = entries[1] + } + if diff := cmp.Diff(want, entry.Assessment); diff != "" { + t.Fatalf("activity lost assessment details (-want +got):\n%s", diff) + } + loaded, err := activitylog.Get(ctx, id) + if err != nil { + t.Fatal(err) + } + typed, ok := loaded.(v0s.VulnerabilitySuppressionActivityLogEntry) + if !ok { + t.Fatalf("assessment activity could not be read through its domain type: %T", loaded) + } + if diff := cmp.Diff(entry.Assessment, typed.Data.Assessment); diff != "" { + t.Fatalf("reading activity lost assessment details (-want +got):\n%s", diff) + } + count++ + } + if err := rows.Err(); err != nil { + t.Fatal(err) + } + if count != 4 { + t.Fatalf("recorded %d assessment activities, want two updates and two deletions", count) + } +} diff --git a/internal/v0s/node.go b/internal/v0s/node.go new file mode 100644 index 000000000..19b5c1b92 --- /dev/null +++ b/internal/v0s/node.go @@ -0,0 +1,133 @@ +package v0s + +import ( + "context" + "net/url" + + "github.com/nais/api/internal/graph/apierror" + "github.com/nais/api/internal/graph/ident" + "github.com/nais/api/internal/graph/pagination" + "github.com/nais/api/internal/slug" +) + +type identType int + +const ( + identFinding identType = iota + identAdvisory + identSuppression +) + +func init() { + ident.RegisterIdentType(identFinding, "VFI", getFindingByIdent) + ident.RegisterIdentType(identAdvisory, "VAD", getAdvisoryByIdent) + ident.RegisterIdentType(identSuppression, "VAS", getSuppressionByIdent) +} + +func newIdent(kind identType, parts ...string) ident.Ident { + for i, part := range parts { + parts[i] = url.QueryEscape(part) + } + return ident.NewIdent(kind, parts...) +} + +func identParts(id ident.Ident, count int) ([]string, error) { + parts := id.Parts() + if len(parts) != count { + return nil, apierror.Errorf("Invalid vulnerability node ID.") + } + for i, part := range parts { + value, err := url.QueryUnescape(part) + if err != nil { + return nil, apierror.Errorf("Invalid vulnerability node ID.") + } + parts[i] = value + } + return parts, nil +} + +func (*VulnerabilityFinding) IsNode() {} + +func (f *VulnerabilityFinding) ID() ident.Ident { + return newIdent(identFinding, f.Workload.Environment, f.Workload.Team.String(), f.Workload.Name, + f.Image.Name, f.Image.Digest, f.VulnerabilityIdentifier, f.Purl) +} + +func (*Vulnerability) IsNode() {} + +func (v *Vulnerability) ID() ident.Ident { + return newIdent(identAdvisory, v.Identifier) +} + +func (*VulnerabilitySuppression) IsNode() {} + +func (s *VulnerabilitySuppression) ID() ident.Ident { + return newIdent(identSuppression, s.Team.String(), s.Environment, s.Workload, s.ImageName, s.PackageKey, s.VulnerabilityIdentifier) +} + +func getAdvisoryByIdent(ctx context.Context, id ident.Ident) (*Vulnerability, error) { + parts, err := identParts(id, 1) + if err != nil { + return nil, err + } + value, err := VulnerabilityByIdentifier(ctx, parts[0]) + if err != nil { + return nil, err + } + if value == nil { + return nil, apierror.ErrNotFound + } + return value, nil +} + +func getFindingByIdent(ctx context.Context, id ident.Ident) (*VulnerabilityFinding, error) { + parts, err := identParts(id, 7) + if err != nil { + return nil, err + } + input := &VulnerabilityScopeInput{Environment: &parts[0], Team: new(slug.Slug(parts[1])), Workload: &parts[2]} + filter := &VulnerabilityFindingFilter{ + VulnerabilityIdentifier: &parts[5], Package: &parts[6], Suppressed: new(SuppressedFilterInclude), + } + var after *pagination.Cursor + for { + result, err := Findings(ctx, input, filter, new(maxPageSize), after) + if err != nil { + return nil, err + } + for _, value := range result.Nodes() { + if value.ID() == id { + return value, nil + } + } + if !result.PageInfo.HasNextPage { + return nil, apierror.ErrNotFound + } + after = result.PageInfo.EndCursor + } +} + +func getSuppressionByIdent(ctx context.Context, id ident.Ident) (*VulnerabilitySuppression, error) { + parts, err := identParts(id, 6) + if err != nil { + return nil, err + } + input := &VulnerabilityScopeInput{Team: new(slug.Slug(parts[0])), Environment: &parts[1], Workload: &parts[2]} + filter := &VulnerabilitySuppressionFilter{ImageName: &parts[3], VulnerabilityIdentifier: &parts[5]} + var after *pagination.Cursor + for { + result, err := Suppressions(ctx, input, filter, new(maxPageSize), after) + if err != nil { + return nil, err + } + for _, value := range result.Nodes() { + if value.ID() == id { + return value, nil + } + } + if !result.PageInfo.HasNextPage { + return nil, apierror.ErrNotFound + } + after = result.PageInfo.EndCursor + } +} diff --git a/internal/v0s/pagination.go b/internal/v0s/pagination.go new file mode 100644 index 000000000..b2435b157 --- /dev/null +++ b/internal/v0s/pagination.go @@ -0,0 +1,113 @@ +package v0s + +import ( + "context" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "math" + + "github.com/nais/api/internal/graph/apierror" + "github.com/nais/api/internal/graph/pagination" +) + +const maxPageSize = 200 + +type pageCursor struct { + Version int `json:"version"` + Selection string `json:"selection"` + Token string `json:"token"` + // Offset tracks the display position; only Token controls the backend seek. + Offset int `json:"offset"` +} + +type page struct { + size int + cursor pageCursor + previous bool +} + +func selectionKey(operation, filter string) string { + sum := sha256.Sum256([]byte(operation + ":" + filter)) + return base64.RawURLEncoding.EncodeToString(sum[:]) +} + +func parsePage(first *int, after *pagination.Cursor, selection string) (*page, error) { + p := &page{size: pagination.DefaultPageSize, cursor: pageCursor{Version: 1, Selection: selection}, previous: after != nil} + if first != nil { + p.size = *first + } + if p.size < 1 || p.size > maxPageSize { + return nil, apierror.Errorf("first must be between 1 and %d", maxPageSize) + } + if after != nil { + data, err := base64.RawURLEncoding.DecodeString(after.Opaque) + var cursor pageCursor + if err != nil || after.Opaque == "" || json.Unmarshal(data, &cursor) != nil || + cursor.Version != 1 || cursor.Selection != selection || cursor.Token == "" || + cursor.Offset < 0 || cursor.Offset > math.MaxInt32-maxPageSize { + return nil, apierror.Errorf("Cursor does not belong to this vulnerability selection") + } + p.cursor = cursor + } + return p, nil +} + +func readPage[T any](ctx context.Context, p *page, + fetch func(context.Context, int32, string) ([]T, []string, string, error), keep func(T) bool, +) ([]pagination.Edge[T], pagination.PageInfo, error) { + edges := make([]pagination.Edge[T], 0, p.size+1) + token := p.cursor.Token + offset := 0 + if p.previous { + offset = p.cursor.Offset + 1 + } + info := pagination.PageInfo{HasPreviousPage: p.previous} + for { + if err := ctx.Err(); err != nil { + return nil, pagination.PageInfo{}, err + } + values, cursors, next, err := fetch(ctx, int32(p.size+1-len(edges)), token) + if err != nil { + return nil, pagination.PageInfo{}, err + } + if len(values) != len(cursors) { + return nil, pagination.PageInfo{}, apierror.Errorf("Vulnerability pagination is not available yet.") + } + for i, value := range values { + if cursors[i] == "" { + return nil, pagination.PageInfo{}, fmt.Errorf("v0s returned an empty item cursor") + } + if !keep(value) { + continue + } + position := offset + len(edges) + end := pageCursor{Version: 1, Selection: p.cursor.Selection, Token: cursors[i], Offset: position} + data, err := json.Marshal(end) + if err != nil { + return nil, pagination.PageInfo{}, fmt.Errorf("encode vulnerability cursor: %w", err) + } + edges = append(edges, pagination.Edge[T]{Node: value, Cursor: pagination.Cursor{ + Opaque: base64.RawURLEncoding.EncodeToString(data), + Offset: position, + }}) + if len(edges) > p.size { + info.HasNextPage = true + edges = edges[:p.size] + break + } + } + if info.HasNextPage || next == "" { + if len(edges) > 0 { + info.StartCursor = &edges[0].Cursor + info.EndCursor = &edges[len(edges)-1].Cursor + } + return edges, info, nil + } + if next == token { + return nil, pagination.PageInfo{}, fmt.Errorf("v0s returned a non-advancing cursor") + } + token = next + } +} diff --git a/internal/v0s/protoapi/schema/v0s.proto b/internal/v0s/protoapi/schema/v0s.proto new file mode 100644 index 000000000..61255e3d6 --- /dev/null +++ b/internal/v0s/protoapi/schema/v0s.proto @@ -0,0 +1,286 @@ +// Vendored from nais/v0s proto/v0s/v1/v0s.proto at +// 1e0095d62c1bb4f385c8cdcba8bf05de38a65aa6. The generator overrides go_package. +syntax = "proto3"; + +package v0s.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/nais/v0s/api/v0s/v1;v0sv1"; + +service VulnerabilityService { + rpc ListWorkloads(ListWorkloadsRequest) returns (ListWorkloadsResponse); + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse); + rpc CountFindings(CountFindingsRequest) returns (CountFindingsResponse); + rpc GetVulnerability(GetVulnerabilityRequest) returns (GetVulnerabilityResponse); + rpc SearchComponents(SearchComponentsRequest) returns (SearchComponentsResponse); +} + +service SuppressionService { + rpc SetSuppressions(SetSuppressionsRequest) returns (SetSuppressionsResponse); + rpc DeleteSuppressions(DeleteSuppressionsRequest) returns (DeleteSuppressionsResponse); + rpc ListSuppressions(ListSuppressionsRequest) returns (ListSuppressionsResponse); +} + +enum Severity { + SEVERITY_UNSPECIFIED = 0; + SEVERITY_UNKNOWN = 1; + SEVERITY_LOW = 2; + SEVERITY_MEDIUM = 3; + SEVERITY_HIGH = 4; + SEVERITY_CRITICAL = 5; +} + +enum ImageStatus { + IMAGE_STATUS_UNSPECIFIED = 0; + IMAGE_STATUS_PENDING = 1; + IMAGE_STATUS_SCANNED = 2; + IMAGE_STATUS_NO_SBOM = 3; + IMAGE_STATUS_FAILED = 4; +} + +enum SuppressionState { + SUPPRESSION_STATE_UNSPECIFIED = 0; + SUPPRESSION_STATE_NOT_AFFECTED = 1; + SUPPRESSION_STATE_FALSE_POSITIVE = 2; + SUPPRESSION_STATE_ACCEPTED_RISK = 3; +} + +message Image { + reserved 3, 4, 6, 7; + reserved "scanned_db_version"; + string name = 1; + string digest = 2; + ImageStatus status = 8; + string error = 9; + google.protobuf.Timestamp scanned_at = 5; +} + +message Workload { + string environment = 1; + string team = 2; + string name = 3; + string image_reference = 5; + Image image = 4; + string resolve_error = 6; +} + +message FindingFilter { + reserved 1; + reserved "teams", "kev"; + string team = 12; + string environment = 2; + string workload = 3; + string image_name = 4; + string image_digest = 5; + string vulnerability_id = 6; + string package = 7; + repeated Severity severities = 8; + bool has_fix = 9; + bool only_known_exploited = 10; + SuppressedFilter suppressed = 11; +} + +enum SuppressedFilter { + SUPPRESSED_FILTER_UNSPECIFIED = 0; + SUPPRESSED_FILTER_EXCLUDE = 1; + SUPPRESSED_FILTER_INCLUDE = 2; + SUPPRESSED_FILTER_ONLY = 3; +} + +message Finding { + reserved 8, 12, 13, 15; + reserved "status", "title", "cvss_score", "kev"; + WorkloadRef workload = 1; + Image image = 2; + string vulnerability_id = 3; + string purl = 4; + string package_key = 5; + string installed_version = 6; + string fixed_version = 7; + Severity severity = 9; + string severity_source = 10; + string data_source = 11; + Epss epss = 14; + bool known_exploited = 17; + Suppression suppression = 16; +} + +message Epss { + reserved 2; + reserved "percentile"; + double score = 1; + string date = 3; +} + +message ListWorkloadsRequest { + reserved 1; + reserved "teams"; + string team = 5; + string environment = 2; + string workload = 6; + int32 page_size = 3; + string page_token = 4; +} + +message ListWorkloadsResponse { + repeated Workload workloads = 1; + string next_page_token = 2; +} + +message ListFindingsRequest { + FindingFilter filter = 1; + int32 page_size = 2; + string page_token = 3; +} + +message ListFindingsResponse { + repeated Finding findings = 1; + string next_page_token = 2; + repeated string cursors = 3; +} + +message CountFindingsRequest { + FindingFilter filter = 1; + GroupBy group_by = 2; + enum GroupBy { + GROUP_BY_UNSPECIFIED = 0; + GROUP_BY_SEVERITY = 1; + GROUP_BY_TEAM = 2; + GROUP_BY_WORKLOAD = 3; + GROUP_BY_IMAGE = 4; + GROUP_BY_VULNERABILITY = 5; + } +} + +message CountFindingsResponse { + repeated Bucket buckets = 1; + message Bucket { + string key = 1; + int64 count = 2; + } +} + +message GetVulnerabilityRequest { + string id = 1; +} + +message GetVulnerabilityResponse { + Vulnerability vulnerability = 1; +} + +message Vulnerability { + reserved 5, 8, 9, 11; + reserved "severities", "published_at", "modified_at", "kev"; + string id = 1; + repeated string aliases = 2; + string title = 3; + string description = 4; + repeated Cvss cvss = 6; + repeated string references = 7; + Epss epss = 10; + bool known_exploited = 12; +} + +message Cvss { + reserved 2, 3, 4, 5; + reserved "v3_vector", "v3_score", "v40_vector", "v40_score"; + string source = 1; + string version = 6; + optional double score = 7; + optional string vector = 8; +} + +message SearchComponentsRequest { + reserved 2; + reserved "teams"; + string query = 1; + string team = 5; + int32 page_size = 3; + string page_token = 4; +} + +message SearchComponentsResponse { + repeated ComponentMatch matches = 1; + string next_page_token = 2; +} + +message ComponentMatch { + string purl = 1; + string name = 2; + string version = 3; + Image image = 4; + repeated WorkloadRef workloads = 5; +} + +message WorkloadRef { + string environment = 1; + string team = 2; + string name = 3; +} + +message SuppressionKey { + string image_name = 1; + string package = 2; + string vulnerability_id = 3; + string environment = 4; + string workload = 5; +} + +message Suppression { + reserved 9; + string team = 1; + string image_name = 2; + string package_key = 3; + string vulnerability_id = 4; + SuppressionState state = 5; + string detail = 6; + string updated_by = 7; + google.protobuf.Timestamp updated_at = 8; + string environment = 10; + string workload = 11; +} + +message NewSuppression { + reserved 4; + SuppressionKey key = 1; + SuppressionState state = 2; + string detail = 3; +} + +message SetSuppressionsRequest { + string team = 1; + string actor = 2; + repeated NewSuppression suppressions = 3; +} + +message SetSuppressionsResponse { + repeated Suppression suppressions = 1; +} + +message DeleteSuppressionsRequest { + string team = 1; + repeated SuppressionKey keys = 2; +} + +message DeleteSuppressionsResponse { + repeated Suppression deleted = 1; +} + +message ListSuppressionsRequest { + reserved 1; + reserved "teams"; + string team = 8; + string image_name = 2; + string vulnerability_id = 3; + int32 page_size = 4; + string page_token = 5; + string environment = 6; + string workload = 7; +} + +message ListSuppressionsResponse { + repeated Suppression suppressions = 1; + string next_page_token = 2; + repeated string cursors = 3; +} diff --git a/internal/v0s/protoapi/v0s.pb.go b/internal/v0s/protoapi/v0s.pb.go new file mode 100644 index 000000000..84939ab9d --- /dev/null +++ b/internal/v0s/protoapi/v0s.pb.go @@ -0,0 +1,2838 @@ +// Vendored from nais/v0s proto/v0s/v1/v0s.proto at +// 1e0095d62c1bb4f385c8cdcba8bf05de38a65aa6. The generator overrides go_package. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.4 +// protoc v5.29.3 +// source: v0s.proto + +package protoapi + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Severity int32 + +const ( + Severity_SEVERITY_UNSPECIFIED Severity = 0 + Severity_SEVERITY_UNKNOWN Severity = 1 + Severity_SEVERITY_LOW Severity = 2 + Severity_SEVERITY_MEDIUM Severity = 3 + Severity_SEVERITY_HIGH Severity = 4 + Severity_SEVERITY_CRITICAL Severity = 5 +) + +// Enum value maps for Severity. +var ( + Severity_name = map[int32]string{ + 0: "SEVERITY_UNSPECIFIED", + 1: "SEVERITY_UNKNOWN", + 2: "SEVERITY_LOW", + 3: "SEVERITY_MEDIUM", + 4: "SEVERITY_HIGH", + 5: "SEVERITY_CRITICAL", + } + Severity_value = map[string]int32{ + "SEVERITY_UNSPECIFIED": 0, + "SEVERITY_UNKNOWN": 1, + "SEVERITY_LOW": 2, + "SEVERITY_MEDIUM": 3, + "SEVERITY_HIGH": 4, + "SEVERITY_CRITICAL": 5, + } +) + +func (x Severity) Enum() *Severity { + p := new(Severity) + *p = x + return p +} + +func (x Severity) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Severity) Descriptor() protoreflect.EnumDescriptor { + return file_v0s_proto_enumTypes[0].Descriptor() +} + +func (Severity) Type() protoreflect.EnumType { + return &file_v0s_proto_enumTypes[0] +} + +func (x Severity) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Severity.Descriptor instead. +func (Severity) EnumDescriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{0} +} + +type ImageStatus int32 + +const ( + ImageStatus_IMAGE_STATUS_UNSPECIFIED ImageStatus = 0 + ImageStatus_IMAGE_STATUS_PENDING ImageStatus = 1 + ImageStatus_IMAGE_STATUS_SCANNED ImageStatus = 2 + ImageStatus_IMAGE_STATUS_NO_SBOM ImageStatus = 3 + ImageStatus_IMAGE_STATUS_FAILED ImageStatus = 4 +) + +// Enum value maps for ImageStatus. +var ( + ImageStatus_name = map[int32]string{ + 0: "IMAGE_STATUS_UNSPECIFIED", + 1: "IMAGE_STATUS_PENDING", + 2: "IMAGE_STATUS_SCANNED", + 3: "IMAGE_STATUS_NO_SBOM", + 4: "IMAGE_STATUS_FAILED", + } + ImageStatus_value = map[string]int32{ + "IMAGE_STATUS_UNSPECIFIED": 0, + "IMAGE_STATUS_PENDING": 1, + "IMAGE_STATUS_SCANNED": 2, + "IMAGE_STATUS_NO_SBOM": 3, + "IMAGE_STATUS_FAILED": 4, + } +) + +func (x ImageStatus) Enum() *ImageStatus { + p := new(ImageStatus) + *p = x + return p +} + +func (x ImageStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ImageStatus) Descriptor() protoreflect.EnumDescriptor { + return file_v0s_proto_enumTypes[1].Descriptor() +} + +func (ImageStatus) Type() protoreflect.EnumType { + return &file_v0s_proto_enumTypes[1] +} + +func (x ImageStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ImageStatus.Descriptor instead. +func (ImageStatus) EnumDescriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{1} +} + +type SuppressionState int32 + +const ( + SuppressionState_SUPPRESSION_STATE_UNSPECIFIED SuppressionState = 0 + SuppressionState_SUPPRESSION_STATE_NOT_AFFECTED SuppressionState = 1 + SuppressionState_SUPPRESSION_STATE_FALSE_POSITIVE SuppressionState = 2 + SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK SuppressionState = 3 +) + +// Enum value maps for SuppressionState. +var ( + SuppressionState_name = map[int32]string{ + 0: "SUPPRESSION_STATE_UNSPECIFIED", + 1: "SUPPRESSION_STATE_NOT_AFFECTED", + 2: "SUPPRESSION_STATE_FALSE_POSITIVE", + 3: "SUPPRESSION_STATE_ACCEPTED_RISK", + } + SuppressionState_value = map[string]int32{ + "SUPPRESSION_STATE_UNSPECIFIED": 0, + "SUPPRESSION_STATE_NOT_AFFECTED": 1, + "SUPPRESSION_STATE_FALSE_POSITIVE": 2, + "SUPPRESSION_STATE_ACCEPTED_RISK": 3, + } +) + +func (x SuppressionState) Enum() *SuppressionState { + p := new(SuppressionState) + *p = x + return p +} + +func (x SuppressionState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SuppressionState) Descriptor() protoreflect.EnumDescriptor { + return file_v0s_proto_enumTypes[2].Descriptor() +} + +func (SuppressionState) Type() protoreflect.EnumType { + return &file_v0s_proto_enumTypes[2] +} + +func (x SuppressionState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SuppressionState.Descriptor instead. +func (SuppressionState) EnumDescriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{2} +} + +type SuppressedFilter int32 + +const ( + SuppressedFilter_SUPPRESSED_FILTER_UNSPECIFIED SuppressedFilter = 0 + SuppressedFilter_SUPPRESSED_FILTER_EXCLUDE SuppressedFilter = 1 + SuppressedFilter_SUPPRESSED_FILTER_INCLUDE SuppressedFilter = 2 + SuppressedFilter_SUPPRESSED_FILTER_ONLY SuppressedFilter = 3 +) + +// Enum value maps for SuppressedFilter. +var ( + SuppressedFilter_name = map[int32]string{ + 0: "SUPPRESSED_FILTER_UNSPECIFIED", + 1: "SUPPRESSED_FILTER_EXCLUDE", + 2: "SUPPRESSED_FILTER_INCLUDE", + 3: "SUPPRESSED_FILTER_ONLY", + } + SuppressedFilter_value = map[string]int32{ + "SUPPRESSED_FILTER_UNSPECIFIED": 0, + "SUPPRESSED_FILTER_EXCLUDE": 1, + "SUPPRESSED_FILTER_INCLUDE": 2, + "SUPPRESSED_FILTER_ONLY": 3, + } +) + +func (x SuppressedFilter) Enum() *SuppressedFilter { + p := new(SuppressedFilter) + *p = x + return p +} + +func (x SuppressedFilter) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SuppressedFilter) Descriptor() protoreflect.EnumDescriptor { + return file_v0s_proto_enumTypes[3].Descriptor() +} + +func (SuppressedFilter) Type() protoreflect.EnumType { + return &file_v0s_proto_enumTypes[3] +} + +func (x SuppressedFilter) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SuppressedFilter.Descriptor instead. +func (SuppressedFilter) EnumDescriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{3} +} + +type CountFindingsRequest_GroupBy int32 + +const ( + CountFindingsRequest_GROUP_BY_UNSPECIFIED CountFindingsRequest_GroupBy = 0 + CountFindingsRequest_GROUP_BY_SEVERITY CountFindingsRequest_GroupBy = 1 + CountFindingsRequest_GROUP_BY_TEAM CountFindingsRequest_GroupBy = 2 + CountFindingsRequest_GROUP_BY_WORKLOAD CountFindingsRequest_GroupBy = 3 + CountFindingsRequest_GROUP_BY_IMAGE CountFindingsRequest_GroupBy = 4 + CountFindingsRequest_GROUP_BY_VULNERABILITY CountFindingsRequest_GroupBy = 5 +) + +// Enum value maps for CountFindingsRequest_GroupBy. +var ( + CountFindingsRequest_GroupBy_name = map[int32]string{ + 0: "GROUP_BY_UNSPECIFIED", + 1: "GROUP_BY_SEVERITY", + 2: "GROUP_BY_TEAM", + 3: "GROUP_BY_WORKLOAD", + 4: "GROUP_BY_IMAGE", + 5: "GROUP_BY_VULNERABILITY", + } + CountFindingsRequest_GroupBy_value = map[string]int32{ + "GROUP_BY_UNSPECIFIED": 0, + "GROUP_BY_SEVERITY": 1, + "GROUP_BY_TEAM": 2, + "GROUP_BY_WORKLOAD": 3, + "GROUP_BY_IMAGE": 4, + "GROUP_BY_VULNERABILITY": 5, + } +) + +func (x CountFindingsRequest_GroupBy) Enum() *CountFindingsRequest_GroupBy { + p := new(CountFindingsRequest_GroupBy) + *p = x + return p +} + +func (x CountFindingsRequest_GroupBy) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CountFindingsRequest_GroupBy) Descriptor() protoreflect.EnumDescriptor { + return file_v0s_proto_enumTypes[4].Descriptor() +} + +func (CountFindingsRequest_GroupBy) Type() protoreflect.EnumType { + return &file_v0s_proto_enumTypes[4] +} + +func (x CountFindingsRequest_GroupBy) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CountFindingsRequest_GroupBy.Descriptor instead. +func (CountFindingsRequest_GroupBy) EnumDescriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{9, 0} +} + +type Image struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Digest string `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"` + Status ImageStatus `protobuf:"varint,8,opt,name=status,proto3,enum=v0s.v1.ImageStatus" json:"status,omitempty"` + Error string `protobuf:"bytes,9,opt,name=error,proto3" json:"error,omitempty"` + ScannedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=scanned_at,json=scannedAt,proto3" json:"scanned_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Image) Reset() { + *x = Image{} + mi := &file_v0s_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Image) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Image) ProtoMessage() {} + +func (x *Image) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Image.ProtoReflect.Descriptor instead. +func (*Image) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{0} +} + +func (x *Image) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Image) GetDigest() string { + if x != nil { + return x.Digest + } + return "" +} + +func (x *Image) GetStatus() ImageStatus { + if x != nil { + return x.Status + } + return ImageStatus_IMAGE_STATUS_UNSPECIFIED +} + +func (x *Image) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *Image) GetScannedAt() *timestamppb.Timestamp { + if x != nil { + return x.ScannedAt + } + return nil +} + +type Workload struct { + state protoimpl.MessageState `protogen:"open.v1"` + Environment string `protobuf:"bytes,1,opt,name=environment,proto3" json:"environment,omitempty"` + Team string `protobuf:"bytes,2,opt,name=team,proto3" json:"team,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + ImageReference string `protobuf:"bytes,5,opt,name=image_reference,json=imageReference,proto3" json:"image_reference,omitempty"` + Image *Image `protobuf:"bytes,4,opt,name=image,proto3" json:"image,omitempty"` + ResolveError string `protobuf:"bytes,6,opt,name=resolve_error,json=resolveError,proto3" json:"resolve_error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Workload) Reset() { + *x = Workload{} + mi := &file_v0s_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Workload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Workload) ProtoMessage() {} + +func (x *Workload) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Workload.ProtoReflect.Descriptor instead. +func (*Workload) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{1} +} + +func (x *Workload) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *Workload) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *Workload) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Workload) GetImageReference() string { + if x != nil { + return x.ImageReference + } + return "" +} + +func (x *Workload) GetImage() *Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *Workload) GetResolveError() string { + if x != nil { + return x.ResolveError + } + return "" +} + +type FindingFilter struct { + state protoimpl.MessageState `protogen:"open.v1"` + Team string `protobuf:"bytes,12,opt,name=team,proto3" json:"team,omitempty"` + Environment string `protobuf:"bytes,2,opt,name=environment,proto3" json:"environment,omitempty"` + Workload string `protobuf:"bytes,3,opt,name=workload,proto3" json:"workload,omitempty"` + ImageName string `protobuf:"bytes,4,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"` + ImageDigest string `protobuf:"bytes,5,opt,name=image_digest,json=imageDigest,proto3" json:"image_digest,omitempty"` + VulnerabilityId string `protobuf:"bytes,6,opt,name=vulnerability_id,json=vulnerabilityId,proto3" json:"vulnerability_id,omitempty"` + Package string `protobuf:"bytes,7,opt,name=package,proto3" json:"package,omitempty"` + Severities []Severity `protobuf:"varint,8,rep,packed,name=severities,proto3,enum=v0s.v1.Severity" json:"severities,omitempty"` + HasFix bool `protobuf:"varint,9,opt,name=has_fix,json=hasFix,proto3" json:"has_fix,omitempty"` + OnlyKnownExploited bool `protobuf:"varint,10,opt,name=only_known_exploited,json=onlyKnownExploited,proto3" json:"only_known_exploited,omitempty"` + Suppressed SuppressedFilter `protobuf:"varint,11,opt,name=suppressed,proto3,enum=v0s.v1.SuppressedFilter" json:"suppressed,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FindingFilter) Reset() { + *x = FindingFilter{} + mi := &file_v0s_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FindingFilter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindingFilter) ProtoMessage() {} + +func (x *FindingFilter) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindingFilter.ProtoReflect.Descriptor instead. +func (*FindingFilter) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{2} +} + +func (x *FindingFilter) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *FindingFilter) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *FindingFilter) GetWorkload() string { + if x != nil { + return x.Workload + } + return "" +} + +func (x *FindingFilter) GetImageName() string { + if x != nil { + return x.ImageName + } + return "" +} + +func (x *FindingFilter) GetImageDigest() string { + if x != nil { + return x.ImageDigest + } + return "" +} + +func (x *FindingFilter) GetVulnerabilityId() string { + if x != nil { + return x.VulnerabilityId + } + return "" +} + +func (x *FindingFilter) GetPackage() string { + if x != nil { + return x.Package + } + return "" +} + +func (x *FindingFilter) GetSeverities() []Severity { + if x != nil { + return x.Severities + } + return nil +} + +func (x *FindingFilter) GetHasFix() bool { + if x != nil { + return x.HasFix + } + return false +} + +func (x *FindingFilter) GetOnlyKnownExploited() bool { + if x != nil { + return x.OnlyKnownExploited + } + return false +} + +func (x *FindingFilter) GetSuppressed() SuppressedFilter { + if x != nil { + return x.Suppressed + } + return SuppressedFilter_SUPPRESSED_FILTER_UNSPECIFIED +} + +type Finding struct { + state protoimpl.MessageState `protogen:"open.v1"` + Workload *WorkloadRef `protobuf:"bytes,1,opt,name=workload,proto3" json:"workload,omitempty"` + Image *Image `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` + VulnerabilityId string `protobuf:"bytes,3,opt,name=vulnerability_id,json=vulnerabilityId,proto3" json:"vulnerability_id,omitempty"` + Purl string `protobuf:"bytes,4,opt,name=purl,proto3" json:"purl,omitempty"` + PackageKey string `protobuf:"bytes,5,opt,name=package_key,json=packageKey,proto3" json:"package_key,omitempty"` + InstalledVersion string `protobuf:"bytes,6,opt,name=installed_version,json=installedVersion,proto3" json:"installed_version,omitempty"` + FixedVersion string `protobuf:"bytes,7,opt,name=fixed_version,json=fixedVersion,proto3" json:"fixed_version,omitempty"` + Severity Severity `protobuf:"varint,9,opt,name=severity,proto3,enum=v0s.v1.Severity" json:"severity,omitempty"` + SeveritySource string `protobuf:"bytes,10,opt,name=severity_source,json=severitySource,proto3" json:"severity_source,omitempty"` + DataSource string `protobuf:"bytes,11,opt,name=data_source,json=dataSource,proto3" json:"data_source,omitempty"` + Epss *Epss `protobuf:"bytes,14,opt,name=epss,proto3" json:"epss,omitempty"` + KnownExploited bool `protobuf:"varint,17,opt,name=known_exploited,json=knownExploited,proto3" json:"known_exploited,omitempty"` + Suppression *Suppression `protobuf:"bytes,16,opt,name=suppression,proto3" json:"suppression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Finding) Reset() { + *x = Finding{} + mi := &file_v0s_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Finding) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Finding) ProtoMessage() {} + +func (x *Finding) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Finding.ProtoReflect.Descriptor instead. +func (*Finding) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{3} +} + +func (x *Finding) GetWorkload() *WorkloadRef { + if x != nil { + return x.Workload + } + return nil +} + +func (x *Finding) GetImage() *Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *Finding) GetVulnerabilityId() string { + if x != nil { + return x.VulnerabilityId + } + return "" +} + +func (x *Finding) GetPurl() string { + if x != nil { + return x.Purl + } + return "" +} + +func (x *Finding) GetPackageKey() string { + if x != nil { + return x.PackageKey + } + return "" +} + +func (x *Finding) GetInstalledVersion() string { + if x != nil { + return x.InstalledVersion + } + return "" +} + +func (x *Finding) GetFixedVersion() string { + if x != nil { + return x.FixedVersion + } + return "" +} + +func (x *Finding) GetSeverity() Severity { + if x != nil { + return x.Severity + } + return Severity_SEVERITY_UNSPECIFIED +} + +func (x *Finding) GetSeveritySource() string { + if x != nil { + return x.SeveritySource + } + return "" +} + +func (x *Finding) GetDataSource() string { + if x != nil { + return x.DataSource + } + return "" +} + +func (x *Finding) GetEpss() *Epss { + if x != nil { + return x.Epss + } + return nil +} + +func (x *Finding) GetKnownExploited() bool { + if x != nil { + return x.KnownExploited + } + return false +} + +func (x *Finding) GetSuppression() *Suppression { + if x != nil { + return x.Suppression + } + return nil +} + +type Epss struct { + state protoimpl.MessageState `protogen:"open.v1"` + Score float64 `protobuf:"fixed64,1,opt,name=score,proto3" json:"score,omitempty"` + Date string `protobuf:"bytes,3,opt,name=date,proto3" json:"date,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Epss) Reset() { + *x = Epss{} + mi := &file_v0s_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Epss) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Epss) ProtoMessage() {} + +func (x *Epss) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Epss.ProtoReflect.Descriptor instead. +func (*Epss) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{4} +} + +func (x *Epss) GetScore() float64 { + if x != nil { + return x.Score + } + return 0 +} + +func (x *Epss) GetDate() string { + if x != nil { + return x.Date + } + return "" +} + +type ListWorkloadsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Team string `protobuf:"bytes,5,opt,name=team,proto3" json:"team,omitempty"` + Environment string `protobuf:"bytes,2,opt,name=environment,proto3" json:"environment,omitempty"` + Workload string `protobuf:"bytes,6,opt,name=workload,proto3" json:"workload,omitempty"` + PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListWorkloadsRequest) Reset() { + *x = ListWorkloadsRequest{} + mi := &file_v0s_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListWorkloadsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListWorkloadsRequest) ProtoMessage() {} + +func (x *ListWorkloadsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListWorkloadsRequest.ProtoReflect.Descriptor instead. +func (*ListWorkloadsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{5} +} + +func (x *ListWorkloadsRequest) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *ListWorkloadsRequest) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *ListWorkloadsRequest) GetWorkload() string { + if x != nil { + return x.Workload + } + return "" +} + +func (x *ListWorkloadsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListWorkloadsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListWorkloadsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Workloads []*Workload `protobuf:"bytes,1,rep,name=workloads,proto3" json:"workloads,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListWorkloadsResponse) Reset() { + *x = ListWorkloadsResponse{} + mi := &file_v0s_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListWorkloadsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListWorkloadsResponse) ProtoMessage() {} + +func (x *ListWorkloadsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListWorkloadsResponse.ProtoReflect.Descriptor instead. +func (*ListWorkloadsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{6} +} + +func (x *ListWorkloadsResponse) GetWorkloads() []*Workload { + if x != nil { + return x.Workloads + } + return nil +} + +func (x *ListWorkloadsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ListFindingsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Filter *FindingFilter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListFindingsRequest) Reset() { + *x = ListFindingsRequest{} + mi := &file_v0s_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListFindingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFindingsRequest) ProtoMessage() {} + +func (x *ListFindingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFindingsRequest.ProtoReflect.Descriptor instead. +func (*ListFindingsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{7} +} + +func (x *ListFindingsRequest) GetFilter() *FindingFilter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *ListFindingsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListFindingsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListFindingsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Findings []*Finding `protobuf:"bytes,1,rep,name=findings,proto3" json:"findings,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + Cursors []string `protobuf:"bytes,3,rep,name=cursors,proto3" json:"cursors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListFindingsResponse) Reset() { + *x = ListFindingsResponse{} + mi := &file_v0s_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListFindingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFindingsResponse) ProtoMessage() {} + +func (x *ListFindingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListFindingsResponse.ProtoReflect.Descriptor instead. +func (*ListFindingsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{8} +} + +func (x *ListFindingsResponse) GetFindings() []*Finding { + if x != nil { + return x.Findings + } + return nil +} + +func (x *ListFindingsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +func (x *ListFindingsResponse) GetCursors() []string { + if x != nil { + return x.Cursors + } + return nil +} + +type CountFindingsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Filter *FindingFilter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` + GroupBy CountFindingsRequest_GroupBy `protobuf:"varint,2,opt,name=group_by,json=groupBy,proto3,enum=v0s.v1.CountFindingsRequest_GroupBy" json:"group_by,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CountFindingsRequest) Reset() { + *x = CountFindingsRequest{} + mi := &file_v0s_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CountFindingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountFindingsRequest) ProtoMessage() {} + +func (x *CountFindingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountFindingsRequest.ProtoReflect.Descriptor instead. +func (*CountFindingsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{9} +} + +func (x *CountFindingsRequest) GetFilter() *FindingFilter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *CountFindingsRequest) GetGroupBy() CountFindingsRequest_GroupBy { + if x != nil { + return x.GroupBy + } + return CountFindingsRequest_GROUP_BY_UNSPECIFIED +} + +type CountFindingsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Buckets []*CountFindingsResponse_Bucket `protobuf:"bytes,1,rep,name=buckets,proto3" json:"buckets,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CountFindingsResponse) Reset() { + *x = CountFindingsResponse{} + mi := &file_v0s_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CountFindingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountFindingsResponse) ProtoMessage() {} + +func (x *CountFindingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountFindingsResponse.ProtoReflect.Descriptor instead. +func (*CountFindingsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{10} +} + +func (x *CountFindingsResponse) GetBuckets() []*CountFindingsResponse_Bucket { + if x != nil { + return x.Buckets + } + return nil +} + +type GetVulnerabilityRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetVulnerabilityRequest) Reset() { + *x = GetVulnerabilityRequest{} + mi := &file_v0s_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetVulnerabilityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVulnerabilityRequest) ProtoMessage() {} + +func (x *GetVulnerabilityRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVulnerabilityRequest.ProtoReflect.Descriptor instead. +func (*GetVulnerabilityRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{11} +} + +func (x *GetVulnerabilityRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetVulnerabilityResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Vulnerability *Vulnerability `protobuf:"bytes,1,opt,name=vulnerability,proto3" json:"vulnerability,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetVulnerabilityResponse) Reset() { + *x = GetVulnerabilityResponse{} + mi := &file_v0s_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetVulnerabilityResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVulnerabilityResponse) ProtoMessage() {} + +func (x *GetVulnerabilityResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVulnerabilityResponse.ProtoReflect.Descriptor instead. +func (*GetVulnerabilityResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{12} +} + +func (x *GetVulnerabilityResponse) GetVulnerability() *Vulnerability { + if x != nil { + return x.Vulnerability + } + return nil +} + +type Vulnerability struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Aliases []string `protobuf:"bytes,2,rep,name=aliases,proto3" json:"aliases,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + Cvss []*Cvss `protobuf:"bytes,6,rep,name=cvss,proto3" json:"cvss,omitempty"` + References []string `protobuf:"bytes,7,rep,name=references,proto3" json:"references,omitempty"` + Epss *Epss `protobuf:"bytes,10,opt,name=epss,proto3" json:"epss,omitempty"` + KnownExploited bool `protobuf:"varint,12,opt,name=known_exploited,json=knownExploited,proto3" json:"known_exploited,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Vulnerability) Reset() { + *x = Vulnerability{} + mi := &file_v0s_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Vulnerability) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Vulnerability) ProtoMessage() {} + +func (x *Vulnerability) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Vulnerability.ProtoReflect.Descriptor instead. +func (*Vulnerability) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{13} +} + +func (x *Vulnerability) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Vulnerability) GetAliases() []string { + if x != nil { + return x.Aliases + } + return nil +} + +func (x *Vulnerability) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Vulnerability) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Vulnerability) GetCvss() []*Cvss { + if x != nil { + return x.Cvss + } + return nil +} + +func (x *Vulnerability) GetReferences() []string { + if x != nil { + return x.References + } + return nil +} + +func (x *Vulnerability) GetEpss() *Epss { + if x != nil { + return x.Epss + } + return nil +} + +func (x *Vulnerability) GetKnownExploited() bool { + if x != nil { + return x.KnownExploited + } + return false +} + +type Cvss struct { + state protoimpl.MessageState `protogen:"open.v1"` + Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` + Score *float64 `protobuf:"fixed64,7,opt,name=score,proto3,oneof" json:"score,omitempty"` + Vector *string `protobuf:"bytes,8,opt,name=vector,proto3,oneof" json:"vector,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Cvss) Reset() { + *x = Cvss{} + mi := &file_v0s_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Cvss) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Cvss) ProtoMessage() {} + +func (x *Cvss) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Cvss.ProtoReflect.Descriptor instead. +func (*Cvss) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{14} +} + +func (x *Cvss) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *Cvss) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Cvss) GetScore() float64 { + if x != nil && x.Score != nil { + return *x.Score + } + return 0 +} + +func (x *Cvss) GetVector() string { + if x != nil && x.Vector != nil { + return *x.Vector + } + return "" +} + +type SearchComponentsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + Team string `protobuf:"bytes,5,opt,name=team,proto3" json:"team,omitempty"` + PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchComponentsRequest) Reset() { + *x = SearchComponentsRequest{} + mi := &file_v0s_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchComponentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchComponentsRequest) ProtoMessage() {} + +func (x *SearchComponentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchComponentsRequest.ProtoReflect.Descriptor instead. +func (*SearchComponentsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{15} +} + +func (x *SearchComponentsRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchComponentsRequest) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *SearchComponentsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *SearchComponentsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type SearchComponentsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Matches []*ComponentMatch `protobuf:"bytes,1,rep,name=matches,proto3" json:"matches,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchComponentsResponse) Reset() { + *x = SearchComponentsResponse{} + mi := &file_v0s_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchComponentsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchComponentsResponse) ProtoMessage() {} + +func (x *SearchComponentsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchComponentsResponse.ProtoReflect.Descriptor instead. +func (*SearchComponentsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{16} +} + +func (x *SearchComponentsResponse) GetMatches() []*ComponentMatch { + if x != nil { + return x.Matches + } + return nil +} + +func (x *SearchComponentsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type ComponentMatch struct { + state protoimpl.MessageState `protogen:"open.v1"` + Purl string `protobuf:"bytes,1,opt,name=purl,proto3" json:"purl,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Image *Image `protobuf:"bytes,4,opt,name=image,proto3" json:"image,omitempty"` + Workloads []*WorkloadRef `protobuf:"bytes,5,rep,name=workloads,proto3" json:"workloads,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentMatch) Reset() { + *x = ComponentMatch{} + mi := &file_v0s_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentMatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentMatch) ProtoMessage() {} + +func (x *ComponentMatch) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentMatch.ProtoReflect.Descriptor instead. +func (*ComponentMatch) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{17} +} + +func (x *ComponentMatch) GetPurl() string { + if x != nil { + return x.Purl + } + return "" +} + +func (x *ComponentMatch) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ComponentMatch) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *ComponentMatch) GetImage() *Image { + if x != nil { + return x.Image + } + return nil +} + +func (x *ComponentMatch) GetWorkloads() []*WorkloadRef { + if x != nil { + return x.Workloads + } + return nil +} + +type WorkloadRef struct { + state protoimpl.MessageState `protogen:"open.v1"` + Environment string `protobuf:"bytes,1,opt,name=environment,proto3" json:"environment,omitempty"` + Team string `protobuf:"bytes,2,opt,name=team,proto3" json:"team,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WorkloadRef) Reset() { + *x = WorkloadRef{} + mi := &file_v0s_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WorkloadRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkloadRef) ProtoMessage() {} + +func (x *WorkloadRef) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkloadRef.ProtoReflect.Descriptor instead. +func (*WorkloadRef) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{18} +} + +func (x *WorkloadRef) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *WorkloadRef) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *WorkloadRef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type SuppressionKey struct { + state protoimpl.MessageState `protogen:"open.v1"` + ImageName string `protobuf:"bytes,1,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"` + Package string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"` + VulnerabilityId string `protobuf:"bytes,3,opt,name=vulnerability_id,json=vulnerabilityId,proto3" json:"vulnerability_id,omitempty"` + Environment string `protobuf:"bytes,4,opt,name=environment,proto3" json:"environment,omitempty"` + Workload string `protobuf:"bytes,5,opt,name=workload,proto3" json:"workload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SuppressionKey) Reset() { + *x = SuppressionKey{} + mi := &file_v0s_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SuppressionKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SuppressionKey) ProtoMessage() {} + +func (x *SuppressionKey) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SuppressionKey.ProtoReflect.Descriptor instead. +func (*SuppressionKey) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{19} +} + +func (x *SuppressionKey) GetImageName() string { + if x != nil { + return x.ImageName + } + return "" +} + +func (x *SuppressionKey) GetPackage() string { + if x != nil { + return x.Package + } + return "" +} + +func (x *SuppressionKey) GetVulnerabilityId() string { + if x != nil { + return x.VulnerabilityId + } + return "" +} + +func (x *SuppressionKey) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *SuppressionKey) GetWorkload() string { + if x != nil { + return x.Workload + } + return "" +} + +type Suppression struct { + state protoimpl.MessageState `protogen:"open.v1"` + Team string `protobuf:"bytes,1,opt,name=team,proto3" json:"team,omitempty"` + ImageName string `protobuf:"bytes,2,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"` + PackageKey string `protobuf:"bytes,3,opt,name=package_key,json=packageKey,proto3" json:"package_key,omitempty"` + VulnerabilityId string `protobuf:"bytes,4,opt,name=vulnerability_id,json=vulnerabilityId,proto3" json:"vulnerability_id,omitempty"` + State SuppressionState `protobuf:"varint,5,opt,name=state,proto3,enum=v0s.v1.SuppressionState" json:"state,omitempty"` + Detail string `protobuf:"bytes,6,opt,name=detail,proto3" json:"detail,omitempty"` + UpdatedBy string `protobuf:"bytes,7,opt,name=updated_by,json=updatedBy,proto3" json:"updated_by,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Environment string `protobuf:"bytes,10,opt,name=environment,proto3" json:"environment,omitempty"` + Workload string `protobuf:"bytes,11,opt,name=workload,proto3" json:"workload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Suppression) Reset() { + *x = Suppression{} + mi := &file_v0s_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Suppression) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Suppression) ProtoMessage() {} + +func (x *Suppression) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Suppression.ProtoReflect.Descriptor instead. +func (*Suppression) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{20} +} + +func (x *Suppression) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *Suppression) GetImageName() string { + if x != nil { + return x.ImageName + } + return "" +} + +func (x *Suppression) GetPackageKey() string { + if x != nil { + return x.PackageKey + } + return "" +} + +func (x *Suppression) GetVulnerabilityId() string { + if x != nil { + return x.VulnerabilityId + } + return "" +} + +func (x *Suppression) GetState() SuppressionState { + if x != nil { + return x.State + } + return SuppressionState_SUPPRESSION_STATE_UNSPECIFIED +} + +func (x *Suppression) GetDetail() string { + if x != nil { + return x.Detail + } + return "" +} + +func (x *Suppression) GetUpdatedBy() string { + if x != nil { + return x.UpdatedBy + } + return "" +} + +func (x *Suppression) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *Suppression) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *Suppression) GetWorkload() string { + if x != nil { + return x.Workload + } + return "" +} + +type NewSuppression struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key *SuppressionKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + State SuppressionState `protobuf:"varint,2,opt,name=state,proto3,enum=v0s.v1.SuppressionState" json:"state,omitempty"` + Detail string `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NewSuppression) Reset() { + *x = NewSuppression{} + mi := &file_v0s_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NewSuppression) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewSuppression) ProtoMessage() {} + +func (x *NewSuppression) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewSuppression.ProtoReflect.Descriptor instead. +func (*NewSuppression) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{21} +} + +func (x *NewSuppression) GetKey() *SuppressionKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *NewSuppression) GetState() SuppressionState { + if x != nil { + return x.State + } + return SuppressionState_SUPPRESSION_STATE_UNSPECIFIED +} + +func (x *NewSuppression) GetDetail() string { + if x != nil { + return x.Detail + } + return "" +} + +type SetSuppressionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Team string `protobuf:"bytes,1,opt,name=team,proto3" json:"team,omitempty"` + Actor string `protobuf:"bytes,2,opt,name=actor,proto3" json:"actor,omitempty"` + Suppressions []*NewSuppression `protobuf:"bytes,3,rep,name=suppressions,proto3" json:"suppressions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetSuppressionsRequest) Reset() { + *x = SetSuppressionsRequest{} + mi := &file_v0s_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetSuppressionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetSuppressionsRequest) ProtoMessage() {} + +func (x *SetSuppressionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetSuppressionsRequest.ProtoReflect.Descriptor instead. +func (*SetSuppressionsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{22} +} + +func (x *SetSuppressionsRequest) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *SetSuppressionsRequest) GetActor() string { + if x != nil { + return x.Actor + } + return "" +} + +func (x *SetSuppressionsRequest) GetSuppressions() []*NewSuppression { + if x != nil { + return x.Suppressions + } + return nil +} + +type SetSuppressionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Suppressions []*Suppression `protobuf:"bytes,1,rep,name=suppressions,proto3" json:"suppressions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetSuppressionsResponse) Reset() { + *x = SetSuppressionsResponse{} + mi := &file_v0s_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetSuppressionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetSuppressionsResponse) ProtoMessage() {} + +func (x *SetSuppressionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetSuppressionsResponse.ProtoReflect.Descriptor instead. +func (*SetSuppressionsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{23} +} + +func (x *SetSuppressionsResponse) GetSuppressions() []*Suppression { + if x != nil { + return x.Suppressions + } + return nil +} + +type DeleteSuppressionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Team string `protobuf:"bytes,1,opt,name=team,proto3" json:"team,omitempty"` + Keys []*SuppressionKey `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSuppressionsRequest) Reset() { + *x = DeleteSuppressionsRequest{} + mi := &file_v0s_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSuppressionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSuppressionsRequest) ProtoMessage() {} + +func (x *DeleteSuppressionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSuppressionsRequest.ProtoReflect.Descriptor instead. +func (*DeleteSuppressionsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{24} +} + +func (x *DeleteSuppressionsRequest) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *DeleteSuppressionsRequest) GetKeys() []*SuppressionKey { + if x != nil { + return x.Keys + } + return nil +} + +type DeleteSuppressionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Deleted []*Suppression `protobuf:"bytes,1,rep,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSuppressionsResponse) Reset() { + *x = DeleteSuppressionsResponse{} + mi := &file_v0s_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSuppressionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSuppressionsResponse) ProtoMessage() {} + +func (x *DeleteSuppressionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSuppressionsResponse.ProtoReflect.Descriptor instead. +func (*DeleteSuppressionsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{25} +} + +func (x *DeleteSuppressionsResponse) GetDeleted() []*Suppression { + if x != nil { + return x.Deleted + } + return nil +} + +type ListSuppressionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Team string `protobuf:"bytes,8,opt,name=team,proto3" json:"team,omitempty"` + ImageName string `protobuf:"bytes,2,opt,name=image_name,json=imageName,proto3" json:"image_name,omitempty"` + VulnerabilityId string `protobuf:"bytes,3,opt,name=vulnerability_id,json=vulnerabilityId,proto3" json:"vulnerability_id,omitempty"` + PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Environment string `protobuf:"bytes,6,opt,name=environment,proto3" json:"environment,omitempty"` + Workload string `protobuf:"bytes,7,opt,name=workload,proto3" json:"workload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSuppressionsRequest) Reset() { + *x = ListSuppressionsRequest{} + mi := &file_v0s_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSuppressionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSuppressionsRequest) ProtoMessage() {} + +func (x *ListSuppressionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSuppressionsRequest.ProtoReflect.Descriptor instead. +func (*ListSuppressionsRequest) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{26} +} + +func (x *ListSuppressionsRequest) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + +func (x *ListSuppressionsRequest) GetImageName() string { + if x != nil { + return x.ImageName + } + return "" +} + +func (x *ListSuppressionsRequest) GetVulnerabilityId() string { + if x != nil { + return x.VulnerabilityId + } + return "" +} + +func (x *ListSuppressionsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListSuppressionsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListSuppressionsRequest) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *ListSuppressionsRequest) GetWorkload() string { + if x != nil { + return x.Workload + } + return "" +} + +type ListSuppressionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Suppressions []*Suppression `protobuf:"bytes,1,rep,name=suppressions,proto3" json:"suppressions,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + Cursors []string `protobuf:"bytes,3,rep,name=cursors,proto3" json:"cursors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSuppressionsResponse) Reset() { + *x = ListSuppressionsResponse{} + mi := &file_v0s_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSuppressionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSuppressionsResponse) ProtoMessage() {} + +func (x *ListSuppressionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSuppressionsResponse.ProtoReflect.Descriptor instead. +func (*ListSuppressionsResponse) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{27} +} + +func (x *ListSuppressionsResponse) GetSuppressions() []*Suppression { + if x != nil { + return x.Suppressions + } + return nil +} + +func (x *ListSuppressionsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +func (x *ListSuppressionsResponse) GetCursors() []string { + if x != nil { + return x.Cursors + } + return nil +} + +type CountFindingsResponse_Bucket struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CountFindingsResponse_Bucket) Reset() { + *x = CountFindingsResponse_Bucket{} + mi := &file_v0s_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CountFindingsResponse_Bucket) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountFindingsResponse_Bucket) ProtoMessage() {} + +func (x *CountFindingsResponse_Bucket) ProtoReflect() protoreflect.Message { + mi := &file_v0s_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountFindingsResponse_Bucket.ProtoReflect.Descriptor instead. +func (*CountFindingsResponse_Bucket) Descriptor() ([]byte, []int) { + return file_v0s_proto_rawDescGZIP(), []int{10, 0} +} + +func (x *CountFindingsResponse_Bucket) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *CountFindingsResponse_Bucket) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +var File_v0s_proto protoreflect.FileDescriptor + +var file_v0s_proto_rawDesc = string([]byte{ + 0x0a, 0x09, 0x76, 0x30, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x76, 0x30, 0x73, + 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x01, 0x0a, 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x76, 0x30, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x39, 0x0a, + 0x0a, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x73, + 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x41, 0x74, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, + 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, + 0x52, 0x12, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x5f, 0x64, 0x62, 0x5f, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xc7, 0x01, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, + 0x6f, 0x6c, 0x76, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xb1, + 0x03, 0x0a, 0x0d, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x65, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, + 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, + 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, + 0x61, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x44, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x73, 0x65, 0x76, + 0x65, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x10, 0x2e, + 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, + 0x0a, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x68, + 0x61, 0x73, 0x5f, 0x66, 0x69, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x61, + 0x73, 0x46, 0x69, 0x78, 0x12, 0x30, 0x0a, 0x14, 0x6f, 0x6e, 0x6c, 0x79, 0x5f, 0x6b, 0x6e, 0x6f, + 0x77, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x69, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x12, 0x6f, 0x6e, 0x6c, 0x79, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x45, 0x78, 0x70, + 0x6c, 0x6f, 0x69, 0x74, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x76, 0x30, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, + 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x03, 0x6b, + 0x65, 0x76, 0x22, 0xc3, 0x04, 0x0a, 0x07, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x2f, + 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, + 0x61, 0x64, 0x52, 0x65, 0x66, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x12, + 0x23, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x75, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x4b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, + 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x69, 0x78, 0x65, 0x64, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, + 0x74, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, + 0x72, 0x69, 0x74, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, + 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, + 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x20, + 0x0a, 0x04, 0x65, 0x70, 0x73, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x76, + 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x70, 0x73, 0x73, 0x52, 0x04, 0x65, 0x70, 0x73, 0x73, + 0x12, 0x27, 0x0a, 0x0f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x69, + 0x74, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, + 0x45, 0x78, 0x70, 0x6c, 0x6f, 0x69, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x0b, 0x73, 0x75, 0x70, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x0c, 0x10, 0x0d, 0x4a, 0x04, 0x08, 0x0d, + 0x10, 0x0e, 0x4a, 0x04, 0x08, 0x0f, 0x10, 0x10, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x52, 0x0a, 0x63, 0x76, 0x73, 0x73, 0x5f, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x52, 0x03, 0x6b, 0x65, 0x76, 0x22, 0x42, 0x0a, 0x04, 0x45, 0x70, 0x73, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, + 0x52, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x22, 0xb1, 0x01, 0x0a, + 0x14, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, + 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x77, + 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, + 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, + 0x22, 0x6f, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x77, 0x6f, 0x72, + 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, + 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x09, + 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x80, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x30, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6e, + 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, + 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x52, 0x08, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x73, 0x22, 0x9d, 0x02, 0x0a, + 0x14, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x46, + 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x62, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x79, 0x52, 0x07, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x42, 0x79, 0x22, 0x94, 0x01, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, + 0x79, 0x12, 0x18, 0x0a, 0x14, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x42, 0x59, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x47, + 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x42, 0x59, 0x5f, 0x53, 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, + 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x42, 0x59, 0x5f, 0x54, + 0x45, 0x41, 0x4d, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x42, + 0x59, 0x5f, 0x57, 0x4f, 0x52, 0x4b, 0x4c, 0x4f, 0x41, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, + 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x42, 0x59, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x10, 0x04, + 0x12, 0x1a, 0x0a, 0x16, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x42, 0x59, 0x5f, 0x56, 0x55, 0x4c, + 0x4e, 0x45, 0x52, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x10, 0x05, 0x22, 0x89, 0x01, 0x0a, + 0x15, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x07, 0x62, + 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x30, 0x0a, 0x06, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x56, + 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x57, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3b, 0x0a, 0x0d, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0d, 0x76, + 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xc2, 0x02, 0x0a, + 0x0d, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x20, 0x0a, 0x04, 0x63, 0x76, 0x73, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, + 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x76, 0x73, 0x73, 0x52, 0x04, 0x63, 0x76, + 0x73, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x73, 0x12, 0x20, 0x0a, 0x04, 0x65, 0x70, 0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x70, 0x73, 0x73, 0x52, 0x04, + 0x65, 0x70, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x65, 0x78, + 0x70, 0x6c, 0x6f, 0x69, 0x74, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x45, 0x78, 0x70, 0x6c, 0x6f, 0x69, 0x74, 0x65, 0x64, 0x4a, 0x04, 0x08, + 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x4a, + 0x04, 0x08, 0x0b, 0x10, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x69, 0x65, + 0x73, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x52, + 0x0b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x52, 0x03, 0x6b, 0x65, + 0x76, 0x22, 0xc9, 0x01, 0x0a, 0x04, 0x43, 0x76, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x4a, + 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, + 0x06, 0x52, 0x09, 0x76, 0x33, 0x5f, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x76, 0x33, + 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x0a, 0x76, 0x34, 0x30, 0x5f, 0x76, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x52, 0x09, 0x76, 0x34, 0x30, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x8c, 0x01, + 0x0a, 0x17, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x65, 0x61, 0x6d, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4a, + 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x22, 0x74, 0x0a, 0x18, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x30, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0xaa, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x31, 0x0a, 0x09, + 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, + 0x64, 0x52, 0x65, 0x66, 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x22, + 0x57, 0x0a, 0x0b, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x66, 0x12, 0x20, + 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x65, 0x61, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xb2, 0x01, 0x0a, 0x0e, 0x53, 0x75, 0x70, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, + 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xf2, 0x02, + 0x0a, 0x0b, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, + 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4b, 0x65, + 0x79, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x75, 0x6c, + 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x76, 0x30, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x62, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x42, 0x79, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x20, + 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x4a, 0x04, 0x08, 0x09, + 0x10, 0x0a, 0x22, 0x88, 0x01, 0x0a, 0x0e, 0x4e, 0x65, 0x77, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2e, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, + 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x7e, 0x0a, + 0x16, 0x53, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x63, 0x74, 0x6f, + 0x72, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x4e, 0x65, 0x77, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x0c, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x52, 0x0a, + 0x17, 0x53, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0x5b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x70, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, + 0x61, 0x6d, 0x12, 0x2a, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x4b, + 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x07, + 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0xfe, 0x01, 0x0a, 0x17, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x75, + 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x4a, + 0x04, 0x08, 0x01, 0x10, 0x02, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x22, 0x95, 0x01, 0x0a, + 0x18, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x75, 0x70, + 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, + 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, + 0x72, 0x73, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x75, 0x72, + 0x73, 0x6f, 0x72, 0x73, 0x2a, 0x8b, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, + 0x79, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x53, + 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x4c, 0x4f, + 0x57, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, + 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x45, 0x56, 0x45, + 0x52, 0x49, 0x54, 0x59, 0x5f, 0x48, 0x49, 0x47, 0x48, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x53, + 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, + 0x10, 0x05, 0x2a, 0x92, 0x01, 0x0a, 0x0b, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x18, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x18, 0x0a, 0x14, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, + 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x49, 0x4d, + 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x43, 0x41, 0x4e, 0x4e, + 0x45, 0x44, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, + 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4e, 0x4f, 0x5f, 0x53, 0x42, 0x4f, 0x4d, 0x10, 0x03, 0x12, 0x17, + 0x0a, 0x13, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x2a, 0xa4, 0x01, 0x0a, 0x10, 0x53, 0x75, 0x70, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x1d, + 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x22, 0x0a, 0x1e, 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x41, 0x46, 0x46, 0x45, 0x43, 0x54, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, + 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x46, 0x41, 0x4c, 0x53, 0x45, 0x5f, 0x50, + 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x23, 0x0a, 0x1f, 0x53, 0x55, 0x50, + 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x41, + 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x5f, 0x52, 0x49, 0x53, 0x4b, 0x10, 0x03, 0x2a, 0x8f, + 0x01, 0x0a, 0x10, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x1d, 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, 0x53, 0x53, 0x45, + 0x44, 0x5f, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, + 0x53, 0x53, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x45, 0x58, 0x43, 0x4c, + 0x55, 0x44, 0x45, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, 0x53, + 0x53, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x49, 0x4e, 0x43, 0x4c, 0x55, + 0x44, 0x45, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x55, 0x50, 0x50, 0x52, 0x45, 0x53, 0x53, + 0x45, 0x44, 0x5f, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x03, + 0x32, 0xab, 0x03, 0x0a, 0x14, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x4c, 0x69, 0x73, + 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, 0x1c, 0x2e, 0x76, 0x30, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x46, + 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1b, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x1c, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1d, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x46, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x55, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1f, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x76, 0x30, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x76, + 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x9c, + 0x02, 0x0a, 0x12, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x12, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x21, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, + 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x76, 0x30, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, + 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x2e, 0x76, 0x30, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x76, 0x30, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x26, 0x5a, + 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x61, 0x69, 0x73, + 0x2f, 0x76, 0x30, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x73, 0x2f, 0x76, 0x31, 0x3b, + 0x76, 0x30, 0x73, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_v0s_proto_rawDescOnce sync.Once + file_v0s_proto_rawDescData []byte +) + +func file_v0s_proto_rawDescGZIP() []byte { + file_v0s_proto_rawDescOnce.Do(func() { + file_v0s_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_v0s_proto_rawDesc), len(file_v0s_proto_rawDesc))) + }) + return file_v0s_proto_rawDescData +} + +var file_v0s_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_v0s_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_v0s_proto_goTypes = []any{ + (Severity)(0), // 0: v0s.v1.Severity + (ImageStatus)(0), // 1: v0s.v1.ImageStatus + (SuppressionState)(0), // 2: v0s.v1.SuppressionState + (SuppressedFilter)(0), // 3: v0s.v1.SuppressedFilter + (CountFindingsRequest_GroupBy)(0), // 4: v0s.v1.CountFindingsRequest.GroupBy + (*Image)(nil), // 5: v0s.v1.Image + (*Workload)(nil), // 6: v0s.v1.Workload + (*FindingFilter)(nil), // 7: v0s.v1.FindingFilter + (*Finding)(nil), // 8: v0s.v1.Finding + (*Epss)(nil), // 9: v0s.v1.Epss + (*ListWorkloadsRequest)(nil), // 10: v0s.v1.ListWorkloadsRequest + (*ListWorkloadsResponse)(nil), // 11: v0s.v1.ListWorkloadsResponse + (*ListFindingsRequest)(nil), // 12: v0s.v1.ListFindingsRequest + (*ListFindingsResponse)(nil), // 13: v0s.v1.ListFindingsResponse + (*CountFindingsRequest)(nil), // 14: v0s.v1.CountFindingsRequest + (*CountFindingsResponse)(nil), // 15: v0s.v1.CountFindingsResponse + (*GetVulnerabilityRequest)(nil), // 16: v0s.v1.GetVulnerabilityRequest + (*GetVulnerabilityResponse)(nil), // 17: v0s.v1.GetVulnerabilityResponse + (*Vulnerability)(nil), // 18: v0s.v1.Vulnerability + (*Cvss)(nil), // 19: v0s.v1.Cvss + (*SearchComponentsRequest)(nil), // 20: v0s.v1.SearchComponentsRequest + (*SearchComponentsResponse)(nil), // 21: v0s.v1.SearchComponentsResponse + (*ComponentMatch)(nil), // 22: v0s.v1.ComponentMatch + (*WorkloadRef)(nil), // 23: v0s.v1.WorkloadRef + (*SuppressionKey)(nil), // 24: v0s.v1.SuppressionKey + (*Suppression)(nil), // 25: v0s.v1.Suppression + (*NewSuppression)(nil), // 26: v0s.v1.NewSuppression + (*SetSuppressionsRequest)(nil), // 27: v0s.v1.SetSuppressionsRequest + (*SetSuppressionsResponse)(nil), // 28: v0s.v1.SetSuppressionsResponse + (*DeleteSuppressionsRequest)(nil), // 29: v0s.v1.DeleteSuppressionsRequest + (*DeleteSuppressionsResponse)(nil), // 30: v0s.v1.DeleteSuppressionsResponse + (*ListSuppressionsRequest)(nil), // 31: v0s.v1.ListSuppressionsRequest + (*ListSuppressionsResponse)(nil), // 32: v0s.v1.ListSuppressionsResponse + (*CountFindingsResponse_Bucket)(nil), // 33: v0s.v1.CountFindingsResponse.Bucket + (*timestamppb.Timestamp)(nil), // 34: google.protobuf.Timestamp +} +var file_v0s_proto_depIdxs = []int32{ + 1, // 0: v0s.v1.Image.status:type_name -> v0s.v1.ImageStatus + 34, // 1: v0s.v1.Image.scanned_at:type_name -> google.protobuf.Timestamp + 5, // 2: v0s.v1.Workload.image:type_name -> v0s.v1.Image + 0, // 3: v0s.v1.FindingFilter.severities:type_name -> v0s.v1.Severity + 3, // 4: v0s.v1.FindingFilter.suppressed:type_name -> v0s.v1.SuppressedFilter + 23, // 5: v0s.v1.Finding.workload:type_name -> v0s.v1.WorkloadRef + 5, // 6: v0s.v1.Finding.image:type_name -> v0s.v1.Image + 0, // 7: v0s.v1.Finding.severity:type_name -> v0s.v1.Severity + 9, // 8: v0s.v1.Finding.epss:type_name -> v0s.v1.Epss + 25, // 9: v0s.v1.Finding.suppression:type_name -> v0s.v1.Suppression + 6, // 10: v0s.v1.ListWorkloadsResponse.workloads:type_name -> v0s.v1.Workload + 7, // 11: v0s.v1.ListFindingsRequest.filter:type_name -> v0s.v1.FindingFilter + 8, // 12: v0s.v1.ListFindingsResponse.findings:type_name -> v0s.v1.Finding + 7, // 13: v0s.v1.CountFindingsRequest.filter:type_name -> v0s.v1.FindingFilter + 4, // 14: v0s.v1.CountFindingsRequest.group_by:type_name -> v0s.v1.CountFindingsRequest.GroupBy + 33, // 15: v0s.v1.CountFindingsResponse.buckets:type_name -> v0s.v1.CountFindingsResponse.Bucket + 18, // 16: v0s.v1.GetVulnerabilityResponse.vulnerability:type_name -> v0s.v1.Vulnerability + 19, // 17: v0s.v1.Vulnerability.cvss:type_name -> v0s.v1.Cvss + 9, // 18: v0s.v1.Vulnerability.epss:type_name -> v0s.v1.Epss + 22, // 19: v0s.v1.SearchComponentsResponse.matches:type_name -> v0s.v1.ComponentMatch + 5, // 20: v0s.v1.ComponentMatch.image:type_name -> v0s.v1.Image + 23, // 21: v0s.v1.ComponentMatch.workloads:type_name -> v0s.v1.WorkloadRef + 2, // 22: v0s.v1.Suppression.state:type_name -> v0s.v1.SuppressionState + 34, // 23: v0s.v1.Suppression.updated_at:type_name -> google.protobuf.Timestamp + 24, // 24: v0s.v1.NewSuppression.key:type_name -> v0s.v1.SuppressionKey + 2, // 25: v0s.v1.NewSuppression.state:type_name -> v0s.v1.SuppressionState + 26, // 26: v0s.v1.SetSuppressionsRequest.suppressions:type_name -> v0s.v1.NewSuppression + 25, // 27: v0s.v1.SetSuppressionsResponse.suppressions:type_name -> v0s.v1.Suppression + 24, // 28: v0s.v1.DeleteSuppressionsRequest.keys:type_name -> v0s.v1.SuppressionKey + 25, // 29: v0s.v1.DeleteSuppressionsResponse.deleted:type_name -> v0s.v1.Suppression + 25, // 30: v0s.v1.ListSuppressionsResponse.suppressions:type_name -> v0s.v1.Suppression + 10, // 31: v0s.v1.VulnerabilityService.ListWorkloads:input_type -> v0s.v1.ListWorkloadsRequest + 12, // 32: v0s.v1.VulnerabilityService.ListFindings:input_type -> v0s.v1.ListFindingsRequest + 14, // 33: v0s.v1.VulnerabilityService.CountFindings:input_type -> v0s.v1.CountFindingsRequest + 16, // 34: v0s.v1.VulnerabilityService.GetVulnerability:input_type -> v0s.v1.GetVulnerabilityRequest + 20, // 35: v0s.v1.VulnerabilityService.SearchComponents:input_type -> v0s.v1.SearchComponentsRequest + 27, // 36: v0s.v1.SuppressionService.SetSuppressions:input_type -> v0s.v1.SetSuppressionsRequest + 29, // 37: v0s.v1.SuppressionService.DeleteSuppressions:input_type -> v0s.v1.DeleteSuppressionsRequest + 31, // 38: v0s.v1.SuppressionService.ListSuppressions:input_type -> v0s.v1.ListSuppressionsRequest + 11, // 39: v0s.v1.VulnerabilityService.ListWorkloads:output_type -> v0s.v1.ListWorkloadsResponse + 13, // 40: v0s.v1.VulnerabilityService.ListFindings:output_type -> v0s.v1.ListFindingsResponse + 15, // 41: v0s.v1.VulnerabilityService.CountFindings:output_type -> v0s.v1.CountFindingsResponse + 17, // 42: v0s.v1.VulnerabilityService.GetVulnerability:output_type -> v0s.v1.GetVulnerabilityResponse + 21, // 43: v0s.v1.VulnerabilityService.SearchComponents:output_type -> v0s.v1.SearchComponentsResponse + 28, // 44: v0s.v1.SuppressionService.SetSuppressions:output_type -> v0s.v1.SetSuppressionsResponse + 30, // 45: v0s.v1.SuppressionService.DeleteSuppressions:output_type -> v0s.v1.DeleteSuppressionsResponse + 32, // 46: v0s.v1.SuppressionService.ListSuppressions:output_type -> v0s.v1.ListSuppressionsResponse + 39, // [39:47] is the sub-list for method output_type + 31, // [31:39] is the sub-list for method input_type + 31, // [31:31] is the sub-list for extension type_name + 31, // [31:31] is the sub-list for extension extendee + 0, // [0:31] is the sub-list for field type_name +} + +func init() { file_v0s_proto_init() } +func file_v0s_proto_init() { + if File_v0s_proto != nil { + return + } + file_v0s_proto_msgTypes[14].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_v0s_proto_rawDesc), len(file_v0s_proto_rawDesc)), + NumEnums: 5, + NumMessages: 29, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_v0s_proto_goTypes, + DependencyIndexes: file_v0s_proto_depIdxs, + EnumInfos: file_v0s_proto_enumTypes, + MessageInfos: file_v0s_proto_msgTypes, + }.Build() + File_v0s_proto = out.File + file_v0s_proto_goTypes = nil + file_v0s_proto_depIdxs = nil +} diff --git a/internal/v0s/protoapi/v0s_grpc.pb.go b/internal/v0s/protoapi/v0s_grpc.pb.go new file mode 100644 index 000000000..1ea3133fb --- /dev/null +++ b/internal/v0s/protoapi/v0s_grpc.pb.go @@ -0,0 +1,454 @@ +// Vendored from nais/v0s proto/v0s/v1/v0s.proto at +// 1e0095d62c1bb4f385c8cdcba8bf05de38a65aa6. The generator overrides go_package. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 +// source: v0s.proto + +package protoapi + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + VulnerabilityService_ListWorkloads_FullMethodName = "/v0s.v1.VulnerabilityService/ListWorkloads" + VulnerabilityService_ListFindings_FullMethodName = "/v0s.v1.VulnerabilityService/ListFindings" + VulnerabilityService_CountFindings_FullMethodName = "/v0s.v1.VulnerabilityService/CountFindings" + VulnerabilityService_GetVulnerability_FullMethodName = "/v0s.v1.VulnerabilityService/GetVulnerability" + VulnerabilityService_SearchComponents_FullMethodName = "/v0s.v1.VulnerabilityService/SearchComponents" +) + +// VulnerabilityServiceClient is the client API for VulnerabilityService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type VulnerabilityServiceClient interface { + ListWorkloads(ctx context.Context, in *ListWorkloadsRequest, opts ...grpc.CallOption) (*ListWorkloadsResponse, error) + ListFindings(ctx context.Context, in *ListFindingsRequest, opts ...grpc.CallOption) (*ListFindingsResponse, error) + CountFindings(ctx context.Context, in *CountFindingsRequest, opts ...grpc.CallOption) (*CountFindingsResponse, error) + GetVulnerability(ctx context.Context, in *GetVulnerabilityRequest, opts ...grpc.CallOption) (*GetVulnerabilityResponse, error) + SearchComponents(ctx context.Context, in *SearchComponentsRequest, opts ...grpc.CallOption) (*SearchComponentsResponse, error) +} + +type vulnerabilityServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewVulnerabilityServiceClient(cc grpc.ClientConnInterface) VulnerabilityServiceClient { + return &vulnerabilityServiceClient{cc} +} + +func (c *vulnerabilityServiceClient) ListWorkloads(ctx context.Context, in *ListWorkloadsRequest, opts ...grpc.CallOption) (*ListWorkloadsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListWorkloadsResponse) + err := c.cc.Invoke(ctx, VulnerabilityService_ListWorkloads_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vulnerabilityServiceClient) ListFindings(ctx context.Context, in *ListFindingsRequest, opts ...grpc.CallOption) (*ListFindingsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListFindingsResponse) + err := c.cc.Invoke(ctx, VulnerabilityService_ListFindings_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vulnerabilityServiceClient) CountFindings(ctx context.Context, in *CountFindingsRequest, opts ...grpc.CallOption) (*CountFindingsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CountFindingsResponse) + err := c.cc.Invoke(ctx, VulnerabilityService_CountFindings_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vulnerabilityServiceClient) GetVulnerability(ctx context.Context, in *GetVulnerabilityRequest, opts ...grpc.CallOption) (*GetVulnerabilityResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetVulnerabilityResponse) + err := c.cc.Invoke(ctx, VulnerabilityService_GetVulnerability_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vulnerabilityServiceClient) SearchComponents(ctx context.Context, in *SearchComponentsRequest, opts ...grpc.CallOption) (*SearchComponentsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SearchComponentsResponse) + err := c.cc.Invoke(ctx, VulnerabilityService_SearchComponents_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// VulnerabilityServiceServer is the server API for VulnerabilityService service. +// All implementations must embed UnimplementedVulnerabilityServiceServer +// for forward compatibility. +type VulnerabilityServiceServer interface { + ListWorkloads(context.Context, *ListWorkloadsRequest) (*ListWorkloadsResponse, error) + ListFindings(context.Context, *ListFindingsRequest) (*ListFindingsResponse, error) + CountFindings(context.Context, *CountFindingsRequest) (*CountFindingsResponse, error) + GetVulnerability(context.Context, *GetVulnerabilityRequest) (*GetVulnerabilityResponse, error) + SearchComponents(context.Context, *SearchComponentsRequest) (*SearchComponentsResponse, error) + mustEmbedUnimplementedVulnerabilityServiceServer() +} + +// UnimplementedVulnerabilityServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedVulnerabilityServiceServer struct{} + +func (UnimplementedVulnerabilityServiceServer) ListWorkloads(context.Context, *ListWorkloadsRequest) (*ListWorkloadsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListWorkloads not implemented") +} +func (UnimplementedVulnerabilityServiceServer) ListFindings(context.Context, *ListFindingsRequest) (*ListFindingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListFindings not implemented") +} +func (UnimplementedVulnerabilityServiceServer) CountFindings(context.Context, *CountFindingsRequest) (*CountFindingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountFindings not implemented") +} +func (UnimplementedVulnerabilityServiceServer) GetVulnerability(context.Context, *GetVulnerabilityRequest) (*GetVulnerabilityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetVulnerability not implemented") +} +func (UnimplementedVulnerabilityServiceServer) SearchComponents(context.Context, *SearchComponentsRequest) (*SearchComponentsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchComponents not implemented") +} +func (UnimplementedVulnerabilityServiceServer) mustEmbedUnimplementedVulnerabilityServiceServer() {} +func (UnimplementedVulnerabilityServiceServer) testEmbeddedByValue() {} + +// UnsafeVulnerabilityServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to VulnerabilityServiceServer will +// result in compilation errors. +type UnsafeVulnerabilityServiceServer interface { + mustEmbedUnimplementedVulnerabilityServiceServer() +} + +func RegisterVulnerabilityServiceServer(s grpc.ServiceRegistrar, srv VulnerabilityServiceServer) { + // If the following call pancis, it indicates UnimplementedVulnerabilityServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&VulnerabilityService_ServiceDesc, srv) +} + +func _VulnerabilityService_ListWorkloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListWorkloadsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VulnerabilityServiceServer).ListWorkloads(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: VulnerabilityService_ListWorkloads_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VulnerabilityServiceServer).ListWorkloads(ctx, req.(*ListWorkloadsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VulnerabilityService_ListFindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListFindingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VulnerabilityServiceServer).ListFindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: VulnerabilityService_ListFindings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VulnerabilityServiceServer).ListFindings(ctx, req.(*ListFindingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VulnerabilityService_CountFindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountFindingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VulnerabilityServiceServer).CountFindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: VulnerabilityService_CountFindings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VulnerabilityServiceServer).CountFindings(ctx, req.(*CountFindingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VulnerabilityService_GetVulnerability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetVulnerabilityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VulnerabilityServiceServer).GetVulnerability(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: VulnerabilityService_GetVulnerability_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VulnerabilityServiceServer).GetVulnerability(ctx, req.(*GetVulnerabilityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VulnerabilityService_SearchComponents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchComponentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VulnerabilityServiceServer).SearchComponents(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: VulnerabilityService_SearchComponents_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VulnerabilityServiceServer).SearchComponents(ctx, req.(*SearchComponentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// VulnerabilityService_ServiceDesc is the grpc.ServiceDesc for VulnerabilityService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var VulnerabilityService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "v0s.v1.VulnerabilityService", + HandlerType: (*VulnerabilityServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListWorkloads", + Handler: _VulnerabilityService_ListWorkloads_Handler, + }, + { + MethodName: "ListFindings", + Handler: _VulnerabilityService_ListFindings_Handler, + }, + { + MethodName: "CountFindings", + Handler: _VulnerabilityService_CountFindings_Handler, + }, + { + MethodName: "GetVulnerability", + Handler: _VulnerabilityService_GetVulnerability_Handler, + }, + { + MethodName: "SearchComponents", + Handler: _VulnerabilityService_SearchComponents_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v0s.proto", +} + +const ( + SuppressionService_SetSuppressions_FullMethodName = "/v0s.v1.SuppressionService/SetSuppressions" + SuppressionService_DeleteSuppressions_FullMethodName = "/v0s.v1.SuppressionService/DeleteSuppressions" + SuppressionService_ListSuppressions_FullMethodName = "/v0s.v1.SuppressionService/ListSuppressions" +) + +// SuppressionServiceClient is the client API for SuppressionService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SuppressionServiceClient interface { + SetSuppressions(ctx context.Context, in *SetSuppressionsRequest, opts ...grpc.CallOption) (*SetSuppressionsResponse, error) + DeleteSuppressions(ctx context.Context, in *DeleteSuppressionsRequest, opts ...grpc.CallOption) (*DeleteSuppressionsResponse, error) + ListSuppressions(ctx context.Context, in *ListSuppressionsRequest, opts ...grpc.CallOption) (*ListSuppressionsResponse, error) +} + +type suppressionServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSuppressionServiceClient(cc grpc.ClientConnInterface) SuppressionServiceClient { + return &suppressionServiceClient{cc} +} + +func (c *suppressionServiceClient) SetSuppressions(ctx context.Context, in *SetSuppressionsRequest, opts ...grpc.CallOption) (*SetSuppressionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetSuppressionsResponse) + err := c.cc.Invoke(ctx, SuppressionService_SetSuppressions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *suppressionServiceClient) DeleteSuppressions(ctx context.Context, in *DeleteSuppressionsRequest, opts ...grpc.CallOption) (*DeleteSuppressionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteSuppressionsResponse) + err := c.cc.Invoke(ctx, SuppressionService_DeleteSuppressions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *suppressionServiceClient) ListSuppressions(ctx context.Context, in *ListSuppressionsRequest, opts ...grpc.CallOption) (*ListSuppressionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListSuppressionsResponse) + err := c.cc.Invoke(ctx, SuppressionService_ListSuppressions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SuppressionServiceServer is the server API for SuppressionService service. +// All implementations must embed UnimplementedSuppressionServiceServer +// for forward compatibility. +type SuppressionServiceServer interface { + SetSuppressions(context.Context, *SetSuppressionsRequest) (*SetSuppressionsResponse, error) + DeleteSuppressions(context.Context, *DeleteSuppressionsRequest) (*DeleteSuppressionsResponse, error) + ListSuppressions(context.Context, *ListSuppressionsRequest) (*ListSuppressionsResponse, error) + mustEmbedUnimplementedSuppressionServiceServer() +} + +// UnimplementedSuppressionServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSuppressionServiceServer struct{} + +func (UnimplementedSuppressionServiceServer) SetSuppressions(context.Context, *SetSuppressionsRequest) (*SetSuppressionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetSuppressions not implemented") +} +func (UnimplementedSuppressionServiceServer) DeleteSuppressions(context.Context, *DeleteSuppressionsRequest) (*DeleteSuppressionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteSuppressions not implemented") +} +func (UnimplementedSuppressionServiceServer) ListSuppressions(context.Context, *ListSuppressionsRequest) (*ListSuppressionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListSuppressions not implemented") +} +func (UnimplementedSuppressionServiceServer) mustEmbedUnimplementedSuppressionServiceServer() {} +func (UnimplementedSuppressionServiceServer) testEmbeddedByValue() {} + +// UnsafeSuppressionServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SuppressionServiceServer will +// result in compilation errors. +type UnsafeSuppressionServiceServer interface { + mustEmbedUnimplementedSuppressionServiceServer() +} + +func RegisterSuppressionServiceServer(s grpc.ServiceRegistrar, srv SuppressionServiceServer) { + // If the following call pancis, it indicates UnimplementedSuppressionServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SuppressionService_ServiceDesc, srv) +} + +func _SuppressionService_SetSuppressions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetSuppressionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SuppressionServiceServer).SetSuppressions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SuppressionService_SetSuppressions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SuppressionServiceServer).SetSuppressions(ctx, req.(*SetSuppressionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SuppressionService_DeleteSuppressions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteSuppressionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SuppressionServiceServer).DeleteSuppressions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SuppressionService_DeleteSuppressions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SuppressionServiceServer).DeleteSuppressions(ctx, req.(*DeleteSuppressionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SuppressionService_ListSuppressions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSuppressionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SuppressionServiceServer).ListSuppressions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SuppressionService_ListSuppressions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SuppressionServiceServer).ListSuppressions(ctx, req.(*ListSuppressionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SuppressionService_ServiceDesc is the grpc.ServiceDesc for SuppressionService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SuppressionService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "v0s.v1.SuppressionService", + HandlerType: (*SuppressionServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetSuppressions", + Handler: _SuppressionService_SetSuppressions_Handler, + }, + { + MethodName: "DeleteSuppressions", + Handler: _SuppressionService_DeleteSuppressions_Handler, + }, + { + MethodName: "ListSuppressions", + Handler: _SuppressionService_ListSuppressions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v0s.proto", +} diff --git a/internal/v0s/queries.go b/internal/v0s/queries.go new file mode 100644 index 000000000..f2719991f --- /dev/null +++ b/internal/v0s/queries.go @@ -0,0 +1,391 @@ +package v0s + +import ( + "context" + "fmt" + "slices" + "strings" + + "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/graph/apierror" + "github.com/nais/api/internal/graph/pagination" + "github.com/nais/api/internal/v0s/protoapi" + "github.com/nais/api/internal/workload" + "google.golang.org/protobuf/proto" +) + +func requireRead(ctx context.Context) error { + actor := authz.ActorFromContext(ctx) + if actor == nil || actor.User == nil { + return apierror.ErrForbidden + } + return nil +} + +func normalizeScope(input *VulnerabilityScopeInput) (scope, error) { + s := scope{} + if input == nil { + return s, nil + } + if input.Team != nil { + if err := input.Team.Validate(); err != nil { + return s, err + } + s.team = input.Team.String() + } + if input.Environment != nil { + if strings.TrimSpace(*input.Environment) == "" { + return s, apierror.Errorf("environment cannot be empty") + } + s.environment = *input.Environment + } + if input.Workload != nil { + if strings.TrimSpace(*input.Workload) == "" { + return s, apierror.Errorf("workload cannot be empty") + } + s.workload = *input.Workload + if s.team == "" || s.environment == "" { + return s, apierror.Errorf("workload requires team and environment") + } + } + return s, nil +} + +func normalizeSelectionScope(input, filterScope *VulnerabilityScopeInput) (scope, error) { + if filterScope != nil { + if input != nil { + return scope{}, apierror.Errorf("scope cannot be provided on a workload field") + } + input = filterScope + } + return normalizeScope(input) +} + +func WorkloadScope(w workload.Workload) *VulnerabilityScopeInput { + return &VulnerabilityScopeInput{ + Team: new(w.GetTeamSlug()), Environment: new(w.GetEnvironmentName()), Workload: new(w.GetName()), + } +} + +func findingFilter(s scope, input *VulnerabilityFindingFilter) (*protoapi.FindingFilter, error) { + f := &protoapi.FindingFilter{ + Team: s.team, Environment: s.environment, Workload: s.workload, + Suppressed: protoapi.SuppressedFilter_SUPPRESSED_FILTER_EXCLUDE, + } + if input == nil { + return f, nil + } + if input.VulnerabilityIdentifier != nil { + if strings.TrimSpace(*input.VulnerabilityIdentifier) == "" { + return nil, apierror.Errorf("vulnerabilityIdentifier cannot be empty") + } + f.VulnerabilityId = *input.VulnerabilityIdentifier + } + if input.Package != nil { + if strings.TrimSpace(*input.Package) == "" { + return nil, apierror.Errorf("package cannot be empty") + } + f.Package = *input.Package + } + if input.OnlyWithFix != nil { + f.HasFix = *input.OnlyWithFix + } + if input.OnlyKnownExploited != nil { + f.OnlyKnownExploited = *input.OnlyKnownExploited + } + if input.Suppressed != nil { + switch *input.Suppressed { + case SuppressedFilterExclude: + case SuppressedFilterInclude: + f.Suppressed = protoapi.SuppressedFilter_SUPPRESSED_FILTER_INCLUDE + case SuppressedFilterOnly: + f.Suppressed = protoapi.SuppressedFilter_SUPPRESSED_FILTER_ONLY + default: + return nil, apierror.Errorf("invalid suppressed filter") + } + } + for _, value := range input.Severities { + number, ok := protoapi.Severity_value["SEVERITY_"+string(value)] + if !ok || number == 0 { + return nil, apierror.Errorf("invalid severity") + } + f.Severities = append(f.Severities, protoapi.Severity(number)) + } + slices.Sort(f.Severities) + f.Severities = slices.Compact(f.Severities) + return f, nil +} + +func Findings(ctx context.Context, input *VulnerabilityScopeInput, filter *VulnerabilityFindingFilter, first *int, after *pagination.Cursor) (*VulnerabilityFindingConnection, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + var filterScope *VulnerabilityScopeInput + if filter != nil { + filterScope = filter.Scope + } + s, err := normalizeSelectionScope(input, filterScope) + if err != nil { + return nil, err + } + f, err := findingFilter(s, filter) + if err != nil { + return nil, err + } + data, err := proto.Marshal(f) + if err != nil { + return nil, fmt.Errorf("encode v0s finding filter: %w", err) + } + p, err := parsePage(first, after, selectionKey("findings", string(data))) + if err != nil { + return nil, err + } + l, err := fromContext(ctx) + if err != nil { + return nil, err + } + current, err := l.currentWorkloads(ctx, s) + if err != nil { + return nil, err + } + edges, info, err := readPage(ctx, p, + func(ctx context.Context, size int32, token string) ([]*protoapi.Finding, []string, string, error) { + resp, err := l.manager.Vulnerabilities.ListFindings(ctx, &protoapi.ListFindingsRequest{Filter: f, PageSize: size, PageToken: token}) + if err != nil { + return nil, nil, "", backendError("list v0s findings", err) + } + return resp.GetFindings(), resp.GetCursors(), resp.GetNextPageToken(), nil + }, func(f *protoapi.Finding) bool { + w := f.GetWorkload() + active := current[workloadKey{w.GetEnvironment(), w.GetTeam(), w.GetName()}] + return active.GetImage() != nil && f.GetImage() != nil && + active.GetImage().GetName() == f.GetImage().GetName() && + active.GetImage().GetDigest() == f.GetImage().GetDigest() + }) + if err != nil { + return nil, err + } + info.CountLoader = func(ctx context.Context) (int, error) { + full := proto.Clone(f).(*protoapi.FindingFilter) + full.Workload = "" + count, err := l.countCurrent(ctx, full, current) + return int(count), err + } + result := &VulnerabilityFindingConnection{Edges: make([]VulnerabilityFindingEdge, 0, len(edges)), PageInfo: info} + for _, edge := range edges { + value, err := finding(edge.Node) + if err != nil { + return nil, err + } + result.Edges = append(result.Edges, VulnerabilityFindingEdge{Node: value, Cursor: edge.Cursor}) + } + return result, nil +} + +func FindingSummary(ctx context.Context, input *VulnerabilityScopeInput, filter *VulnerabilityFindingFilter) (*VulnerabilityFindingSummary, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + var filterScope *VulnerabilityScopeInput + if filter != nil { + filterScope = filter.Scope + } + s, err := normalizeSelectionScope(input, filterScope) + if err != nil { + return nil, err + } + f, err := findingFilter(s, filter) + if err != nil { + return nil, err + } + l, err := fromContext(ctx) + if err != nil { + return nil, err + } + current, err := l.currentWorkloads(ctx, s) + if err != nil { + return nil, err + } + // Grouped counts can be reused across workload fields in a team/environment. + // Reconciliation discards buckets for removed workloads and obsolete images. + f.Workload = "" + filters := []*protoapi.FindingFilter{f} + for _, sev := range []protoapi.Severity{ + protoapi.Severity_SEVERITY_UNKNOWN, protoapi.Severity_SEVERITY_LOW, protoapi.Severity_SEVERITY_MEDIUM, + protoapi.Severity_SEVERITY_HIGH, protoapi.Severity_SEVERITY_CRITICAL, + } { + clone := proto.Clone(f).(*protoapi.FindingFilter) + if len(f.Severities) == 0 || slices.Contains(f.Severities, sev) { + clone.Severities = []protoapi.Severity{sev} + } else { + filters = append(filters, nil) + continue + } + filters = append(filters, clone) + } + fixed := proto.Clone(f).(*protoapi.FindingFilter) + fixed.HasFix = true + known := proto.Clone(f).(*protoapi.FindingFilter) + known.OnlyKnownExploited = true + filters = append(filters, fixed, known) + counts := make([]int64, len(filters)) + for i, filter := range filters { + if filter == nil { + continue + } + counts[i], err = l.countCurrent(ctx, filter, current) + if err != nil { + return nil, err + } + } + return &VulnerabilityFindingSummary{ + TotalFindings: counts[0], CountsBySeverity: &VulnerabilitySeverityCounts{ + Unknown: counts[1], Low: counts[2], Medium: counts[3], High: counts[4], Critical: counts[5], + }, + FixableFindings: counts[6], KnownExploitedFindings: counts[7], + }, nil +} + +func Coverage(ctx context.Context, input *VulnerabilityScopeInput) (*VulnerabilityCoverageCounts, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + s, err := normalizeScope(input) + if err != nil { + return nil, err + } + l, err := fromContext(ctx) + if err != nil { + return nil, err + } + current, err := l.currentWorkloads(ctx, s) + if err != nil { + return nil, err + } + inventory, err := l.inventory.Load(ctx, struct{}{}) + if err != nil { + return nil, err + } + result := &VulnerabilityCoverageCounts{} + for key := range inventory { + if !s.matches(key) { + continue + } + value, err := coverage(current[key]) + if err != nil { + return nil, err + } + result.TotalWorkloads++ + switch value.Status { + case VulnerabilityCoverageStatusScanned: + result.Scanned++ + case VulnerabilityCoverageStatusNoSbom: + result.NoSbom++ + case VulnerabilityCoverageStatusFailed: + result.Failed++ + case VulnerabilityCoverageStatusUnresolvedImage: + result.UnresolvedImage++ + default: + result.Pending++ + } + } + return result, nil +} + +func WorkloadCoverage(ctx context.Context, w workload.Workload) (*VulnerabilityCoverage, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + s, err := normalizeScope(WorkloadScope(w)) + if err != nil { + return nil, err + } + l, err := fromContext(ctx) + if err != nil { + return nil, err + } + current, err := l.currentWorkloads(ctx, s) + if err != nil { + return nil, err + } + return coverage(current[workloadKey{s.environment, s.team, s.workload}]) +} + +func VulnerabilityByIdentifier(ctx context.Context, identifier string) (*Vulnerability, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + if strings.TrimSpace(identifier) == "" { + return nil, apierror.Errorf("identifier cannot be empty") + } + l, err := fromContext(ctx) + if err != nil { + return nil, err + } + return l.advisories.Load(ctx, identifier) +} + +func Suppressions(ctx context.Context, input *VulnerabilityScopeInput, filter *VulnerabilitySuppressionFilter, first *int, after *pagination.Cursor) (*VulnerabilitySuppressionConnection, error) { + if err := requireRead(ctx); err != nil { + return nil, err + } + var filterScope *VulnerabilityScopeInput + if filter != nil { + filterScope = filter.Scope + } + s, err := normalizeSelectionScope(input, filterScope) + if err != nil { + return nil, err + } + l, err := fromContext(ctx) + if err != nil { + return nil, err + } + req := &protoapi.ListSuppressionsRequest{Team: s.team, Environment: s.environment, Workload: s.workload} + if filter != nil { + if filter.VulnerabilityIdentifier != nil { + if strings.TrimSpace(*filter.VulnerabilityIdentifier) == "" { + return nil, apierror.Errorf("vulnerabilityIdentifier cannot be empty") + } + req.VulnerabilityId = *filter.VulnerabilityIdentifier + } + if filter.ImageName != nil { + if strings.TrimSpace(*filter.ImageName) == "" { + return nil, apierror.Errorf("imageName cannot be empty") + } + req.ImageName = *filter.ImageName + } + } + data, err := proto.Marshal(req) + if err != nil { + return nil, fmt.Errorf("encode v0s suppression filter: %w", err) + } + p, err := parsePage(first, after, selectionKey("suppressions", string(data))) + if err != nil { + return nil, err + } + edges, info, err := readPage(ctx, p, + func(ctx context.Context, size int32, token string) ([]*protoapi.Suppression, []string, string, error) { + req.PageSize, req.PageToken = size, token + resp, err := l.manager.Suppressions.ListSuppressions(ctx, req) + if err != nil { + return nil, nil, "", backendError("list v0s suppressions", err) + } + return resp.GetSuppressions(), resp.GetCursors(), resp.GetNextPageToken(), nil + }, func(*protoapi.Suppression) bool { return true }) + if err != nil { + return nil, err + } + info.CountLoader = func(ctx context.Context) (int, error) { + return l.suppressionCounts.Load(ctx, string(data)) + } + result := &VulnerabilitySuppressionConnection{Edges: make([]VulnerabilitySuppressionEdge, 0, len(edges)), PageInfo: info} + for _, edge := range edges { + value, err := suppression(edge.Node) + if err != nil { + return nil, err + } + result.Edges = append(result.Edges, VulnerabilitySuppressionEdge{Node: value, Cursor: edge.Cursor}) + } + return result, nil +} diff --git a/internal/v0s/queries_test.go b/internal/v0s/queries_test.go new file mode 100644 index 000000000..432deb679 --- /dev/null +++ b/internal/v0s/queries_test.go @@ -0,0 +1,513 @@ +package v0s_test + +import ( + "context" + "encoding/base64" + "fmt" + "slices" + "strings" + "sync" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/nais/api/internal/auth/authz" + "github.com/nais/api/internal/graph/ident" + "github.com/nais/api/internal/graph/model" + "github.com/nais/api/internal/graph/pagination" + "github.com/nais/api/internal/slug" + "github.com/nais/api/internal/v0s" + "github.com/nais/api/internal/v0s/protoapi" + "github.com/nais/api/internal/workload" + "github.com/nais/api/internal/workload/application" + inventoryapi "github.com/nais/api/pkg/apiclient/protoapi" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type actor struct{ authz.AuthenticatedUser } + +func (actor) Identity() string { return "actor-1" } +func (actor) IsServiceAccount() bool { return true } +func (actor) IsGitHubActions() {} + +type client struct { + protoapi.VulnerabilityServiceClient + protoapi.SuppressionServiceClient + workloads []*protoapi.Workload + findings []*protoapi.Finding + assessments []*protoapi.Suppression + vulnerability *protoapi.Vulnerability + err error + mu sync.Mutex + workloadCalls, countCalls, writeCalls int +} + +func (c *client) ListWorkloads(_ context.Context, r *protoapi.ListWorkloadsRequest, _ ...grpc.CallOption) (*protoapi.ListWorkloadsResponse, error) { + c.mu.Lock() + defer c.mu.Unlock() + c.workloadCalls++ + result := &protoapi.ListWorkloadsResponse{} + for _, w := range c.workloads { + if (r.Team == "" || r.Team == w.Team) && (r.Environment == "" || r.Environment == w.Environment) { + result.Workloads = append(result.Workloads, w) + } + } + return result, c.err +} + +func matches(f *protoapi.Finding, filter *protoapi.FindingFilter) bool { + return (filter.Team == "" || f.Workload.Team == filter.Team) && + (filter.Environment == "" || f.Workload.Environment == filter.Environment) && + (filter.Workload == "" || f.Workload.Name == filter.Workload) && + (filter.VulnerabilityId == "" || f.VulnerabilityId == filter.VulnerabilityId) && + (filter.Package == "" || f.Purl == filter.Package || f.PackageKey == filter.Package) && + (len(filter.Severities) == 0 || slices.Contains(filter.Severities, f.Severity)) && + (!filter.HasFix || f.FixedVersion != "") && (!filter.OnlyKnownExploited || f.KnownExploited) && + (filter.Suppressed == protoapi.SuppressedFilter_SUPPRESSED_FILTER_INCLUDE || + (filter.Suppressed == protoapi.SuppressedFilter_SUPPRESSED_FILTER_ONLY && f.Suppression != nil) || + (filter.Suppressed == protoapi.SuppressedFilter_SUPPRESSED_FILTER_EXCLUDE && f.Suppression == nil)) +} + +func (c *client) ListFindings(_ context.Context, r *protoapi.ListFindingsRequest, _ ...grpc.CallOption) (*protoapi.ListFindingsResponse, error) { + values := make([]*protoapi.Finding, 0) + for _, f := range c.findings { + if matches(f, r.Filter) && findingKey(f) > r.PageToken { + values = append(values, f) + } + } + slices.SortFunc(values, func(a, b *protoapi.Finding) int { return strings.Compare(findingKey(a), findingKey(b)) }) + end := min(int(r.PageSize), len(values)) + next := "" + if end < len(values) { + next = findingKey(values[end-1]) + } + cursors := make([]string, end) + for i, value := range values[:end] { + cursors[i] = findingKey(value) + } + return &protoapi.ListFindingsResponse{Findings: values[:end], Cursors: cursors, NextPageToken: next}, c.err +} + +func findingKey(f *protoapi.Finding) string { + w := f.GetWorkload() + return strings.Join([]string{w.GetEnvironment(), w.GetTeam(), w.GetName(), f.GetVulnerabilityId(), f.GetPurl()}, "\x00") +} + +func (c *client) CountFindings(_ context.Context, r *protoapi.CountFindingsRequest, _ ...grpc.CallOption) (*protoapi.CountFindingsResponse, error) { + c.mu.Lock() + defer c.mu.Unlock() + c.countCalls++ + if r.GroupBy != protoapi.CountFindingsRequest_GROUP_BY_WORKLOAD { + return nil, fmt.Errorf("expected workload grouping") + } + counts := map[string]int64{} + for _, f := range c.findings { + if matches(f, r.Filter) { + w := f.Workload + counts[w.Environment+"/"+w.Team+"/"+w.Name]++ + } + } + result := &protoapi.CountFindingsResponse{} + for key, count := range counts { + result.Buckets = append(result.Buckets, &protoapi.CountFindingsResponse_Bucket{Key: key, Count: count}) + } + return result, c.err +} + +func (c *client) GetVulnerability(context.Context, *protoapi.GetVulnerabilityRequest, ...grpc.CallOption) (*protoapi.GetVulnerabilityResponse, error) { + return &protoapi.GetVulnerabilityResponse{Vulnerability: c.vulnerability}, c.err +} + +func (c *client) ListSuppressions(_ context.Context, r *protoapi.ListSuppressionsRequest, _ ...grpc.CallOption) (*protoapi.ListSuppressionsResponse, error) { + values := make([]*protoapi.Suppression, 0) + for _, s := range c.assessments { + if (r.Team == "" || r.Team == s.Team) && (r.Environment == "" || r.Environment == s.Environment) && + (r.Workload == "" || r.Workload == s.Workload) && (r.ImageName == "" || r.ImageName == s.ImageName) && + (r.VulnerabilityId == "" || r.VulnerabilityId == s.VulnerabilityId) && suppressionKey(s) > r.PageToken { + values = append(values, s) + } + } + slices.SortFunc(values, func(a, b *protoapi.Suppression) int { return strings.Compare(suppressionKey(a), suppressionKey(b)) }) + end := min(int(r.PageSize), len(values)) + next := "" + if end < len(values) { + next = suppressionKey(values[end-1]) + } + cursors := make([]string, end) + for i, value := range values[:end] { + cursors[i] = suppressionKey(value) + } + return &protoapi.ListSuppressionsResponse{Suppressions: values[:end], Cursors: cursors, NextPageToken: next}, c.err +} + +func suppressionKey(s *protoapi.Suppression) string { + return strings.Join([]string{s.Team, s.Environment, s.Workload, s.ImageName, s.PackageKey, s.VulnerabilityId}, "\x00") +} + +func (c *client) SetSuppressions(context.Context, *protoapi.SetSuppressionsRequest, ...grpc.CallOption) (*protoapi.SetSuppressionsResponse, error) { + c.writeCalls++ + return &protoapi.SetSuppressionsResponse{}, c.err +} + +func (c *client) DeleteSuppressions(context.Context, *protoapi.DeleteSuppressionsRequest, ...grpc.CallOption) (*protoapi.DeleteSuppressionsResponse, error) { + c.writeCalls++ + return &protoapi.DeleteSuppressionsResponse{}, c.err +} + +func contextFor(t *testing.T, c *client, inventory []*inventoryapi.WorkloadImage) context.Context { + t.Helper() + ctx := authz.ContextWithActor(t.Context(), actor{}, nil) + ctx = v0s.WithManager(ctx, &v0s.Manager{Vulnerabilities: c, Suppressions: c}) + return v0s.NewLoaderContext(ctx, func(context.Context) (*inventoryapi.ListWorkloadImagesResponse, error) { + return &inventoryapi.ListWorkloadImagesResponse{Environments: []*inventoryapi.EnvironmentWorkloadImages{{ + Environment: "dev", Workloads: inventory, + }}}, nil + }) +} + +func fixture() (*client, []*inventoryapi.WorkloadImage) { + c := &client{} + inventory := []*inventoryapi.WorkloadImage{} + for _, name := range []string{"scanned", "fresh", "stale", "no-sbom", "failed", "unresolved", "rescan"} { + inventory = append(inventory, &inventoryapi.WorkloadImage{ + TeamSlug: "team-one", Name: name, Image: "repo/" + name + ":2", + }) + if name == "fresh" { + continue + } + w := &protoapi.Workload{ + Environment: "dev", Team: "team-one", Name: name, ImageReference: "repo/" + name + ":2", + Image: &protoapi.Image{Name: "repo/" + name, Digest: "sha256:" + name, Status: protoapi.ImageStatus_IMAGE_STATUS_SCANNED}, + } + switch name { + case "stale": + w.ImageReference = "repo/stale:1" + case "no-sbom": + w.Image.Status = protoapi.ImageStatus_IMAGE_STATUS_NO_SBOM + case "failed": + w.Image.Status = protoapi.ImageStatus_IMAGE_STATUS_FAILED + w.Image.Error = "scan failed" + case "unresolved": + w.Image = nil + w.ResolveError = "could not resolve" + case "rescan": + w.Image.Error = "rescan failed" + w.Image.ScannedAt = timestamppb.New(time.Date(2026, 1, 2, 3, 4, 5, 0, time.UTC)) + } + c.workloads = append(c.workloads, w) + } + c.workloads = append(c.workloads, &protoapi.Workload{ + Environment: "dev", Team: "team-one", Name: "removed", ImageReference: "repo/removed:1", + Image: &protoapi.Image{Name: "repo/removed", Digest: "sha256:removed", Status: protoapi.ImageStatus_IMAGE_STATUS_SCANNED}, + }) + for i, item := range []struct { + name string + severity protoapi.Severity + fix, kev, suppressed bool + }{ + {"scanned", protoapi.Severity_SEVERITY_HIGH, false, true, false}, + {"scanned", protoapi.Severity_SEVERITY_CRITICAL, true, false, false}, + {"scanned", protoapi.Severity_SEVERITY_LOW, true, true, true}, + {"scanned", protoapi.Severity_SEVERITY_UNKNOWN, false, false, false}, + {"rescan", protoapi.Severity_SEVERITY_MEDIUM, true, true, false}, + {"stale", protoapi.Severity_SEVERITY_CRITICAL, true, true, false}, + {"removed", protoapi.Severity_SEVERITY_CRITICAL, true, true, false}, + } { + f := &protoapi.Finding{ + Workload: &protoapi.WorkloadRef{Environment: "dev", Team: "team-one", Name: item.name}, + Image: &protoapi.Image{Name: "repo/" + item.name, Digest: "sha256:" + item.name}, + VulnerabilityId: fmt.Sprintf("CVE-%d", i), Purl: "pkg:npm/example@1.0", PackageKey: "pkg:npm/example", + Severity: item.severity, KnownExploited: item.kev, + } + if item.fix { + f.FixedVersion = "2.0" + } + if item.suppressed { + f.Suppression = &protoapi.Suppression{ + Team: "team-one", Environment: "dev", Workload: item.name, + State: protoapi.SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK, UpdatedAt: timestamppb.Now(), + } + } + c.findings = append(c.findings, f) + } + return c, inventory +} + +func TestCoverageUsesCurrentInventory(t *testing.T) { + c, inventory := fixture() + ctx := contextFor(t, c, inventory) + got, err := v0s.Coverage(ctx, nil) + if err != nil { + t.Fatal(err) + } + want := &v0s.VulnerabilityCoverageCounts{TotalWorkloads: 7, Scanned: 2, Pending: 2, NoSbom: 1, Failed: 1, UnresolvedImage: 1} + if diff := cmp.Diff(want, got); diff != "" { + t.Fatalf("coverage (-want +got):\n%s", diff) + } + for _, name := range []string{"fresh", "stale", "rescan"} { + w := &application.Application{Base: workload.Base{Name: name, EnvironmentName: "dev", TeamSlug: "team-one"}} + value, err := v0s.WorkloadCoverage(ctx, w) + if err != nil { + t.Fatal(err) + } + if name == "rescan" { + if value.Status != v0s.VulnerabilityCoverageStatusScanned || value.Error == nil || value.ScannedAt == nil { + t.Fatalf("failed rescan lost successful coverage: %+v", value) + } + } else if value.Status != v0s.VulnerabilityCoverageStatusPending || value.ImageDigest != nil { + t.Fatalf("new or obsolete image must be pending: %+v", value) + } + } + if c.workloadCalls != 2 { + t.Fatalf("coverage was not shared across workload fields: %d calls", c.workloadCalls) + } +} + +func TestFindingsResumeAnyEdgeAndExcludeObsoleteImages(t *testing.T) { + c, inventory := fixture() + ctx := contextFor(t, c, inventory) + page, err := v0s.Findings(ctx, nil, nil, new(2), nil) + if err != nil { + t.Fatal(err) + } + if len(page.Edges) != 2 || !page.PageInfo.HasNextPage || page.Edges[1].Node.FixedVersion != nil || + page.PageInfo.PageStart() != 1 || page.PageInfo.PageEnd() != 2 { + t.Fatalf("unexpected first page: %+v", page) + } + next, err := v0s.Findings(ctx, nil, nil, new(1), &page.Edges[0].Cursor) + if err != nil || len(next.Edges) != 1 || next.Edges[0].Node.VulnerabilityIdentifier != "CVE-0" || + !next.PageInfo.HasPreviousPage || next.PageInfo.PageStart() != 2 || next.PageInfo.PageEnd() != 2 { + t.Fatalf("resuming an interior edge: %+v, %v", next, err) + } + var identifiers []string + for { + for _, edge := range page.Edges { + identifiers = append(identifiers, edge.Node.VulnerabilityIdentifier) + } + if !page.PageInfo.HasNextPage { + break + } + page, err = v0s.Findings(ctx, nil, nil, new(1), page.PageInfo.EndCursor) + if err != nil { + t.Fatal(err) + } + } + if diff := cmp.Diff([]string{"CVE-4", "CVE-0", "CVE-1", "CVE-3"}, identifiers); diff != "" { + t.Fatalf("current findings (-want +got):\n%s", diff) + } + _, err = v0s.Findings(ctx, nil, &v0s.VulnerabilityFindingFilter{OnlyWithFix: new(true)}, new(1), next.PageInfo.EndCursor) + if err == nil { + t.Fatal("cursor from another filter was accepted") + } + unbound := pagination.Cursor{Opaque: base64.RawURLEncoding.EncodeToString([]byte(`{"token":"unbound"}`))} + if _, err := v0s.Findings(ctx, nil, nil, new(1), &unbound); err == nil { + t.Fatal("a cursor without selection or version was accepted") + } +} + +func TestFindingsResumeAfterEarlierFindingDisappears(t *testing.T) { + c, inventory := fixture() + c.findings = c.findings[:2] + first, err := v0s.Findings(contextFor(t, c, inventory), nil, nil, new(1), nil) + if err != nil || len(first.Edges) != 1 { + t.Fatalf("initial page: %+v, %v", first, err) + } + c.findings = c.findings[1:] + next, err := v0s.Findings(contextFor(t, c, inventory), nil, nil, new(1), first.PageInfo.EndCursor) + if err != nil || len(next.Edges) != 1 || next.Edges[0].Node.VulnerabilityIdentifier != "CVE-1" || next.PageInfo.HasNextPage { + t.Fatalf("remaining finding was skipped: %+v, %v", next, err) + } +} + +func TestInvalidFindingPageDoesNotReadInventory(t *testing.T) { + for _, size := range []int{0, 201} { + c, inventory := fixture() + if _, err := v0s.Findings(contextFor(t, c, inventory), nil, nil, &size, nil); err == nil { + t.Fatalf("invalid page size %d accepted", size) + } + if c.workloadCalls != 0 { + t.Fatal("invalid pagination read the backend inventory") + } + } +} + +func TestVulnerabilityNodesCanBeRefetched(t *testing.T) { + c, inventory := fixture() + c.findings = c.findings[:2] + c.vulnerability = &protoapi.Vulnerability{Id: "CVE-1", Title: "advisory"} + c.assessments = []*protoapi.Suppression{{ + Team: "team-one", Environment: "dev", Workload: "removed", ImageName: "repo/old", + PackageKey: "pkg:npm/example", VulnerabilityId: "CVE-1", + State: protoapi.SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK, UpdatedAt: timestamppb.Now(), + }} + ctx := contextFor(t, c, inventory) + findings, err := v0s.Findings(ctx, nil, nil, new(1), nil) + if err != nil { + t.Fatal(err) + } + advisory, err := v0s.VulnerabilityByIdentifier(ctx, "CVE-1") + if err != nil { + t.Fatal(err) + } + assessments, err := v0s.Suppressions(ctx, nil, nil, new(1), nil) + if err != nil { + t.Fatal(err) + } + type identifiedNode interface { + model.Node + ID() ident.Ident + } + for _, node := range []identifiedNode{findings.Nodes()[0], advisory, assessments.Nodes()[0]} { + got, err := ident.GetByIdent(ctx, ident.FromString(node.ID().String())) + if err != nil { + t.Fatal(err) + } + if diff := cmp.Diff(node, got); diff != "" { + t.Fatalf("node lookup lost the resource (-want +got):\n%s", diff) + } + } + for _, w := range c.workloads { + if w.GetName() == "scanned" { + w.Image.Digest = "sha256:new" + } + } + if _, err := ident.GetByIdent(contextFor(t, c, inventory), findings.Nodes()[0].ID()); err == nil { + t.Fatal("an obsolete-image finding could still be fetched by ID") + } +} + +func TestSummaryCountsFullFilteredCurrentSelection(t *testing.T) { + c, inventory := fixture() + ctx := contextFor(t, c, inventory) + got, err := v0s.FindingSummary(ctx, nil, nil) + if err != nil { + t.Fatal(err) + } + want := &v0s.VulnerabilityFindingSummary{ + TotalFindings: 4, FixableFindings: 2, KnownExploitedFindings: 2, + CountsBySeverity: &v0s.VulnerabilitySeverityCounts{Unknown: 1, Medium: 1, High: 1, Critical: 1}, + } + if diff := cmp.Diff(want, got); diff != "" { + t.Fatalf("summary (-want +got):\n%s", diff) + } + got, err = v0s.FindingSummary(ctx, nil, &v0s.VulnerabilityFindingFilter{ + Severities: []v0s.VulnerabilitySeverity{v0s.VulnerabilitySeverityHigh, v0s.VulnerabilitySeverityCritical}, + OnlyWithFix: new(true), + }) + if err != nil || got.TotalFindings != 1 || got.CountsBySeverity.High != 0 || + got.CountsBySeverity.Critical != 1 || got.FixableFindings != 1 || got.KnownExploitedFindings != 0 { + t.Fatalf("summary did not preserve filters: %+v, %v", got, err) + } + got, err = v0s.FindingSummary(ctx, nil, &v0s.VulnerabilityFindingFilter{Suppressed: new(v0s.SuppressedFilterInclude)}) + if err != nil || got.TotalFindings != 5 || got.FixableFindings != 3 || got.KnownExploitedFindings != 3 { + t.Fatalf("including assessments: %+v, %v", got, err) + } +} + +func TestWorkloadSummariesShareGroupedCounts(t *testing.T) { + c, inventory := fixture() + ctx := contextFor(t, c, inventory) + var countCalls, workloadCalls int + for i, name := range []string{"scanned", "rescan"} { + got, err := v0s.FindingSummary(ctx, &v0s.VulnerabilityScopeInput{ + Team: new(slug.Slug("team-one")), Environment: new("dev"), Workload: &name, + }, nil) + want := int64(3) + if name == "rescan" { + want = 1 + } + if err != nil || got.TotalFindings != want { + t.Fatalf("workload summary: %+v, %v", got, err) + } + if i == 0 { + countCalls, workloadCalls = c.countCalls, c.workloadCalls + } else if c.countCalls != countCalls || c.workloadCalls != workloadCalls { + t.Fatal("another workload summary repeated the same grouped backend requests") + } + } +} + +func TestAdvisoryPreservesOptionalValuesAndBackendErrors(t *testing.T) { + c := &client{vulnerability: &protoapi.Vulnerability{Id: "CVE-1", Cvss: []*protoapi.Cvss{ + {Source: "source", Version: "3.x"}, {Source: "source", Version: "3.1", Score: new(0.0), Vector: new("vector")}, + }, Epss: &protoapi.Epss{Score: 0, Date: "2026-01-02"}}} + got, err := v0s.VulnerabilityByIdentifier(contextFor(t, c, nil), "alias") + if err != nil || got.Cvss[0].Score != nil || got.Cvss[0].Vector != nil || + got.Cvss[1].Score == nil || *got.Cvss[1].Score != 0 || got.Epss.Date.String() != "2026-01-02" { + t.Fatalf("optional advisory values: %+v, %v", got, err) + } + c.err = status.Error(codes.NotFound, "unknown") + if got, err := v0s.VulnerabilityByIdentifier(contextFor(t, c, nil), "missing"); got != nil || err != nil { + t.Fatalf("unknown identifier: %+v, %v", got, err) + } + c.err = status.Error(codes.Unavailable, "catalog unavailable") + if got, err := v0s.VulnerabilityByIdentifier(contextFor(t, c, nil), "CVE-1"); got != nil || err == nil { + t.Fatal("backend outage was presented as a missing advisory") + } + if got, err := v0s.Coverage(contextFor(t, c, nil), nil); got != nil || err == nil { + t.Fatal("backend outage was presented as zero coverage") + } +} + +func TestScopeAndReadAuthorization(t *testing.T) { + c, inventory := fixture() + ctx := contextFor(t, c, inventory) + for _, scope := range []*v0s.VulnerabilityScopeInput{ + {Environment: new("")}, + {Workload: new("scanned")}, + {Team: new(slug.Slug("team-one")), Workload: new("scanned")}, + } { + if _, err := v0s.Coverage(ctx, scope); err == nil { + t.Fatalf("invalid scope accepted: %+v", scope) + } + } + if c.workloadCalls != 0 { + t.Fatal("invalid scope reached v0s") + } + if _, err := v0s.Coverage(context.Background(), nil); err == nil { + t.Fatal("unauthenticated read accepted") + } + ctx = v0s.WithManager(authz.ContextWithActor(t.Context(), actor{}, nil), nil) + ctx = v0s.NewLoaderContext(ctx, func(context.Context) (*inventoryapi.ListWorkloadImagesResponse, error) { + t.Fatal("disabled v0s attempted an inventory read") + return nil, nil + }) + if _, err := v0s.Coverage(ctx, nil); err == nil { + t.Fatal("unconfigured backend presented zero coverage") + } +} + +func TestSuppressionsRemainReadableWithoutActiveFindingsAndWritesStayGated(t *testing.T) { + c := &client{assessments: []*protoapi.Suppression{{ + Team: "team-one", Environment: "dev", Workload: "removed", ImageName: "repo/old", + PackageKey: "pkg:npm/example", VulnerabilityId: "CVE-1", + State: protoapi.SuppressionState_SUPPRESSION_STATE_ACCEPTED_RISK, UpdatedAt: timestamppb.Now(), + }}} + ctx := contextFor(t, c, nil) + got, err := v0s.Suppressions(ctx, nil, nil, new(1), nil) + if err != nil || len(got.Edges) != 1 || got.Edges[0].Node.Workload != "removed" { + t.Fatalf("assessment without active finding: %+v, %v", got, err) + } + key := &v0s.VulnerabilitySuppressionKeyInput{ + Environment: "dev", Workload: "removed", ImageName: "repo/old", PackageKey: "pkg:npm/example", VulnerabilityIdentifier: "CVE-1", + } + for _, enabled := range []bool{false, true} { + ctx := v0s.WithManager(authz.ContextWithActor(t.Context(), actor{}, nil), &v0s.Manager{ + Vulnerabilities: c, Suppressions: c, SuppressionsEnabled: enabled, + }) + if _, err := v0s.SetSuppressions(ctx, v0s.SetVulnerabilitySuppressionsInput{Team: "team-one", Items: []*v0s.NewVulnerabilitySuppressionInput{{ + Key: key, State: v0s.VulnerabilitySuppressionStateAcceptedRisk, Reason: "reason", + }}}); err == nil { + t.Fatal("disabled or unauthorized set was accepted") + } + if _, err := v0s.DeleteSuppressions(ctx, v0s.DeleteVulnerabilitySuppressionsInput{Team: "team-one", Keys: []*v0s.VulnerabilitySuppressionKeyInput{key}}); err == nil { + t.Fatal("disabled or unauthorized delete was accepted") + } + } + if c.writeCalls != 0 { + t.Fatal("gated or unauthorized batch reached v0s") + } +}