/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ExternalFindingSeverityType, ExternalFindingSeverityType$inboundSchema, } from "./externalfindingseveritytype.js"; import { VulnerabilityType, VulnerabilityType$inboundSchema, } from "./vulnerabilitytype.js"; /** * Metadata for the deactivation of the vulnerability. */ export type DeactivateMetadata = { /** * Whether the vulnerability is deactivated indefinitely. */ isVulnDeactivatedIndefinitely: boolean; /** * Date when the vulnerability will be reactivated. */ deactivatedUntilDate: Date | null; /** * Reason for deactivating the vulnerability. */ deactivationReason: string; /** * Date when the vulnerability was deactivated. */ deactivatedOnDate: Date; /** * Identifier of the user who deactivated the vulnerability. */ deactivatedBy: string; }; export type AuditorApiVulnerability = { /** * Unique identifier for the vulnerability. */ id: string; /** * Display name of the vulnerability. */ name: string; /** * Description of the vulnerability. */ description: string; /** * Integration that the vulnerability is scanned by. */ integrationId: string; /** * Identifier for the package that the vulnerability is found on. * * @remarks * Only relevant to vulnerabilities of type COMMON or GROUPED. */ packageIdentifier: string | null; vulnerabilityType: VulnerabilityType; /** * Unique identifier for the underlying resource that the vulnerability is found on. */ targetId: string; /** * Date when the vulnerability was first detected by Vanta. */ firstDetectedDate: Date; /** * Date when the vulnerability was first detected by the source. */ sourceDetectedDate: Date | null; /** * Date when the vulnerability was last detected. */ lastDetectedDate: Date | null; severity: ExternalFindingSeverityType; /** * CVSS severity score of the vulnerability. */ cvssSeverityScore: number | null; /** * Scanner score of the vulnerability. */ scannerScore: number | null; /** * Whether the vulnerability is fixable. */ isFixable: boolean; /** * Date when the vulnerability should be remediated by. */ remediateByDate: Date | null; /** * Related vulnerabilities. * * @remarks * Only relevant to vulnerabilities of type GROUPED. */ relatedVulns: Array; /** * Related URLs. */ relatedUrls: Array; /** * External URL for the vulnerability. */ externalURL: string; /** * Scanning tool that detected the vulnerability */ scanSource?: string | undefined; /** * Metadata for the deactivation of the vulnerability. */ deactivateMetadata: DeactivateMetadata | null; }; /** @internal */ export const DeactivateMetadata$inboundSchema: z.ZodType< DeactivateMetadata, z.ZodTypeDef, unknown > = z.object({ isVulnDeactivatedIndefinitely: z.boolean(), deactivatedUntilDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), deactivationReason: z.string(), deactivatedOnDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), deactivatedBy: z.string(), }); export function deactivateMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeactivateMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeactivateMetadata' from JSON`, ); } /** @internal */ export const AuditorApiVulnerability$inboundSchema: z.ZodType< AuditorApiVulnerability, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), description: z.string(), integrationId: z.string(), packageIdentifier: z.nullable(z.string()), vulnerabilityType: VulnerabilityType$inboundSchema, targetId: z.string(), firstDetectedDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), sourceDetectedDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), lastDetectedDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), severity: ExternalFindingSeverityType$inboundSchema, cvssSeverityScore: z.nullable(z.number()), scannerScore: z.nullable(z.number()), isFixable: z.boolean(), remediateByDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), relatedVulns: z.array(z.string()), relatedUrls: z.array(z.string()), externalURL: z.string(), scanSource: z.string().optional(), deactivateMetadata: z.nullable( z.lazy(() => DeactivateMetadata$inboundSchema), ), }); export function auditorApiVulnerabilityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditorApiVulnerability$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditorApiVulnerability' from JSON`, ); }