/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Indicates conditions beyond the attacker’s control that must exist in order to exploit the vulnerability. The Attack Complexity metric is scored as either Low or High. There are two possible values: Low (L) – There are no specific pre-conditions required for exploitation, High (H) – The attacker must complete some number of preparatory steps in order to get access. */ export const CVSSv4ComponentsAttackComplexity = { Unknown: "", Low: "low", High: "high", } as const; /** * Indicates conditions beyond the attacker’s control that must exist in order to exploit the vulnerability. The Attack Complexity metric is scored as either Low or High. There are two possible values: Low (L) – There are no specific pre-conditions required for exploitation, High (H) – The attacker must complete some number of preparatory steps in order to get access. */ export type CVSSv4ComponentsAttackComplexity = OpenEnum< typeof CVSSv4ComponentsAttackComplexity >; export const AttackRequirements = { Unknown: "", None: "none", Present: "present", } as const; export type AttackRequirements = OpenEnum; /** * Indicates the level of access required for an attacker to exploit the vulnerability. The Attack Vector metric is scored in one of four levels: Network (N) – Vulnerabilities with this rating are remotely exploitable, from one or more hops away, up to, and including, remote exploitation over the Internet, Adjacent (A) – A vulnerability with this rating requires network adjacency for exploitation. The attack must be launched from the same physical or logical network, Local (L) – Vulnerabilities with this rating are not exploitable over a network, Physical (P) – An attacker must physically interact with the target system. */ export const CVSSv4ComponentsAttackVector = { Unknown: "", Network: "network", Adjacent: "adjacent", Local: "local", Physical: "physical", } as const; /** * Indicates the level of access required for an attacker to exploit the vulnerability. The Attack Vector metric is scored in one of four levels: Network (N) – Vulnerabilities with this rating are remotely exploitable, from one or more hops away, up to, and including, remote exploitation over the Internet, Adjacent (A) – A vulnerability with this rating requires network adjacency for exploitation. The attack must be launched from the same physical or logical network, Local (L) – Vulnerabilities with this rating are not exploitable over a network, Physical (P) – An attacker must physically interact with the target system. */ export type CVSSv4ComponentsAttackVector = OpenEnum< typeof CVSSv4ComponentsAttackVector >; export const Automatable = { Unknown: "", No: "no", Yes: "yes", } as const; export type Automatable = OpenEnum; /** * If an attack renders information unavailable, such as when a system crashes or through a DDoS attack, availability is negatively impacted. Availability has three possible values: None (N) – There is no loss of availability, Low (L) – Availability might be intermittently limited, or performance might be negatively impacted, as a result of a successful attack, High (H) – There is a complete loss of availability of the impacted system or information. */ export const CVSSv4ComponentsAvailability = { Unknown: "", None: "none", Low: "low", High: "high", } as const; /** * If an attack renders information unavailable, such as when a system crashes or through a DDoS attack, availability is negatively impacted. Availability has three possible values: None (N) – There is no loss of availability, Low (L) – Availability might be intermittently limited, or performance might be negatively impacted, as a result of a successful attack, High (H) – There is a complete loss of availability of the impacted system or information. */ export type CVSSv4ComponentsAvailability = OpenEnum< typeof CVSSv4ComponentsAvailability >; /** * Refers to the disclosure of sensitive information to authorized and unauthorized users, with the goal being that only authorized users are able to access the target data. Confidentiality has three potential values: High (H) – The attacker has full access to all resources in the impacted system, including highly sensitive information such as encryption keys, Low (L) – The attacker has partial access to information, with no control over what, specifically, they are able to access, None (N) – No data is accessible to unauthorized users as a result of the exploit. */ export const CVSSv4ComponentsConfidentiality = { Unknown: "", None: "none", Low: "low", High: "high", } as const; /** * Refers to the disclosure of sensitive information to authorized and unauthorized users, with the goal being that only authorized users are able to access the target data. Confidentiality has three potential values: High (H) – The attacker has full access to all resources in the impacted system, including highly sensitive information such as encryption keys, Low (L) – The attacker has partial access to information, with no control over what, specifically, they are able to access, None (N) – No data is accessible to unauthorized users as a result of the exploit. */ export type CVSSv4ComponentsConfidentiality = OpenEnum< typeof CVSSv4ComponentsConfidentiality >; /** * Refers to whether the protected information has been tampered with or changed in any way. If there is no way for an attacker to alter the accuracy or completeness of the information, integrity has been maintained. Integrity has three values: None (N) – There is no loss of the integrity of any information, Low (L) – A limited amount of information might be tampered with or modified, but there is no serious impact on the protected system, High (H) – The attacker can modify any/all information on the target system, resulting in a complete loss of integrity. */ export const CVSSv4ComponentsIntegrity = { Unknown: "", None: "none", Low: "low", High: "high", } as const; /** * Refers to whether the protected information has been tampered with or changed in any way. If there is no way for an attacker to alter the accuracy or completeness of the information, integrity has been maintained. Integrity has three values: None (N) – There is no loss of the integrity of any information, Low (L) – A limited amount of information might be tampered with or modified, but there is no serious impact on the protected system, High (H) – The attacker can modify any/all information on the target system, resulting in a complete loss of integrity. */ export type CVSSv4ComponentsIntegrity = OpenEnum< typeof CVSSv4ComponentsIntegrity >; /** * Describes the level of privileges or access an attacker must have before successful exploitation. There are three possible values: None (N) – There is no privilege or special access required to conduct the attack, Low (L) – The attacker requires basic, “user” level privileges to leverage the exploit, High (H) – Administrative or similar access privileges are required for successful attack. */ export const CVSSv4ComponentsPrivilegesRequired = { Unknown: "", None: "none", Low: "low", High: "high", } as const; /** * Describes the level of privileges or access an attacker must have before successful exploitation. There are three possible values: None (N) – There is no privilege or special access required to conduct the attack, Low (L) – The attacker requires basic, “user” level privileges to leverage the exploit, High (H) – Administrative or similar access privileges are required for successful attack. */ export type CVSSv4ComponentsPrivilegesRequired = OpenEnum< typeof CVSSv4ComponentsPrivilegesRequired >; export const ProviderUrgency = { Unknown: "", Clear: "clear", Green: "green", Amber: "amber", Red: "red", } as const; export type ProviderUrgency = OpenEnum; export const Recovery = { Unknown: "", Automatic: "automatic", User: "user", Irrecoverable: "irrecoverable", } as const; export type Recovery = OpenEnum; export const Safety = { Unknown: "", Negligible: "negligible", Present: "present", } as const; export type Safety = OpenEnum; /** * Describes whether a user, other than the attacker, is required to do anything or participate in exploitation of the vulnerability. User interaction has two possible values: None (N) – No user interaction is required, Required (R) – A user must complete some steps for the exploit to succeed. For example, a user might be required to install some software. */ export const CVSSv4ComponentsUserInteraction = { Unknown: "", None: "none", Required: "required", } as const; /** * Describes whether a user, other than the attacker, is required to do anything or participate in exploitation of the vulnerability. User interaction has two possible values: None (N) – No user interaction is required, Required (R) – A user must complete some steps for the exploit to succeed. For example, a user might be required to install some software. */ export type CVSSv4ComponentsUserInteraction = OpenEnum< typeof CVSSv4ComponentsUserInteraction >; export const ValueDensity = { Unknown: "", Diffuse: "diffuse", Concentrated: "concentrated", } as const; export type ValueDensity = OpenEnum; export const VulnerabilityResponseEffort = { Unknown: "", Low: "low", Moderate: "moderate", High: "high", } as const; export type VulnerabilityResponseEffort = OpenEnum< typeof VulnerabilityResponseEffort >; export type CVSSv4Components = { /** * Indicates conditions beyond the attacker’s control that must exist in order to exploit the vulnerability. The Attack Complexity metric is scored as either Low or High. There are two possible values: Low (L) – There are no specific pre-conditions required for exploitation, High (H) – The attacker must complete some number of preparatory steps in order to get access. */ attackComplexity?: CVSSv4ComponentsAttackComplexity | undefined; attackRequirements?: AttackRequirements | undefined; /** * Indicates the level of access required for an attacker to exploit the vulnerability. The Attack Vector metric is scored in one of four levels: Network (N) – Vulnerabilities with this rating are remotely exploitable, from one or more hops away, up to, and including, remote exploitation over the Internet, Adjacent (A) – A vulnerability with this rating requires network adjacency for exploitation. The attack must be launched from the same physical or logical network, Local (L) – Vulnerabilities with this rating are not exploitable over a network, Physical (P) – An attacker must physically interact with the target system. */ attackVector?: CVSSv4ComponentsAttackVector | undefined; automatable?: Automatable | undefined; /** * If an attack renders information unavailable, such as when a system crashes or through a DDoS attack, availability is negatively impacted. Availability has three possible values: None (N) – There is no loss of availability, Low (L) – Availability might be intermittently limited, or performance might be negatively impacted, as a result of a successful attack, High (H) – There is a complete loss of availability of the impacted system or information. */ availability?: CVSSv4ComponentsAvailability | undefined; /** * Refers to the disclosure of sensitive information to authorized and unauthorized users, with the goal being that only authorized users are able to access the target data. Confidentiality has three potential values: High (H) – The attacker has full access to all resources in the impacted system, including highly sensitive information such as encryption keys, Low (L) – The attacker has partial access to information, with no control over what, specifically, they are able to access, None (N) – No data is accessible to unauthorized users as a result of the exploit. */ confidentiality?: CVSSv4ComponentsConfidentiality | undefined; /** * Refers to whether the protected information has been tampered with or changed in any way. If there is no way for an attacker to alter the accuracy or completeness of the information, integrity has been maintained. Integrity has three values: None (N) – There is no loss of the integrity of any information, Low (L) – A limited amount of information might be tampered with or modified, but there is no serious impact on the protected system, High (H) – The attacker can modify any/all information on the target system, resulting in a complete loss of integrity. */ integrity?: CVSSv4ComponentsIntegrity | undefined; /** * Describes the level of privileges or access an attacker must have before successful exploitation. There are three possible values: None (N) – There is no privilege or special access required to conduct the attack, Low (L) – The attacker requires basic, “user” level privileges to leverage the exploit, High (H) – Administrative or similar access privileges are required for successful attack. */ privilegesRequired?: CVSSv4ComponentsPrivilegesRequired | undefined; providerUrgency?: ProviderUrgency | undefined; recovery?: Recovery | undefined; safety?: Safety | undefined; /** * Describes whether a user, other than the attacker, is required to do anything or participate in exploitation of the vulnerability. User interaction has two possible values: None (N) – No user interaction is required, Required (R) – A user must complete some steps for the exploit to succeed. For example, a user might be required to install some software. */ userInteraction?: CVSSv4ComponentsUserInteraction | undefined; valueDensity?: ValueDensity | undefined; vulnerabilityResponseEffort?: VulnerabilityResponseEffort | undefined; }; /** @internal */ export const CVSSv4ComponentsAttackComplexity$inboundSchema: z.ZodType< CVSSv4ComponentsAttackComplexity, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsAttackComplexity); /** @internal */ export const AttackRequirements$inboundSchema: z.ZodType< AttackRequirements, z.ZodTypeDef, unknown > = openEnums.inboundSchema(AttackRequirements); /** @internal */ export const CVSSv4ComponentsAttackVector$inboundSchema: z.ZodType< CVSSv4ComponentsAttackVector, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsAttackVector); /** @internal */ export const Automatable$inboundSchema: z.ZodType< Automatable, z.ZodTypeDef, unknown > = openEnums.inboundSchema(Automatable); /** @internal */ export const CVSSv4ComponentsAvailability$inboundSchema: z.ZodType< CVSSv4ComponentsAvailability, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsAvailability); /** @internal */ export const CVSSv4ComponentsConfidentiality$inboundSchema: z.ZodType< CVSSv4ComponentsConfidentiality, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsConfidentiality); /** @internal */ export const CVSSv4ComponentsIntegrity$inboundSchema: z.ZodType< CVSSv4ComponentsIntegrity, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsIntegrity); /** @internal */ export const CVSSv4ComponentsPrivilegesRequired$inboundSchema: z.ZodType< CVSSv4ComponentsPrivilegesRequired, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsPrivilegesRequired); /** @internal */ export const ProviderUrgency$inboundSchema: z.ZodType< ProviderUrgency, z.ZodTypeDef, unknown > = openEnums.inboundSchema(ProviderUrgency); /** @internal */ export const Recovery$inboundSchema: z.ZodType< Recovery, z.ZodTypeDef, unknown > = openEnums.inboundSchema(Recovery); /** @internal */ export const Safety$inboundSchema: z.ZodType = openEnums.inboundSchema(Safety); /** @internal */ export const CVSSv4ComponentsUserInteraction$inboundSchema: z.ZodType< CVSSv4ComponentsUserInteraction, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CVSSv4ComponentsUserInteraction); /** @internal */ export const ValueDensity$inboundSchema: z.ZodType< ValueDensity, z.ZodTypeDef, unknown > = openEnums.inboundSchema(ValueDensity); /** @internal */ export const VulnerabilityResponseEffort$inboundSchema: z.ZodType< VulnerabilityResponseEffort, z.ZodTypeDef, unknown > = openEnums.inboundSchema(VulnerabilityResponseEffort); /** @internal */ export const CVSSv4Components$inboundSchema: z.ZodType< CVSSv4Components, z.ZodTypeDef, unknown > = z.object({ attack_complexity: CVSSv4ComponentsAttackComplexity$inboundSchema.optional(), attack_requirements: AttackRequirements$inboundSchema.optional(), attack_vector: CVSSv4ComponentsAttackVector$inboundSchema.optional(), automatable: Automatable$inboundSchema.optional(), availability: CVSSv4ComponentsAvailability$inboundSchema.optional(), confidentiality: CVSSv4ComponentsConfidentiality$inboundSchema.optional(), integrity: CVSSv4ComponentsIntegrity$inboundSchema.optional(), privileges_required: CVSSv4ComponentsPrivilegesRequired$inboundSchema .optional(), provider_urgency: ProviderUrgency$inboundSchema.optional(), recovery: Recovery$inboundSchema.optional(), safety: Safety$inboundSchema.optional(), user_interaction: CVSSv4ComponentsUserInteraction$inboundSchema.optional(), value_density: ValueDensity$inboundSchema.optional(), vulnerability_response_effort: VulnerabilityResponseEffort$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "attack_complexity": "attackComplexity", "attack_requirements": "attackRequirements", "attack_vector": "attackVector", "privileges_required": "privilegesRequired", "provider_urgency": "providerUrgency", "user_interaction": "userInteraction", "value_density": "valueDensity", "vulnerability_response_effort": "vulnerabilityResponseEffort", }); }); export function cvsSv4ComponentsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CVSSv4Components$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CVSSv4Components' from JSON`, ); }