Skip to content

Commit

Permalink
feat: add new analysis status and cvss version fields (#214)
Browse files Browse the repository at this point in the history
* feat: add new analysis status and cvss version fields

PiperOrigin-RevId: 477815955

Source-Link: googleapis/googleapis@57e38f0

Source-Link: googleapis/googleapis-gen@3a587e1
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2E1ODdlMTQ3NTIxZmY5NGM2OGE3OTE2M2FhMTY4NTVkYjlhN2E4YyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Oct 3, 2022
1 parent 087ca7f commit c05997a
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/grafeas/grafeas/grafeas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from grafeas.grafeas_v1.types.compliance import NonCompliantFile
from grafeas.grafeas_v1.types.cvss import CVSS
from grafeas.grafeas_v1.types.cvss import CVSSv3
from grafeas.grafeas_v1.types.cvss import CVSSVersion
from grafeas.grafeas_v1.types.deployment import DeploymentNote
from grafeas.grafeas_v1.types.deployment import DeploymentOccurrence
from grafeas.grafeas_v1.types.discovery import DiscoveryNote
Expand Down Expand Up @@ -125,6 +126,7 @@
"NonCompliantFile",
"CVSS",
"CVSSv3",
"CVSSVersion",
"DeploymentNote",
"DeploymentOccurrence",
"DiscoveryNote",
Expand Down
2 changes: 2 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from .types.compliance import NonCompliantFile
from .types.cvss import CVSS
from .types.cvss import CVSSv3
from .types.cvss import CVSSVersion
from .types.deployment import DeploymentNote
from .types.deployment import DeploymentOccurrence
from .types.discovery import DiscoveryNote
Expand Down Expand Up @@ -119,6 +120,7 @@
"BuildProvenance",
"BuilderConfig",
"CVSS",
"CVSSVersion",
"CVSSv3",
"CloudRepoSourceContext",
"Command",
Expand Down
2 changes: 2 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from .cvss import (
CVSS,
CVSSv3,
CVSSVersion,
)
from .deployment import (
DeploymentNote,
Expand Down Expand Up @@ -154,6 +155,7 @@
"NonCompliantFile",
"CVSS",
"CVSSv3",
"CVSSVersion",
"DeploymentNote",
"DeploymentOccurrence",
"DiscoveryNote",
Expand Down
8 changes: 8 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/types/cvss.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@
__protobuf__ = proto.module(
package="grafeas.v1",
manifest={
"CVSSVersion",
"CVSSv3",
"CVSS",
},
)


class CVSSVersion(proto.Enum):
r"""CVSS Version."""
CVSS_VERSION_UNSPECIFIED = 0
CVSS_VERSION_2 = 1
CVSS_VERSION_3 = 2


class CVSSv3(proto.Message):
r"""Common Vulnerability Scoring System version 3.
For details, see
Expand Down
32 changes: 32 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/types/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class DiscoveryOccurrence(proto.Message):
analyzed.
analysis_status (grafeas.grafeas_v1.types.DiscoveryOccurrence.AnalysisStatus):
The status of discovery for the resource.
analysis_completed (grafeas.grafeas_v1.types.DiscoveryOccurrence.AnalysisCompleted):
analysis_error (Sequence[google.rpc.status_pb2.Status]):
Indicates any errors encountered during
analysis of a resource. There could be 0 or more
of these errors.
analysis_status_error (google.rpc.status_pb2.Status):
When an error is encountered this will
contain a LocalizedMessage under details to show
Expand All @@ -81,13 +87,29 @@ class AnalysisStatus(proto.Enum):
r"""Analysis status for a resource. Currently for initial
analysis only (not updated in continuous analysis).
"""
_pb_options = {"allow_alias": True}
ANALYSIS_STATUS_UNSPECIFIED = 0
PENDING = 1
SCANNING = 2
FINISHED_SUCCESS = 3
COMPLETE = 3
FINISHED_FAILED = 4
FINISHED_UNSUPPORTED = 5

class AnalysisCompleted(proto.Message):
r"""Indicates which analysis completed successfully. Multiple
types of analysis can be performed on a single resource.
Attributes:
analysis_type (Sequence[str]):
"""

analysis_type = proto.RepeatedField(
proto.STRING,
number=1,
)

continuous_analysis = proto.Field(
proto.ENUM,
number=1,
Expand All @@ -98,6 +120,16 @@ class AnalysisStatus(proto.Enum):
number=2,
enum=AnalysisStatus,
)
analysis_completed = proto.Field(
proto.MESSAGE,
number=7,
message=AnalysisCompleted,
)
analysis_error = proto.RepeatedField(
proto.MESSAGE,
number=8,
message=status_pb2.Status,
)
analysis_status_error = proto.Field(
proto.MESSAGE,
number=3,
Expand Down
15 changes: 15 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/types/vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class VulnerabilityNote(proto.Message):
the source. This is an upstream timestamp from
the underlying information source - e.g. Ubuntu
security tracker.
cvss_version (grafeas.grafeas_v1.types.CVSSVersion):
CVSS version used to populate cvss_score and severity.
"""

class Detail(proto.Message):
Expand Down Expand Up @@ -281,6 +283,11 @@ class KnowledgeBase(proto.Message):
number=6,
message=timestamp_pb2.Timestamp,
)
cvss_version = proto.Field(
proto.ENUM,
number=7,
enum=cvss.CVSSVersion,
)


class VulnerabilityOccurrence(proto.Message):
Expand Down Expand Up @@ -331,6 +338,9 @@ class VulnerabilityOccurrence(proto.Message):
fix_available (bool):
Output only. Whether at least one of the
affected packages has a fix available.
cvss_version (grafeas.grafeas_v1.types.CVSSVersion):
Output only. CVSS version used to populate cvss_score and
severity.
"""

class PackageIssue(proto.Message):
Expand Down Expand Up @@ -466,6 +476,11 @@ class PackageIssue(proto.Message):
proto.BOOL,
number=9,
)
cvss_version = proto.Field(
proto.ENUM,
number=11,
enum=cvss.CVSSVersion,
)


__all__ = tuple(sorted(__protobuf__.manifest))

0 comments on commit c05997a

Please sign in to comment.