Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e42dca2

Browse files
Google APIscopybara-github
authored andcommitted
feat: Added security center api V2 client library
PiperOrigin-RevId: 611571259
1 parent 87ef1fe commit e42dca2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+6116
-0
lines changed

google/cloud/securitycenter/v2/BUILD.bazel

Lines changed: 438 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.securitycenter.v2;
18+
19+
option csharp_namespace = "Google.Cloud.SecurityCenter.V2";
20+
option go_package = "cloud.google.com/go/securitycenter/apiv2/securitycenterpb;securitycenterpb";
21+
option java_multiple_files = true;
22+
option java_outer_classname = "AccessProto";
23+
option java_package = "com.google.cloud.securitycenter.v2";
24+
option php_namespace = "Google\\Cloud\\SecurityCenter\\V2";
25+
option ruby_package = "Google::Cloud::SecurityCenter::V2";
26+
27+
// Represents an access event.
28+
message Access {
29+
// Associated email, such as "[email protected]".
30+
//
31+
// The email address of the authenticated user or a service account acting on
32+
// behalf of a third party principal making the request. For third party
33+
// identity callers, the `principal_subject` field is populated instead of
34+
// this field. For privacy reasons, the principal email address is sometimes
35+
// redacted. For more information, see [Caller identities in audit
36+
// logs](https://cloud.google.com/logging/docs/audit#user-id).
37+
string principal_email = 1;
38+
39+
// Caller's IP address, such as "1.1.1.1".
40+
string caller_ip = 2;
41+
42+
// The caller IP's geolocation, which identifies where the call came from.
43+
Geolocation caller_ip_geo = 3;
44+
45+
// Type of user agent associated with the finding. For example, an operating
46+
// system shell or an embedded or standalone application.
47+
string user_agent_family = 4;
48+
49+
// The caller's user agent string associated with the finding.
50+
string user_agent = 5;
51+
52+
// This is the API service that the service account made a call to, e.g.
53+
// "iam.googleapis.com"
54+
string service_name = 6;
55+
56+
// The method that the service account called, e.g. "SetIamPolicy".
57+
string method_name = 7;
58+
59+
// A string that represents the principal_subject that is associated with the
60+
// identity. Unlike `principal_email`, `principal_subject` supports principals
61+
// that aren't associated with email addresses, such as third party
62+
// principals. For most identities, the format is
63+
// `principal://iam.googleapis.com/{identity pool name}/subject/{subject}`.
64+
// Some GKE identities, such as GKE_WORKLOAD, FREEFORM, and GKE_HUB_WORKLOAD,
65+
// still use the legacy format `serviceAccount:{identity pool
66+
// name}[{subject}]`.
67+
string principal_subject = 8;
68+
69+
// The name of the service account key that was used to create or exchange
70+
// credentials when authenticating the service account that made the request.
71+
// This is a scheme-less URI full resource name. For example:
72+
//
73+
// "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}".
74+
//
75+
string service_account_key_name = 9;
76+
77+
// The identity delegation history of an authenticated service account that
78+
// made the request. The `serviceAccountDelegationInfo[]` object contains
79+
// information about the real authorities that try to access Google Cloud
80+
// resources by delegating on a service account. When multiple authorities are
81+
// present, they are guaranteed to be sorted based on the original ordering of
82+
// the identity delegation events.
83+
repeated ServiceAccountDelegationInfo service_account_delegation_info = 10;
84+
85+
// A string that represents a username. The username provided depends on the
86+
// type of the finding and is likely not an IAM principal. For example, this
87+
// can be a system username if the finding is related to a virtual machine, or
88+
// it can be an application login username.
89+
string user_name = 11;
90+
}
91+
92+
// Identity delegation history of an authenticated service account.
93+
message ServiceAccountDelegationInfo {
94+
// The email address of a Google account.
95+
string principal_email = 1;
96+
97+
// A string representing the principal_subject associated with the identity.
98+
// As compared to `principal_email`, supports principals that aren't
99+
// associated with email addresses, such as third party principals. For most
100+
// identities, the format will be `principal://iam.googleapis.com/{identity
101+
// pool name}/subjects/{subject}` except for some GKE identities
102+
// (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD) that are still in the legacy
103+
// format `serviceAccount:{identity pool name}[{subject}]`
104+
string principal_subject = 2;
105+
}
106+
107+
// Represents a geographical location for a given access.
108+
message Geolocation {
109+
// A CLDR.
110+
string region_code = 1;
111+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.securitycenter.v2;
18+
19+
option csharp_namespace = "Google.Cloud.SecurityCenter.V2";
20+
option go_package = "cloud.google.com/go/securitycenter/apiv2/securitycenterpb;securitycenterpb";
21+
option java_multiple_files = true;
22+
option java_outer_classname = "ApplicationProto";
23+
option java_package = "com.google.cloud.securitycenter.v2";
24+
option php_namespace = "Google\\Cloud\\SecurityCenter\\V2";
25+
option ruby_package = "Google::Cloud::SecurityCenter::V2";
26+
27+
// Represents an application associated with a finding.
28+
message Application {
29+
// The base URI that identifies the network location of the application in
30+
// which the vulnerability was detected. For example, `http://example.com`.
31+
string base_uri = 1;
32+
33+
// The full URI with payload that could be used to reproduce the
34+
// vulnerability. For example, `http://example.com?p=aMmYgI6H`.
35+
string full_uri = 2;
36+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.securitycenter.v2;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/protobuf/timestamp.proto";
21+
22+
option csharp_namespace = "Google.Cloud.SecurityCenter.V2";
23+
option go_package = "cloud.google.com/go/securitycenter/apiv2/securitycenterpb;securitycenterpb";
24+
option java_multiple_files = true;
25+
option java_outer_classname = "AttackExposureProto";
26+
option java_package = "com.google.cloud.securitycenter.v2";
27+
option php_namespace = "Google\\Cloud\\SecurityCenter\\V2";
28+
option ruby_package = "Google::Cloud::SecurityCenter::V2";
29+
30+
// An attack exposure contains the results of an attack path simulation run.
31+
message AttackExposure {
32+
// This enum defines the various states an AttackExposure can be in.
33+
enum State {
34+
// The state is not specified.
35+
STATE_UNSPECIFIED = 0;
36+
37+
// The attack exposure has been calculated.
38+
CALCULATED = 1;
39+
40+
// The attack exposure has not been calculated.
41+
NOT_CALCULATED = 2;
42+
}
43+
44+
// A number between 0 (inclusive) and infinity that represents how important
45+
// this finding is to remediate. The higher the score, the more important it
46+
// is to remediate.
47+
double score = 1;
48+
49+
// The most recent time the attack exposure was updated on this finding.
50+
google.protobuf.Timestamp latest_calculation_time = 2;
51+
52+
// The resource name of the attack path simulation result that contains the
53+
// details regarding this attack exposure score.
54+
// Example: organizations/123/simulations/456/attackExposureResults/789
55+
string attack_exposure_result = 3;
56+
57+
// Output only. What state this AttackExposure is in. This captures whether or
58+
// not an attack exposure has been calculated or not.
59+
State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
60+
61+
// The number of high value resources that are exposed as a result of this
62+
// finding.
63+
int32 exposed_high_value_resources_count = 5;
64+
65+
// The number of medium value resources that are exposed as a result of this
66+
// finding.
67+
int32 exposed_medium_value_resources_count = 6;
68+
69+
// The number of high value resources that are exposed as a result of this
70+
// finding.
71+
int32 exposed_low_value_resources_count = 7;
72+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.securitycenter.v2;
18+
19+
import "google/api/resource.proto";
20+
21+
option csharp_namespace = "Google.Cloud.SecurityCenter.V2";
22+
option go_package = "cloud.google.com/go/securitycenter/apiv2/securitycenterpb;securitycenterpb";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "AttackPathProto";
25+
option java_package = "com.google.cloud.securitycenter.v2";
26+
option php_namespace = "Google\\Cloud\\SecurityCenter\\V2";
27+
option ruby_package = "Google::Cloud::SecurityCenter::V2";
28+
29+
// A path that an attacker could take to reach an exposed resource.
30+
message AttackPath {
31+
option (google.api.resource) = {
32+
type: "securitycenter.googleapis.com/AttackPath"
33+
pattern: "organizations/{organization}/simulations/{simulation}/valuedResources/{valued_resource}/attackPaths/{attack_path}"
34+
plural: "attackPaths"
35+
singular: "attackPath"
36+
};
37+
38+
// Represents one point that an attacker passes through in this attack path.
39+
message AttackPathNode {
40+
// A finding that is associated with this node in the attack path.
41+
message PathNodeAssociatedFinding {
42+
// Canonical name of the associated findings. Example:
43+
// organizations/123/sources/456/findings/789
44+
string canonical_finding = 1;
45+
46+
// The additional taxonomy group within findings from a given source.
47+
string finding_category = 2;
48+
49+
// Full resource name of the finding.
50+
string name = 3;
51+
}
52+
53+
// The type of the incoming attack step node.
54+
enum NodeType {
55+
// Type not specified
56+
NODE_TYPE_UNSPECIFIED = 0;
57+
58+
// Incoming edge joined with AND
59+
NODE_TYPE_AND = 1;
60+
61+
// Incoming edge joined with OR
62+
NODE_TYPE_OR = 2;
63+
64+
// Incoming edge is defense
65+
NODE_TYPE_DEFENSE = 3;
66+
67+
// Incoming edge is attacker
68+
NODE_TYPE_ATTACKER = 4;
69+
}
70+
71+
// Detailed steps the attack can take between path nodes.
72+
message AttackStepNode {
73+
// Unique ID for one Node
74+
string uuid = 1;
75+
76+
// Attack step type. Can be either AND, OR or DEFENSE
77+
NodeType type = 2;
78+
79+
// User friendly name of the attack step
80+
string display_name = 3;
81+
82+
// Attack step labels for metadata
83+
map<string, string> labels = 4;
84+
85+
// Attack step description
86+
string description = 5;
87+
}
88+
89+
// The name of the resource at this point in the attack path.
90+
// The format of the name follows the Cloud Asset Inventory [resource
91+
// name
92+
// format]("https://cloud.google.com/asset-inventory/docs/resource-name-format")
93+
string resource = 1;
94+
95+
// The [supported resource
96+
// type](https://cloud.google.com/asset-inventory/docs/supported-asset-types")
97+
string resource_type = 2;
98+
99+
// Human-readable name of this resource.
100+
string display_name = 3;
101+
102+
// The findings associated with this node in the attack path.
103+
repeated PathNodeAssociatedFinding associated_findings = 4;
104+
105+
// Unique id of the attack path node.
106+
string uuid = 5;
107+
108+
// A list of attack step nodes that exist in this attack path node.
109+
repeated AttackStepNode attack_steps = 6;
110+
}
111+
112+
// Represents a connection between a source node and a destination node in
113+
// this attack path.
114+
message AttackPathEdge {
115+
// The attack node uuid of the source node.
116+
string source = 1;
117+
118+
// The attack node uuid of the destination node.
119+
string destination = 2;
120+
}
121+
122+
// The attack path name, for example,
123+
// `organizations/12/simulations/34/valuedResources/56/attackPaths/78`
124+
string name = 1;
125+
126+
// A list of nodes that exist in this attack path.
127+
repeated AttackPathNode path_nodes = 2;
128+
129+
// A list of the edges between nodes in this attack path.
130+
repeated AttackPathEdge edges = 3;
131+
}

0 commit comments

Comments
 (0)