feat: add links to security advisories for vulnerabilities page
This commit is contained in:
parent
7138b618e4
commit
092926523c
3 changed files with 63 additions and 27 deletions
|
@ -35,7 +35,10 @@ import {
|
||||||
interface VulnerabiltyEntry {
|
interface VulnerabiltyEntry {
|
||||||
_id: string;
|
_id: string;
|
||||||
version: string;
|
version: string;
|
||||||
bullets: { point: string }[];
|
bullets: {
|
||||||
|
point: string;
|
||||||
|
securityAdvisoryUrl: string;
|
||||||
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
type VulnerabiltiesForm = z.infer<typeof vulnerabilitiesSchema>;
|
type VulnerabiltiesForm = z.infer<typeof vulnerabilitiesSchema>;
|
||||||
|
@ -50,7 +53,7 @@ const AdminLogPage = () => {
|
||||||
resolver: zodResolver(vulnerabilitiesSchema),
|
resolver: zodResolver(vulnerabilitiesSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
version: "",
|
version: "",
|
||||||
bullets: [{ point: "" }]
|
bullets: [{ point: "", securityAdvisoryUrl: "" }]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -136,6 +139,7 @@ const AdminLogPage = () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
|
<>
|
||||||
<FormField
|
<FormField
|
||||||
key={field.id}
|
key={field.id}
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
@ -147,6 +151,22 @@ const AdminLogPage = () => {
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
key={field.id + "-securityAdvisory"}
|
||||||
|
control={form.control}
|
||||||
|
name={`bullets.${index}.securityAdvisoryUrl`}
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>
|
||||||
|
Security Advisory URL for Key Point {index + 1}
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
className="mt-2"
|
className="mt-2"
|
||||||
|
@ -158,13 +178,14 @@ const AdminLogPage = () => {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
))}
|
))}
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
size={"icon"}
|
size={"icon"}
|
||||||
variant={"outline"}
|
variant={"outline"}
|
||||||
onClick={() => append({ point: "" })}
|
onClick={() => append({ point: "", securityAdvisoryUrl: "" })}
|
||||||
>
|
>
|
||||||
+
|
+
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -3,9 +3,11 @@ import { VULNERABILITY } from "@/constants/guidelines";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import clientPromise from "@/lib/db";
|
import clientPromise from "@/lib/db";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
interface Bullet {
|
interface Bullet {
|
||||||
point: string;
|
point: string;
|
||||||
|
securityAdvisoryUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Vulnerabilities {
|
interface Vulnerabilities {
|
||||||
|
@ -80,7 +82,19 @@ const Vulnerabilities = async () => {
|
||||||
<h2 className="font-semibold text-3xl -mb-2">{download.version}</h2>
|
<h2 className="font-semibold text-3xl -mb-2">{download.version}</h2>
|
||||||
<ul className="list-disc pl-5">
|
<ul className="list-disc pl-5">
|
||||||
{(download.bullets ?? []).map((bullet, index) => (
|
{(download.bullets ?? []).map((bullet, index) => (
|
||||||
<li key={index}>{bullet.point}</li>
|
<li key={index}>
|
||||||
|
{bullet.point}
|
||||||
|
{bullet.securityAdvisoryUrl ? (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
<Link href={bullet.securityAdvisoryUrl}>
|
||||||
|
View security advisory
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,7 +28,8 @@ export const vulnerabilitiesSchema = z.object({
|
||||||
version: z.string(),
|
version: z.string(),
|
||||||
bullets: z.array(
|
bullets: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
point: z.string()
|
point: z.string(),
|
||||||
|
securityAdvisoryUrl: z.string()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue