Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Same-named applications and jobs collide in the workload map, undercounting coverage and potentially returning a job’s findings or coverage for an application.
1 open issue
4 files not reviewed
internal/graph/gengql/activitylog.generated.go: Generated fileinternal/graph/gengql/applications.generated.go: Generated fileinternal/graph/gengql/jobs.generated.go: Generated fileinternal/graph/gengql/schema.generated.go: Generated file
What changed in this PR
Adds v0s as a parallel vulnerability backend for Nais API while retaining legacy v13s support.
Changes:
- Adds optional v0s configuration, client initialization and request-scoped inventory loaders.
- Exposes GraphQL findings, summaries, coverage and assessments, with gated suppression writes and activity logging.
- Adds cursor pagination, protobuf generation, migration documentation and tests.
| File | Description |
|---|---|
| README.md | Documents migration, configuration and rollout requirements. |
| internal/v0s/queries.go | Implements scoped vulnerability reads and summaries. |
| internal/v0s/queries_test.go | Tests filtering, inventory reconciliation, pagination and authorization. |
| internal/v0s/protoapi/v0s_grpc.pb.go | Adds generated gRPC service bindings. |
| internal/v0s/protoapi/schema/v0s.proto | Pins the v0s protobuf contract. |
| internal/v0s/pagination.go | Implements filter-bound, forward-only cursors. |
| internal/v0s/node.go | Adds global IDs and node lookups. |
| internal/v0s/mutations.go | Implements gated, authorized suppression batches. |
| internal/v0s/mutations_integration_test.go | Tests authorized writes and activity recording. |
| internal/v0s/models.go | Defines v0s domain models and enums. |
| internal/v0s/errors.go | Maps backend errors to API responses. |
| internal/v0s/dataloader.go | Caches inventory, grouped counts and advisories. |
| internal/v0s/convert.go | Converts backend values into API models. |
| internal/v0s/client.go | Creates and manages the optional gRPC client. |
| internal/v0s/client_test.go | Tests gRPC reads and lazy initialization. |
| internal/v0s/activitylog.go | Registers and records assessment activity. |
| internal/integration/manager.go | Updates integration setup for the new manager argument. |
| internal/graph/v0s.resolvers.go | Connects GraphQL fields to v0s operations. |
| internal/graph/v0s.resolvers_test.go | Tests GraphQL behavior and legacy coexistence. |
| internal/graph/schema/v0s.graphqls | Defines public v0s queries, types and mutations. |
| internal/graph/pagination/relay.go | Rejects v0s cursors in offset pagination. |
| internal/graph/pagination/models.go | Supports deferred total-count loading. |
| internal/graph/pagination/cursor.go | Adds opaque v0s cursor encoding. |
| internal/graph/pagination/cursor_test.go | Tests cursor compatibility and separation. |
| internal/graph/gengql/schema.generated.go | Adds generated query, mutation and node wiring. |
| internal/graph/gengql/jobs.generated.go | Adds generated job vulnerability fields. |
| internal/graph/gengql/applications.generated.go | Adds generated application vulnerability fields. |
| internal/graph/gengql/activitylog.generated.go | Supports assessment activity entries. |
| internal/cmd/api/http.go | Injects v0s loaders and checks inventory readiness. |
| internal/cmd/api/config.go | Adds endpoint and suppression-write settings. |
| internal/cmd/api/config_test.go | Tests independent v0s configuration and write defaults. |
| internal/cmd/api/api.go | Initializes, injects and closes the v0s manager. |
| .mise-tasks/generate/proto | Generates bindings from the pinned schema. |
| .configs/gqlgen.yaml | Binds v0s models and deferred page counts. |
Review effort: Balanced
| if err == nil { | ||
| for _, env := range resp.GetEnvironments() { | ||
| for _, w := range env.GetWorkloads() { | ||
| result[workloadKey{env.GetEnvironment(), w.GetTeamSlug(), w.GetName()}] = w.GetImage() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request introduces a major migration in the vulnerability data model by integrating the new "v0s" service for vulnerability queries, coverage, and suppressions, while keeping legacy (v13s) support for backward compatibility. It updates configuration, code, tests, and documentation to support v0s-based reads and (optionally) writes, and exposes new GraphQL fields for applications and jobs. The changes are grouped as follows:
1. v0s Integration and Configuration
v0sas a new internal module, with its manager initialized and injected into the API runtime. New configuration options (V0S_ENDPOINT,V0S_SUPPRESSIONS_ENABLED) are introduced and documented, with logic ensuring v0s is optional and independent of legacy vulnerability endpoints. [1] [2] [3] [4] [5] [6] [7]2. GraphQL API Enhancements
vulnerabilityFindings,vulnerabilityFindingSummary, andvulnerabilityCoverage, all powered by v0s. Added argument parsing, field context, and resolver stubs for these fields in the generated code. [1] [2] [3]totalCounttoCountinPageInfo.3. Context and Loader Wiring
4. Protobuf and Build Pipeline
5. Documentation
README.md, explaining the new fields, configuration, migration process, and operational caveats for v0s adoption.These changes collectively enable the API to read vulnerability findings, summaries, and coverage from v0s, paving the way for a smooth migration from legacy v13s data and supporting future enhancements.