Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
feat: Added vulnerability field to Finding (#235)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 401787368 Source-Link: googleapis/googleapis@a7a3440 Source-Link: googleapis/googleapis-gen@169ba7f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTY5YmE3ZmViZjAwZWUwMzA0NDZhMDUzNGFjNzdhZDU3ZjBiZjgzYSJ9 feat: Added type field to the resource which is surfaced in NotificationMessage
- Loading branch information
1 parent
e5df93b
commit a233f7a
Showing
9 changed files
with
232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import proto # type: ignore | ||
|
||
|
||
__protobuf__ = proto.module( | ||
package="google.cloud.securitycenter.v1", | ||
manifest={"Vulnerability", "Cve", "Reference", "Cvssv3",}, | ||
) | ||
|
||
|
||
class Vulnerability(proto.Message): | ||
r"""Refers to common vulnerability fields e.g. cve, cvss, cwe | ||
etc. | ||
Attributes: | ||
cve (google.cloud.securitycenter_v1.types.Cve): | ||
CVE stands for Common Vulnerabilities and | ||
Exposures (https://cve.mitre.org/about/) | ||
""" | ||
|
||
cve = proto.Field(proto.MESSAGE, number=1, message="Cve",) | ||
|
||
|
||
class Cve(proto.Message): | ||
r"""CVE stands for Common Vulnerabilities and Exposures. | ||
More information: https://cve.mitre.org | ||
Attributes: | ||
id (str): | ||
The unique identifier for the vulnerability. | ||
e.g. CVE-2021-34527 | ||
references (Sequence[google.cloud.securitycenter_v1.types.Reference]): | ||
Additional information about the CVE. | ||
e.g. https://cve.mitre.org/cgi- | ||
bin/cvename.cgi?name=CVE-2021-34527 | ||
cvssv3 (google.cloud.securitycenter_v1.types.Cvssv3): | ||
Describe Common Vulnerability Scoring System | ||
specified at | ||
https://www.first.org/cvss/v3.1/specification- | ||
document | ||
""" | ||
|
||
id = proto.Field(proto.STRING, number=1,) | ||
references = proto.RepeatedField(proto.MESSAGE, number=2, message="Reference",) | ||
cvssv3 = proto.Field(proto.MESSAGE, number=3, message="Cvssv3",) | ||
|
||
|
||
class Reference(proto.Message): | ||
r"""Additional Links | ||
Attributes: | ||
source (str): | ||
Source of the reference e.g. NVD | ||
uri (str): | ||
Uri for the mentioned source e.g. | ||
https://cve.mitre.org/cgi- | ||
bin/cvename.cgi?name=CVE-2021-34527. | ||
""" | ||
|
||
source = proto.Field(proto.STRING, number=1,) | ||
uri = proto.Field(proto.STRING, number=2,) | ||
|
||
|
||
class Cvssv3(proto.Message): | ||
r"""Common Vulnerability Scoring System version 3. | ||
Attributes: | ||
base_score (float): | ||
The base score is a function of the base | ||
metric scores. | ||
attack_vector (google.cloud.securitycenter_v1.types.Cvssv3.AttackVector): | ||
Base Metrics | ||
Represents the intrinsic characteristics of a | ||
vulnerability that are constant over time and | ||
across user environments. This metric reflects | ||
the context by which vulnerability exploitation | ||
is possible. | ||
attack_complexity (google.cloud.securitycenter_v1.types.Cvssv3.AttackComplexity): | ||
This metric describes the conditions beyond | ||
the attacker's control that must exist in order | ||
to exploit the vulnerability. | ||
privileges_required (google.cloud.securitycenter_v1.types.Cvssv3.PrivilegesRequired): | ||
This metric describes the level of privileges | ||
an attacker must possess before successfully | ||
exploiting the vulnerability. | ||
user_interaction (google.cloud.securitycenter_v1.types.Cvssv3.UserInteraction): | ||
This metric captures the requirement for a | ||
human user, other than the attacker, to | ||
participate in the successful compromise of the | ||
vulnerable component. | ||
scope (google.cloud.securitycenter_v1.types.Cvssv3.Scope): | ||
The Scope metric captures whether a | ||
vulnerability in one vulnerable component | ||
impacts resources in components beyond its | ||
security scope. | ||
confidentiality_impact (google.cloud.securitycenter_v1.types.Cvssv3.Impact): | ||
This metric measures the impact to the | ||
confidentiality of the information resources | ||
managed by a software component due to a | ||
successfully exploited vulnerability. | ||
integrity_impact (google.cloud.securitycenter_v1.types.Cvssv3.Impact): | ||
This metric measures the impact to integrity | ||
of a successfully exploited vulnerability. | ||
availability_impact (google.cloud.securitycenter_v1.types.Cvssv3.Impact): | ||
This metric measures the impact to the | ||
availability of the impacted component resulting | ||
from a successfully exploited vulnerability. | ||
""" | ||
|
||
class AttackVector(proto.Enum): | ||
r"""This metric reflects the context by which vulnerability | ||
exploitation is possible. | ||
""" | ||
ATTACK_VECTOR_UNSPECIFIED = 0 | ||
ATTACK_VECTOR_NETWORK = 1 | ||
ATTACK_VECTOR_ADJACENT = 2 | ||
ATTACK_VECTOR_LOCAL = 3 | ||
ATTACK_VECTOR_PHYSICAL = 4 | ||
|
||
class AttackComplexity(proto.Enum): | ||
r"""This metric describes the conditions beyond the attacker's | ||
control that must exist in order to exploit the vulnerability. | ||
""" | ||
ATTACK_COMPLEXITY_UNSPECIFIED = 0 | ||
ATTACK_COMPLEXITY_LOW = 1 | ||
ATTACK_COMPLEXITY_HIGH = 2 | ||
|
||
class PrivilegesRequired(proto.Enum): | ||
r"""This metric describes the level of privileges an attacker | ||
must possess before successfully exploiting the vulnerability. | ||
""" | ||
PRIVILEGES_REQUIRED_UNSPECIFIED = 0 | ||
PRIVILEGES_REQUIRED_NONE = 1 | ||
PRIVILEGES_REQUIRED_LOW = 2 | ||
PRIVILEGES_REQUIRED_HIGH = 3 | ||
|
||
class UserInteraction(proto.Enum): | ||
r"""This metric captures the requirement for a human user, other | ||
than the attacker, to participate in the successful compromise | ||
of the vulnerable component. | ||
""" | ||
USER_INTERACTION_UNSPECIFIED = 0 | ||
USER_INTERACTION_NONE = 1 | ||
USER_INTERACTION_REQUIRED = 2 | ||
|
||
class Scope(proto.Enum): | ||
r"""The Scope metric captures whether a vulnerability in one | ||
vulnerable component impacts resources in components beyond its | ||
security scope. | ||
""" | ||
SCOPE_UNSPECIFIED = 0 | ||
SCOPE_UNCHANGED = 1 | ||
SCOPE_CHANGED = 2 | ||
|
||
class Impact(proto.Enum): | ||
r"""The Impact metrics capture the effects of a successfully | ||
exploited vulnerability on the component that suffers the worst | ||
outcome that is most directly and predictably associated with | ||
the attack. | ||
""" | ||
IMPACT_UNSPECIFIED = 0 | ||
IMPACT_HIGH = 1 | ||
IMPACT_LOW = 2 | ||
IMPACT_NONE = 3 | ||
|
||
base_score = proto.Field(proto.DOUBLE, number=1,) | ||
attack_vector = proto.Field(proto.ENUM, number=5, enum=AttackVector,) | ||
attack_complexity = proto.Field(proto.ENUM, number=6, enum=AttackComplexity,) | ||
privileges_required = proto.Field(proto.ENUM, number=7, enum=PrivilegesRequired,) | ||
user_interaction = proto.Field(proto.ENUM, number=8, enum=UserInteraction,) | ||
scope = proto.Field(proto.ENUM, number=9, enum=Scope,) | ||
confidentiality_impact = proto.Field(proto.ENUM, number=10, enum=Impact,) | ||
integrity_impact = proto.Field(proto.ENUM, number=11, enum=Impact,) | ||
availability_impact = proto.Field(proto.ENUM, number=12, enum=Impact,) | ||
|
||
|
||
__all__ = tuple(sorted(__protobuf__.manifest)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters