mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore!: remove JFrog integration (#17353)
- Removes displaying XRay scan results in the dashboard. I'm not sure anyone was even using this integration so it's just debt for us to maintain. We can open up a separate issue to get rid of the db tables once we know for sure that we haven't broken anyone.
This commit is contained in:
@@ -381,11 +381,6 @@ export type InsightsTemplateParams = InsightsParams & {
|
||||
interval: "day" | "week";
|
||||
};
|
||||
|
||||
export type GetJFrogXRayScanParams = {
|
||||
workspaceId: string;
|
||||
agentId: string;
|
||||
};
|
||||
|
||||
export class MissingBuildParameters extends Error {
|
||||
parameters: TypesGen.TemplateVersionParameter[] = [];
|
||||
versionId: string;
|
||||
@@ -2277,29 +2272,6 @@ class ApiMethods {
|
||||
await this.axios.delete(`/api/v2/workspaces/${workspaceID}/favorite`);
|
||||
};
|
||||
|
||||
getJFrogXRayScan = async (options: GetJFrogXRayScanParams) => {
|
||||
const searchParams = new URLSearchParams({
|
||||
workspace_id: options.workspaceId,
|
||||
agent_id: options.agentId,
|
||||
});
|
||||
|
||||
try {
|
||||
const res = await this.axios.get<TypesGen.JFrogXrayScan>(
|
||||
`/api/v2/integrations/jfrog/xray-scan?${searchParams}`,
|
||||
);
|
||||
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
if (isAxiosError(error) && error.response?.status === 404) {
|
||||
// react-query library does not allow undefined to be returned as a
|
||||
// query result
|
||||
return null;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
postWorkspaceUsage = async (
|
||||
workspaceID: string,
|
||||
options: PostWorkspaceUsageRequest,
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import type { GetJFrogXRayScanParams } from "api/api";
|
||||
import { API } from "api/api";
|
||||
|
||||
export const xrayScan = (params: GetJFrogXRayScanParams) => {
|
||||
return {
|
||||
queryKey: ["xray", params],
|
||||
queryFn: () => API.getJFrogXRayScan(params),
|
||||
};
|
||||
};
|
||||
Generated
-10
@@ -1171,16 +1171,6 @@ export interface IssueReconnectingPTYSignedTokenResponse {
|
||||
readonly signed_token: string;
|
||||
}
|
||||
|
||||
// From codersdk/jfrog.go
|
||||
export interface JFrogXrayScan {
|
||||
readonly workspace_id: string;
|
||||
readonly agent_id: string;
|
||||
readonly critical: number;
|
||||
readonly high: number;
|
||||
readonly medium: number;
|
||||
readonly results_url: string;
|
||||
}
|
||||
|
||||
// From codersdk/provisionerdaemons.go
|
||||
export type JobErrorCode = "REQUIRED_TEMPLATE_VARIABLES";
|
||||
|
||||
|
||||
@@ -299,27 +299,6 @@ export const Deprecated: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const WithXRayScan: Story = {
|
||||
parameters: {
|
||||
queries: [
|
||||
{
|
||||
key: [
|
||||
"xray",
|
||||
{ agentId: M.MockWorkspaceAgent.id, workspaceId: M.MockWorkspace.id },
|
||||
],
|
||||
data: {
|
||||
workspace_id: M.MockWorkspace.id,
|
||||
agent_id: M.MockWorkspaceAgent.id,
|
||||
critical: 10,
|
||||
high: 3,
|
||||
medium: 5,
|
||||
results_url: "http://localhost:8080",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export const HideApp: Story = {
|
||||
args: {
|
||||
agent: {
|
||||
|
||||
@@ -4,7 +4,6 @@ import Collapse from "@mui/material/Collapse";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import { API } from "api/api";
|
||||
import { xrayScan } from "api/queries/integrations";
|
||||
import type {
|
||||
Template,
|
||||
Workspace,
|
||||
@@ -41,7 +40,6 @@ import { PortForwardButton } from "./PortForwardButton";
|
||||
import { AgentSSHButton } from "./SSHButton/SSHButton";
|
||||
import { TerminalLink } from "./TerminalLink/TerminalLink";
|
||||
import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton";
|
||||
import { XRayScanAlert } from "./XRayScanAlert";
|
||||
|
||||
export interface AgentRowProps {
|
||||
agent: WorkspaceAgent;
|
||||
@@ -72,11 +70,6 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
storybookAgentMetadata,
|
||||
sshPrefix,
|
||||
}) => {
|
||||
// XRay integration
|
||||
const xrayScanQuery = useQuery(
|
||||
xrayScan({ workspaceId: workspace.id, agentId: agent.id }),
|
||||
);
|
||||
|
||||
// Apps visibility
|
||||
const visibleApps = agent.apps.filter((app) => !app.hidden);
|
||||
const hasAppsToDisplay = !hideVSCodeDesktopButton || visibleApps.length > 0;
|
||||
@@ -227,8 +220,6 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
)}
|
||||
</header>
|
||||
|
||||
{xrayScanQuery.data && <XRayScanAlert scan={xrayScanQuery.data} />}
|
||||
|
||||
<div css={styles.content}>
|
||||
{agent.status === "connected" && (
|
||||
<section css={styles.apps}>
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
import type { Interpolation, Theme } from "@emotion/react";
|
||||
import type { JFrogXrayScan } from "api/typesGenerated";
|
||||
import { Button } from "components/Button/Button";
|
||||
import { ExternalImage } from "components/ExternalImage/ExternalImage";
|
||||
import type { FC } from "react";
|
||||
|
||||
interface XRayScanAlertProps {
|
||||
scan: JFrogXrayScan;
|
||||
}
|
||||
|
||||
export const XRayScanAlert: FC<XRayScanAlertProps> = ({ scan }) => {
|
||||
const display = scan.critical > 0 || scan.high > 0 || scan.medium > 0;
|
||||
return display ? (
|
||||
<div role="alert" css={styles.root}>
|
||||
<ExternalImage
|
||||
alt="JFrog logo"
|
||||
src="/icon/jfrog.svg"
|
||||
css={{ width: 40, height: 40 }}
|
||||
/>
|
||||
<div>
|
||||
<span css={styles.title}>
|
||||
JFrog Xray detected new vulnerabilities for this agent
|
||||
</span>
|
||||
|
||||
<ul css={styles.issues}>
|
||||
{scan.critical > 0 && (
|
||||
<li css={[styles.critical, styles.issueItem]}>
|
||||
{scan.critical} critical
|
||||
</li>
|
||||
)}
|
||||
{scan.high > 0 && (
|
||||
<li css={[styles.high, styles.issueItem]}>{scan.high} high</li>
|
||||
)}
|
||||
{scan.medium > 0 && (
|
||||
<li css={[styles.medium, styles.issueItem]}>
|
||||
{scan.medium} medium
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
<div css={styles.link}>
|
||||
<Button size="sm" variant="subtle" asChild>
|
||||
<a href={scan.results_url} target="_blank" rel="noreferrer">
|
||||
Review results
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = {
|
||||
root: (theme) => ({
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
border: `1px solid ${theme.palette.divider}`,
|
||||
borderLeft: 0,
|
||||
borderRight: 0,
|
||||
fontSize: 14,
|
||||
padding: "24px 16px 24px 32px",
|
||||
lineHeight: "1.5",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 24,
|
||||
}),
|
||||
title: {
|
||||
display: "block",
|
||||
fontWeight: 500,
|
||||
},
|
||||
issues: {
|
||||
listStyle: "none",
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
fontSize: 13,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 16,
|
||||
marginTop: 4,
|
||||
},
|
||||
issueItem: {
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 8,
|
||||
|
||||
"&:before": {
|
||||
content: '""',
|
||||
display: "block",
|
||||
width: 6,
|
||||
height: 6,
|
||||
borderRadius: "50%",
|
||||
backgroundColor: "currentColor",
|
||||
},
|
||||
},
|
||||
critical: (theme) => ({
|
||||
color: theme.roles.error.fill.solid,
|
||||
}),
|
||||
high: (theme) => ({
|
||||
color: theme.roles.warning.fill.solid,
|
||||
}),
|
||||
medium: (theme) => ({
|
||||
color: theme.roles.notice.fill.solid,
|
||||
}),
|
||||
link: {
|
||||
marginLeft: "auto",
|
||||
alignSelf: "flex-start",
|
||||
},
|
||||
} satisfies Record<string, Interpolation<Theme>>;
|
||||
@@ -374,8 +374,4 @@ export const handlers = [
|
||||
http.get("/api/v2/workspaceagents/:agent/listening-ports", () => {
|
||||
return HttpResponse.json(M.MockListeningPortsResponse);
|
||||
}),
|
||||
|
||||
http.get("/api/v2/integrations/jfrog/xray-scan", () => {
|
||||
return new HttpResponse(null, { status: 404 });
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user