generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(heureka): adds false positive actions and image version details page #1421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,931
−269
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
12bfc52
feat(heureka): adds image details page (#1393)
hodanoori 5d21f3d
feat(heureka): put the search box inside the vulnerabilities top navi…
hodanoori 864acdb
chore(heureka): extends codegen to be adjusted with apollo client V4
hodanoori 35ab5a0
chore(heureka): display the seven chars after sha256 based on github …
hodanoori 4bc758b
feat(heureka): adds messages to remediation actions
hodanoori d48b237
chore(heureka): fix typescheck
hodanoori 5768fc1
Merge main into hoda-heureka-false-positive
hodanoori 0242166
chore(heureka): resolve conflicts
hodanoori 43b8fb6
chore(heureka): adds changeset
hodanoori 17260fd
chore: ignore TanStack Router cache directory (.tanstack)
hodanoori 6325218
chore(heureka): improves changeset text
hodanoori 8e69870
Merge main into hoda-heureka-false-positive
hodanoori eeddd1f
fix(carbon): remove unnecessary type assertion in ErrorFallback
hodanoori 984048d
fix(heureka): fixes type issues
hodanoori dea3eb9
chore(heureka): fixes test
hodanoori eaf680a
fix(heureka): show default message in ErrorFallback when error.messag…
hodanoori b0916cc
fix(heureka): assert vulFilter as VulnerabilityFilter in ImageIssuesList
hodanoori 62f3085
fix(heureka): assert vulFilter as VulnerabilityFilter in ImageIssuesList
hodanoori 319c3a2
fix(heureka): assert vulFilter as VulnerabilityFilter in ImageIssuesList
hodanoori 56fbdeb
feat(heureka): adds remediation action panel
hodanoori 69ba82c
feat(heureka): add success error msg after revert false positive
hodanoori eacb22c
Merge main into hoda-heureka-false-positive
hodanoori aae5fde
feat(heureka): adds routing for active and remediated vulnerabilities…
hodanoori a677e18
Merge branch 'main' into hoda-heureka-false-positive
hodanoori ba8898e
chore(heureka): remove ./tanstack from gitignore
hodanoori be26b61
chore(heureka): remove message provider lib and its usage
hodanoori f871a67
feat(heureka): adds tests on image details page components
hodanoori d4df3eb
chore(heureka): updates pnpm-lock.yaml
hodanoori 5b47f5a
fix(heureka): type assertions for RemediatedIssuesDataRows test mocks
hodanoori 7c13802
chore(heureka): updates the changeset text
hodanoori 39b5e7f
fix(heureka): use React Query cache for fetchImageVersions
hodanoori eefbc58
chore(heureka): uses descriptionTrimmed once in FalsePositiveModal
hodanoori fdaa134
fix(heureka): avoid setState after unmount in FalsePositiveModal
hodanoori 71afcb7
chore(heureka): use functional setState for expand toggle in Remediat…
hodanoori 03000ca
chore(heureka): use functional setState for expand toggle in Remediat…
hodanoori 1f94616
fix(heureka): drop rel on internal anchor in ImageVersionOccurrences
hodanoori 3d76a8a
fix(heureka): type edge params with VulnerabilityEdge and ComponentIn…
hodanoori 3b6ad5c
fix(heureka): type image version normalizers with GetImageVersionsQuery
hodanoori 9d2c08a
chore(heureka): uses Stack with gap for tooltip content in ImageVersi…
hodanoori 808429c
fix(heureka): disable all revert actions while any revert is in progress
hodanoori d85da31
fix(heureka): clear search on version-details nav and decode version …
hodanoori 3bcd194
feat(heureka): show first 30 versions with Show more for the rest
hodanoori 2f8a510
feat(heureka): show first 30 versions with Show more for the rest
hodanoori 2b63753
fix(heureka): refetches image and vulnerability scoped remediations a…
hodanoori 5d7e70d
Merge remote-tracking branch 'origin/main' into hoda-heureka-false-po…
hodanoori 35fec10
Merge remote-tracking branch 'origin/main' into hoda-heureka-false-po…
hodanoori 3a59b53
fix(heureka): adds missing end of file line
hodanoori 53cd4db
chore(heureka): displays success and error msg on the remediation pan…
hodanoori 927460f
chore(heureka): displays success and error msg on the remediation pan…
hodanoori e11fd88
chore(heureka): improves error handling and address code review comments
hodanoori f343dd2
chore(heureka): improves error handling and address code review comments
hodanoori 3d83535
fix(heureka): fixes prettier issues
hodanoori c87e416
chore(heureka): remove unnecessary carbon changes as type error is al…
hodanoori f6a4faa
chore: merge main into hoda-heureka-false-positive
hodanoori File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@cloudoperators/juno-app-heureka": major | ||
| --- | ||
|
|
||
| Adds false positive remediation on the image details page with create and revert. Introduces image version details page to show deployment locations for each image version. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { ApolloClient } from "@apollo/client" | ||
| import { | ||
| CreateRemediationDocument, | ||
| CreateRemediationMutation, | ||
| CreateRemediationMutationVariables, | ||
| RemediationInput, | ||
| } from "../generated/graphql" | ||
|
|
||
| type CreateRemediationParams = { | ||
| apiClient: ApolloClient | ||
| input: RemediationInput | ||
| } | ||
|
|
||
| export const createRemediation = async ({ | ||
| apiClient, | ||
| input, | ||
| }: CreateRemediationParams): Promise<CreateRemediationMutation["createRemediation"]> => { | ||
| const result = await apiClient.mutate<CreateRemediationMutation, CreateRemediationMutationVariables>({ | ||
| mutation: CreateRemediationDocument, | ||
| variables: { input }, | ||
| }) | ||
|
|
||
| if (!result.data?.createRemediation) { | ||
| throw new Error("Failed to create remediation") | ||
| } | ||
|
|
||
| return result.data.createRemediation | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { ApolloClient } from "@apollo/client" | ||
| import { | ||
| DeleteRemediationDocument, | ||
| DeleteRemediationMutation, | ||
| DeleteRemediationMutationVariables, | ||
| } from "../generated/graphql" | ||
|
|
||
| type DeleteRemediationParams = { | ||
| apiClient: ApolloClient | ||
| remediationId: string | ||
| } | ||
|
|
||
| export const deleteRemediation = async ({ apiClient, remediationId }: DeleteRemediationParams): Promise<string> => { | ||
| const result = await apiClient.mutate<DeleteRemediationMutation, DeleteRemediationMutationVariables>({ | ||
| mutation: DeleteRemediationDocument, | ||
| variables: { id: remediationId }, | ||
| }) | ||
|
|
||
| if (!result.data?.deleteRemediation) { | ||
| throw new Error("Failed to delete remediation") | ||
| } | ||
|
|
||
| return result.data.deleteRemediation | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { ObservableQuery } from "@apollo/client" | ||
| import { GetImageVersionsDocument, GetImageVersionsQuery, ImageVersionFilter } from "../generated/graphql" | ||
| import { RouteContext } from "../routes/-types" | ||
|
|
||
| type FetchImageVersionsParams = Pick<RouteContext, "queryClient" | "apiClient"> & { | ||
| filter: ImageVersionFilter | ||
| after?: string | null | ||
| first?: number | ||
| firstVulnerabilities?: number | ||
| afterVulnerabilities?: string | null | ||
| firstOccurences?: number | ||
| afterOccurences?: string | null | ||
| } | ||
|
|
||
| export const fetchImageVersions = ({ | ||
| queryClient, | ||
| apiClient, | ||
| filter, | ||
| after, | ||
| first, | ||
| firstVulnerabilities, | ||
| afterVulnerabilities, | ||
| firstOccurences, | ||
| afterOccurences, | ||
| }: FetchImageVersionsParams): Promise<ObservableQuery.Result<GetImageVersionsQuery>> => { | ||
| const queryKey = [ | ||
| "imageVersions", | ||
| filter, | ||
| after, | ||
| first, | ||
| firstVulnerabilities, | ||
| afterVulnerabilities, | ||
| firstOccurences, | ||
| afterOccurences, | ||
| ] | ||
|
|
||
| return queryClient.ensureQueryData({ | ||
| queryKey, | ||
| queryFn: () => | ||
| apiClient.query<GetImageVersionsQuery>({ | ||
| query: GetImageVersionsDocument, | ||
| variables: { | ||
| filter, | ||
| first, | ||
| after, | ||
| firstVulnerabilities, | ||
| afterVulnerabilities, | ||
| firstOccurences, | ||
| afterOccurences, | ||
| }, | ||
| }), | ||
| }) | ||
| } | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { ObservableQuery } from "@apollo/client" | ||
| import { GetRemediationsDocument, GetRemediationsQuery, RemediationFilter } from "../generated/graphql" | ||
| import { RouteContext } from "../routes/-types" | ||
|
|
||
| type FetchRemediationsParams = Pick<RouteContext, "queryClient" | "apiClient"> & { | ||
| filter?: RemediationFilter | ||
| } | ||
|
|
||
| export const fetchRemediations = ({ | ||
| queryClient, | ||
| apiClient, | ||
| filter, | ||
| }: FetchRemediationsParams): Promise<ObservableQuery.Result<GetRemediationsQuery>> => { | ||
| const queryKey = ["remediations", filter] | ||
|
|
||
| return queryClient.ensureQueryData({ | ||
| queryKey, | ||
| queryFn: () => | ||
| apiClient.query<GetRemediationsQuery>({ | ||
| query: GetRemediationsDocument, | ||
| variables: { | ||
| filter, | ||
| }, | ||
| }), | ||
| }) | ||
| } |
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
54 changes: 54 additions & 0 deletions
54
...eureka/src/components/Service/ImageDetails/FalsePositiveModal/FalsePositiveModal.test.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import React from "react" | ||
| import { render, screen } from "@testing-library/react" | ||
| import userEvent from "@testing-library/user-event" | ||
| import { PortalProvider } from "@cloudoperators/juno-ui-components" | ||
| import { FalsePositiveModal } from "./index" | ||
|
|
||
| const defaultProps = { | ||
| open: true, | ||
| onClose: () => {}, | ||
| onConfirm: () => Promise.resolve(), | ||
| vulnerability: "CVE-2024-1234", | ||
| service: "my-service", | ||
| image: "my-image", | ||
| } | ||
|
|
||
| const renderModal = (props = {}) => { | ||
| return render( | ||
| <PortalProvider> | ||
| <FalsePositiveModal {...defaultProps} {...props} /> | ||
| </PortalProvider> | ||
| ) | ||
| } | ||
|
|
||
| describe("FalsePositiveModal", () => { | ||
| it("renders with title and vulnerability details when open", () => { | ||
| renderModal() | ||
| expect(screen.getByRole("heading", { name: "Mark as False Positive" })).toBeInTheDocument() | ||
| expect(screen.getByText(/Vulnerability:/)).toBeInTheDocument() | ||
| expect(screen.getByText("CVE-2024-1234")).toBeInTheDocument() | ||
| expect(screen.getByText(/Service:/)).toBeInTheDocument() | ||
| expect(screen.getByText("my-service")).toBeInTheDocument() | ||
| expect(screen.getByText(/Image:/)).toBeInTheDocument() | ||
| expect(screen.getByText("my-image")).toBeInTheDocument() | ||
| }) | ||
|
|
||
| it("renders Cancel and Mark as False Positive buttons", () => { | ||
| renderModal() | ||
| expect(screen.getByRole("button", { name: "Cancel" })).toBeInTheDocument() | ||
| expect(screen.getByRole("button", { name: "Mark as False Positive" })).toBeInTheDocument() | ||
| }) | ||
|
|
||
| it("calls onClose when Cancel is clicked", async () => { | ||
| const onClose = vi.fn() | ||
| const user = userEvent.setup() | ||
| renderModal({ onClose }) | ||
| await user.click(screen.getByRole("button", { name: "Cancel" })) | ||
| expect(onClose).toHaveBeenCalledTimes(1) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.