Skip to content
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

Vulnz report facelift #145

Merged
merged 11 commits into from
Mar 21, 2025
Merged

Vulnz report facelift #145

merged 11 commits into from
Mar 21, 2025

Conversation

rbjornstad
Copy link
Contributor

No description provided.

@rbjornstad rbjornstad requested a review from Copilot March 21, 2025 13:06
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates several utility and test files to improve the vulnerability reporting and image parsing functionality while aligning menu item behavior with the new admin flag. Key changes include:

  • Adding a new test for getImageDisplayName and relocating its implementation into src/lib/utils/image.ts.
  • Enhancing the severityToColor function to support text-specific color schemes and updating menuItems to incorporate the isAdmin flag.
  • Removing legacy admin page code and cleaning up the associated file.

Reviewed Changes

Copilot reviewed 21 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/utils/image.test.ts Added tests for the getImageDisplayName utility function
src/lib/components/image/imageUtils.ts Extended detailsUrl to handle UBUNTU-based vulnerability IDs
src/lib/utils/vulnerabilities.ts Modified severityToColor with an optional isText parameter
src/lib/menuItems.test.ts Updated tests for menuItems to include the new isAdmin parameter
src/lib/utils/image.ts Adjusted parseImage to handle undefined images and relocated getImageDisplayName
src/lib/menuItems.ts Integrated isAdmin into the menuItems logic
src/routes/admin/+page.ts Removed legacy commented-out admin page code
Files not reviewed (12)
  • src/lib/components/Image.svelte: Language not supported
  • src/lib/components/VulnerabilityBadges.svelte: Language not supported
  • src/lib/components/WorkloadDeploy.svelte: Language not supported
  • src/lib/components/WorkloadVulnerabilitySummary.svelte: Language not supported
  • src/lib/components/errors/ErrorMessage.svelte: Language not supported
  • src/lib/components/errors/RiskScore.stories.svelte: Language not supported
  • src/lib/components/image/ImageVulnerabilities.svelte: Language not supported
  • src/lib/components/image/ImageWorkloadReferences.svelte: Language not supported
  • src/lib/components/image/TrailFinding.svelte: Language not supported
  • src/routes/dataproduct/image/+page.gql: Language not supported
  • src/routes/team/[team]/+layout.svelte: Language not supported
  • src/routes/team/[team]/+page.svelte: Language not supported
Comments suppressed due to low confidence (1)

src/routes/admin/+page.ts:1

  • The entire file is commented out; if it is no longer needed, consider removing it entirely to keep the codebase clean.
// TODO: Denne trengs vel ikke lenger? Kommenterer ut for å få npm run check ok.

Comment on lines +1 to +3
export const parseImage = (image?: string) => {
if (!image) {
return {};
Copy link
Preview

Copilot AI Mar 21, 2025

Choose a reason for hiding this comment

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

The function parseImage now accepts an optional image parameter but returns an empty object if undefined. Consider defining an explicit return type or error handling for clarity and better type safety.

Suggested change
export const parseImage = (image?: string) => {
if (!image) {
return {};
interface ParsedImage {
registry: string;
repository: string;
name: string;
tag?: string;
}
export const parseImage = (image?: string): ParsedImage => {
if (!image) {
throw new Error('Image parameter is undefined');

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@rbjornstad rbjornstad marked this pull request as ready for review March 21, 2025 13:20
@rbjornstad rbjornstad merged commit 15599e6 into main Mar 21, 2025
2 checks passed
@rbjornstad rbjornstad deleted the vulnz-report-facelift branch March 21, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants