-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
security_center_management.py
1792 lines (1576 loc) · 64.2 KB
/
security_center_management.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
# Copyright 2023 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.
#
from __future__ import annotations
from typing import MutableMapping, MutableSequence
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import struct_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
from google.type import expr_pb2 # type: ignore
import proto # type: ignore
__protobuf__ = proto.module(
package="google.cloud.securitycentermanagement.v1",
manifest={
"EffectiveSecurityHealthAnalyticsCustomModule",
"ListEffectiveSecurityHealthAnalyticsCustomModulesRequest",
"ListEffectiveSecurityHealthAnalyticsCustomModulesResponse",
"GetEffectiveSecurityHealthAnalyticsCustomModuleRequest",
"SecurityHealthAnalyticsCustomModule",
"CustomConfig",
"ListSecurityHealthAnalyticsCustomModulesRequest",
"ListSecurityHealthAnalyticsCustomModulesResponse",
"ListDescendantSecurityHealthAnalyticsCustomModulesRequest",
"ListDescendantSecurityHealthAnalyticsCustomModulesResponse",
"GetSecurityHealthAnalyticsCustomModuleRequest",
"CreateSecurityHealthAnalyticsCustomModuleRequest",
"UpdateSecurityHealthAnalyticsCustomModuleRequest",
"DeleteSecurityHealthAnalyticsCustomModuleRequest",
"SimulateSecurityHealthAnalyticsCustomModuleRequest",
"SimulatedFinding",
"SimulateSecurityHealthAnalyticsCustomModuleResponse",
"EffectiveEventThreatDetectionCustomModule",
"ListEffectiveEventThreatDetectionCustomModulesRequest",
"ListEffectiveEventThreatDetectionCustomModulesResponse",
"GetEffectiveEventThreatDetectionCustomModuleRequest",
"EventThreatDetectionCustomModule",
"ListEventThreatDetectionCustomModulesRequest",
"ListEventThreatDetectionCustomModulesResponse",
"ListDescendantEventThreatDetectionCustomModulesRequest",
"ListDescendantEventThreatDetectionCustomModulesResponse",
"GetEventThreatDetectionCustomModuleRequest",
"CreateEventThreatDetectionCustomModuleRequest",
"UpdateEventThreatDetectionCustomModuleRequest",
"DeleteEventThreatDetectionCustomModuleRequest",
"ValidateEventThreatDetectionCustomModuleRequest",
"ValidateEventThreatDetectionCustomModuleResponse",
},
)
class EffectiveSecurityHealthAnalyticsCustomModule(proto.Message):
r"""An EffectiveSecurityHealthAnalyticsCustomModule is the
representation of a Security Health Analytics custom module at a
specified level of the resource hierarchy: organization, folder, or
project. If a custom module is inherited from a parent organization
or folder, the value of the ``enablementState`` property in
EffectiveSecurityHealthAnalyticsCustomModule is set to the value
that is effective in the parent, instead of ``INHERITED``. For
example, if the module is enabled in a parent organization or
folder, the effective enablement_state for the module in all child
folders or projects is also ``enabled``.
EffectiveSecurityHealthAnalyticsCustomModule is read-only.
Attributes:
name (str):
Output only. The resource name of the custom module. Its
format is
"organizations/{organization}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{effective_security_health_analytics_custom_module}",
or
"folders/{folder}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{effective_security_health_analytics_custom_module}",
or
"projects/{project}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{effective_security_health_analytics_custom_module}".
custom_config (google.cloud.securitycentermanagement_v1.types.CustomConfig):
Output only. The user-specified configuration
for the module.
enablement_state (google.cloud.securitycentermanagement_v1.types.EffectiveSecurityHealthAnalyticsCustomModule.EnablementState):
Output only. The effective state of
enablement for the module at the given level of
the hierarchy.
display_name (str):
Output only. The display name for the custom
module. The name must be between 1 and 128
characters, start with a lowercase letter, and
contain alphanumeric characters or underscores
only.
"""
class EnablementState(proto.Enum):
r"""The enablement state of the module.
Values:
ENABLEMENT_STATE_UNSPECIFIED (0):
Unspecified enablement state.
ENABLED (1):
The module is enabled at the given level.
DISABLED (2):
The module is disabled at the given level.
"""
ENABLEMENT_STATE_UNSPECIFIED = 0
ENABLED = 1
DISABLED = 2
name: str = proto.Field(
proto.STRING,
number=1,
)
custom_config: "CustomConfig" = proto.Field(
proto.MESSAGE,
number=2,
message="CustomConfig",
)
enablement_state: EnablementState = proto.Field(
proto.ENUM,
number=3,
enum=EnablementState,
)
display_name: str = proto.Field(
proto.STRING,
number=4,
)
class ListEffectiveSecurityHealthAnalyticsCustomModulesRequest(proto.Message):
r"""Request message for listing effective Security Health
Analytics custom modules.
Attributes:
parent (str):
Required. Name of parent to list effective
custom modules. Its format is
"organizations/{organization}/locations/{location}",
"folders/{folder}/locations/{location}",
or
"projects/{project}/locations/{location}".
page_size (int):
Optional. The maximum number of results to
return in a single response. Default is 10,
minimum is 1, maximum is 1000.
page_token (str):
Optional. The value returned by the last call
indicating a continuation.
"""
parent: str = proto.Field(
proto.STRING,
number=1,
)
page_size: int = proto.Field(
proto.INT32,
number=2,
)
page_token: str = proto.Field(
proto.STRING,
number=3,
)
class ListEffectiveSecurityHealthAnalyticsCustomModulesResponse(proto.Message):
r"""Response message for listing effective Security Health
Analytics custom modules.
Attributes:
effective_security_health_analytics_custom_modules (MutableSequence[google.cloud.securitycentermanagement_v1.types.EffectiveSecurityHealthAnalyticsCustomModule]):
The list of
EffectiveSecurityHealthAnalyticsCustomModule
next_page_token (str):
A token identifying a page of results the
server should return.
"""
@property
def raw_page(self):
return self
effective_security_health_analytics_custom_modules: MutableSequence[
"EffectiveSecurityHealthAnalyticsCustomModule"
] = proto.RepeatedField(
proto.MESSAGE,
number=1,
message="EffectiveSecurityHealthAnalyticsCustomModule",
)
next_page_token: str = proto.Field(
proto.STRING,
number=2,
)
class GetEffectiveSecurityHealthAnalyticsCustomModuleRequest(proto.Message):
r"""Message for getting a
EffectiveSecurityHealthAnalyticsCustomModule
Attributes:
name (str):
Required. The resource name of the SHA custom module.
Its format is:
- "organizations/{organization}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{module_id}".
- "folders/{folder}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{module_id}".
- "projects/{project}/locations/{location}/effectiveSecurityHealthAnalyticsCustomModules/{module_id}".
"""
name: str = proto.Field(
proto.STRING,
number=1,
)
class SecurityHealthAnalyticsCustomModule(proto.Message):
r"""Represents an instance of a Security Health Analytics custom
module, including its full module name, display name, enablement
state, and last updated time. You can create a custom module at
the organization, folder, or project level. Custom modules that
you create at the organization or folder level are inherited by
the child folders and projects.
Attributes:
name (str):
Immutable. The resource name of the custom module. Its
format is
"organizations/{organization}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}",
or
"folders/{folder}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}",
or
"projects/{project}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}"
The id {customModule} is server-generated and is not user
settable. It will be a numeric id containing 1-20 digits.
display_name (str):
Optional. The display name of the Security
Health Analytics custom module. This display
name becomes the finding category for all
findings that are returned by this custom
module. The display name must be between 1 and
128 characters, start with a lowercase letter,
and contain alphanumeric characters or
underscores only.
enablement_state (google.cloud.securitycentermanagement_v1.types.SecurityHealthAnalyticsCustomModule.EnablementState):
Optional. The enablement state of the custom
module.
update_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The time at which the custom
module was last updated.
last_editor (str):
Output only. The editor that last updated the
custom module.
ancestor_module (str):
Output only. Specifies the organization or
folder from which the custom module is
inherited. If empty, indicates that the custom
module was created in the organization, folder,
or project in which you are viewing the custom
module.
custom_config (google.cloud.securitycentermanagement_v1.types.CustomConfig):
Optional. The user specified custom
configuration for the module.
"""
class EnablementState(proto.Enum):
r"""Possible enablement states of a custom module.
Values:
ENABLEMENT_STATE_UNSPECIFIED (0):
Unspecified enablement state.
ENABLED (1):
The module is enabled at the given CRM
resource.
DISABLED (2):
The module is disabled at the given CRM
resource.
INHERITED (3):
State is inherited from an ancestor module. The module will
either be effectively ENABLED or DISABLED based on its
closest non-inherited ancestor module in the CRM hierarchy.
Attempting to set a top level module (module with no parent)
to the INHERITED state will result in an INVALID_ARGUMENT
error.
"""
ENABLEMENT_STATE_UNSPECIFIED = 0
ENABLED = 1
DISABLED = 2
INHERITED = 3
name: str = proto.Field(
proto.STRING,
number=1,
)
display_name: str = proto.Field(
proto.STRING,
number=2,
)
enablement_state: EnablementState = proto.Field(
proto.ENUM,
number=3,
enum=EnablementState,
)
update_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=4,
message=timestamp_pb2.Timestamp,
)
last_editor: str = proto.Field(
proto.STRING,
number=5,
)
ancestor_module: str = proto.Field(
proto.STRING,
number=6,
)
custom_config: "CustomConfig" = proto.Field(
proto.MESSAGE,
number=7,
message="CustomConfig",
)
class CustomConfig(proto.Message):
r"""Defines the properties in a custom module configuration for
Security Health Analytics. Use the custom module configuration
to create custom detectors that generate custom findings for
resources that you specify.
Attributes:
predicate (google.type.expr_pb2.Expr):
Optional. The CEL expression to evaluate to
produce findings. When the expression evaluates
to true against a resource, a finding is
generated.
custom_output (google.cloud.securitycentermanagement_v1.types.CustomConfig.CustomOutputSpec):
Optional. Custom output properties.
resource_selector (google.cloud.securitycentermanagement_v1.types.CustomConfig.ResourceSelector):
Optional. The Cloud Asset Inventory resource types that the
custom module operates on. For information about resource
types, see `Supported asset
types <https://cloud.google.com/asset-inventory/docs/supported-asset-types>`__.
Each custom module can specify up to 5 resource types.
severity (google.cloud.securitycentermanagement_v1.types.CustomConfig.Severity):
Optional. The severity to assign to findings
generated by the module.
description (str):
Optional. Text that describes the
vulnerability or misconfiguration that the
custom module detects. This explanation is
returned with each finding instance to help
investigators understand the detected issue. The
text must be enclosed in quotation marks.
recommendation (str):
Optional. An explanation of the recommended steps that
security teams can take to resolve the detected issue. This
explanation is returned with each finding generated by this
module in the ``nextSteps`` property of the finding JSON.
"""
class Severity(proto.Enum):
r"""Defines the valid value options for the severity of a
finding.
Values:
SEVERITY_UNSPECIFIED (0):
Unspecified severity.
CRITICAL (1):
Critical severity.
HIGH (2):
High severity.
MEDIUM (3):
Medium severity.
LOW (4):
Low severity.
"""
SEVERITY_UNSPECIFIED = 0
CRITICAL = 1
HIGH = 2
MEDIUM = 3
LOW = 4
class CustomOutputSpec(proto.Message):
r"""A set of optional name-value pairs that define custom source
properties to return with each finding that is generated by the
custom module. The custom source properties that are defined here
are included in the finding JSON under ``sourceProperties``.
Attributes:
properties (MutableSequence[google.cloud.securitycentermanagement_v1.types.CustomConfig.CustomOutputSpec.Property]):
Optional. A list of custom output properties
to add to the finding.
"""
class Property(proto.Message):
r"""An individual name-value pair that defines a custom source
property.
Attributes:
name (str):
Optional. Name of the property for the custom
output.
value_expression (google.type.expr_pb2.Expr):
Optional. The CEL expression for the custom
output. A resource property can be specified to
return the value of the property or a text
string enclosed in quotation marks.
"""
name: str = proto.Field(
proto.STRING,
number=1,
)
value_expression: expr_pb2.Expr = proto.Field(
proto.MESSAGE,
number=2,
message=expr_pb2.Expr,
)
properties: MutableSequence[
"CustomConfig.CustomOutputSpec.Property"
] = proto.RepeatedField(
proto.MESSAGE,
number=1,
message="CustomConfig.CustomOutputSpec.Property",
)
class ResourceSelector(proto.Message):
r"""Resource for selecting resource type.
Attributes:
resource_types (MutableSequence[str]):
Optional. The resource types to run the
detector on.
"""
resource_types: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=1,
)
predicate: expr_pb2.Expr = proto.Field(
proto.MESSAGE,
number=1,
message=expr_pb2.Expr,
)
custom_output: CustomOutputSpec = proto.Field(
proto.MESSAGE,
number=2,
message=CustomOutputSpec,
)
resource_selector: ResourceSelector = proto.Field(
proto.MESSAGE,
number=3,
message=ResourceSelector,
)
severity: Severity = proto.Field(
proto.ENUM,
number=4,
enum=Severity,
)
description: str = proto.Field(
proto.STRING,
number=5,
)
recommendation: str = proto.Field(
proto.STRING,
number=6,
)
class ListSecurityHealthAnalyticsCustomModulesRequest(proto.Message):
r"""Request message for listing Security Health Analytics custom
modules.
Attributes:
parent (str):
Required. Name of parent to list custom
modules. Its format is
"organizations/{organization}/locations/{location}",
"folders/{folder}/locations/{location}",
or
"projects/{project}/locations/{location}".
page_size (int):
Optional. The maximum number of results to
return in a single response. Default is 10,
minimum is 1, maximum is 1000.
page_token (str):
Optional. A token identifying a page of
results the server should return.
"""
parent: str = proto.Field(
proto.STRING,
number=1,
)
page_size: int = proto.Field(
proto.INT32,
number=2,
)
page_token: str = proto.Field(
proto.STRING,
number=3,
)
class ListSecurityHealthAnalyticsCustomModulesResponse(proto.Message):
r"""Response message for listing Security Health Analytics custom
modules.
Attributes:
security_health_analytics_custom_modules (MutableSequence[google.cloud.securitycentermanagement_v1.types.SecurityHealthAnalyticsCustomModule]):
The list of
SecurityHealthAnalyticsCustomModules
next_page_token (str):
A token identifying a page of results the
server should return.
"""
@property
def raw_page(self):
return self
security_health_analytics_custom_modules: MutableSequence[
"SecurityHealthAnalyticsCustomModule"
] = proto.RepeatedField(
proto.MESSAGE,
number=1,
message="SecurityHealthAnalyticsCustomModule",
)
next_page_token: str = proto.Field(
proto.STRING,
number=2,
)
class ListDescendantSecurityHealthAnalyticsCustomModulesRequest(proto.Message):
r"""Request message for listing descendant Security Health
Analytics custom modules.
Attributes:
parent (str):
Required. Name of parent to list custom
modules. Its format is
"organizations/{organization}/locations/{location}",
"folders/{folder}/locations/{location}",
or
"projects/{project}/locations/{location}".
page_size (int):
Optional. The maximum number of results to
return in a single response. Default is 10,
minimum is 1, maximum is 1000.
page_token (str):
Optional. A token identifying a page of
results the server should return.
"""
parent: str = proto.Field(
proto.STRING,
number=1,
)
page_size: int = proto.Field(
proto.INT32,
number=2,
)
page_token: str = proto.Field(
proto.STRING,
number=3,
)
class ListDescendantSecurityHealthAnalyticsCustomModulesResponse(proto.Message):
r"""Response message for listing descendant Security Health
Analytics custom modules.
Attributes:
security_health_analytics_custom_modules (MutableSequence[google.cloud.securitycentermanagement_v1.types.SecurityHealthAnalyticsCustomModule]):
The list of
SecurityHealthAnalyticsCustomModules
next_page_token (str):
A token identifying a page of results the
server should return.
"""
@property
def raw_page(self):
return self
security_health_analytics_custom_modules: MutableSequence[
"SecurityHealthAnalyticsCustomModule"
] = proto.RepeatedField(
proto.MESSAGE,
number=1,
message="SecurityHealthAnalyticsCustomModule",
)
next_page_token: str = proto.Field(
proto.STRING,
number=2,
)
class GetSecurityHealthAnalyticsCustomModuleRequest(proto.Message):
r"""Message for getting a SecurityHealthAnalyticsCustomModule
Attributes:
name (str):
Required. Name of the resource
"""
name: str = proto.Field(
proto.STRING,
number=1,
)
class CreateSecurityHealthAnalyticsCustomModuleRequest(proto.Message):
r"""Message for creating a SecurityHealthAnalyticsCustomModule
Attributes:
parent (str):
Required. Name of the parent for the module.
Its format is
"organizations/{organization}/locations/{location}",
"folders/{folder}/locations/{location}",
or
"projects/{project}/locations/{location}".
security_health_analytics_custom_module (google.cloud.securitycentermanagement_v1.types.SecurityHealthAnalyticsCustomModule):
Required. The resource being created
validate_only (bool):
Optional. When set to true, only validations
(including IAM checks) will done for the request
(no module will be created). An OK response
indicates the request is valid while an error
response indicates the request is invalid. Note
that a subsequent request to actually create the
module could still fail because:
1. the state could have changed (e.g. IAM
permission lost) or
2. A failure occurred during creation of the
module. Defaults to false.
"""
parent: str = proto.Field(
proto.STRING,
number=1,
)
security_health_analytics_custom_module: "SecurityHealthAnalyticsCustomModule" = (
proto.Field(
proto.MESSAGE,
number=2,
message="SecurityHealthAnalyticsCustomModule",
)
)
validate_only: bool = proto.Field(
proto.BOOL,
number=3,
)
class UpdateSecurityHealthAnalyticsCustomModuleRequest(proto.Message):
r"""Message for updating a SecurityHealthAnalyticsCustomModule
Attributes:
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Required. The list of fields to be updated. The only fields
that can be updated are ``enablement_state`` and
``custom_config``. If empty or set to the wildcard value
``*``, both ``enablement_state`` and ``custom_config`` are
updated.
security_health_analytics_custom_module (google.cloud.securitycentermanagement_v1.types.SecurityHealthAnalyticsCustomModule):
Required. The resource being updated
validate_only (bool):
Optional. When set to true, only validations
(including IAM checks) will done for the request
(module will not be updated). An OK response
indicates the request is valid while an error
response indicates the request is invalid. Note
that a subsequent request to actually update the
module could still fail because:
1. the state could have changed (e.g. IAM permission lost) or
2. A failure occurred while trying to update the module.
"""
update_mask: field_mask_pb2.FieldMask = proto.Field(
proto.MESSAGE,
number=1,
message=field_mask_pb2.FieldMask,
)
security_health_analytics_custom_module: "SecurityHealthAnalyticsCustomModule" = (
proto.Field(
proto.MESSAGE,
number=2,
message="SecurityHealthAnalyticsCustomModule",
)
)
validate_only: bool = proto.Field(
proto.BOOL,
number=3,
)
class DeleteSecurityHealthAnalyticsCustomModuleRequest(proto.Message):
r"""Message for deleting a SecurityHealthAnalyticsCustomModule
Attributes:
name (str):
Required. The resource name of the SHA custom module.
Its format is:
- "organizations/{organization}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}".
- "folders/{folder}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}".
- "projects/{project}/locations/{location}/securityHealthAnalyticsCustomModules/{security_health_analytics_custom_module}".
validate_only (bool):
Optional. When set to true, only validations
(including IAM checks) will done for the request
(module will not be deleted). An OK response
indicates the request is valid while an error
response indicates the request is invalid. Note
that a subsequent request to actually delete the
module could still fail because:
1. the state could have changed (e.g. IAM permission lost) or
2. A failure occurred while trying to delete the module.
"""
name: str = proto.Field(
proto.STRING,
number=1,
)
validate_only: bool = proto.Field(
proto.BOOL,
number=2,
)
class SimulateSecurityHealthAnalyticsCustomModuleRequest(proto.Message):
r"""Request message to simulate a CustomConfig against a given
test resource. Maximum size of the request is 4 MB by default.
Attributes:
parent (str):
Required. The relative resource name of the organization,
project, or folder. For more information about relative
resource names, see `Relative Resource
Name <https://cloud.google.com/apis/design/resource_names#relative_resource_name>`__
Example: ``organizations/{organization_id}``.
custom_config (google.cloud.securitycentermanagement_v1.types.CustomConfig):
Required. The custom configuration that you
need to test.
resource (google.cloud.securitycentermanagement_v1.types.SimulateSecurityHealthAnalyticsCustomModuleRequest.SimulatedResource):
Required. Resource data to simulate custom
module against.
"""
class SimulatedResource(proto.Message):
r"""Manually constructed resource name. If the custom module evaluates
against only the resource data, you can omit the ``iam_policy_data``
field. If it evaluates only the ``iam_policy_data`` field, you can
omit the resource data.
Attributes:
resource_type (str):
Required. The type of the resource, for example,
``compute.googleapis.com/Disk``.
resource_data (google.protobuf.struct_pb2.Struct):
Optional. A representation of the Google
Cloud resource. Should match the Google Cloud
resource JSON format.
iam_policy_data (google.iam.v1.policy_pb2.Policy):
Optional. A representation of the IAM policy.
"""
resource_type: str = proto.Field(
proto.STRING,
number=1,
)
resource_data: struct_pb2.Struct = proto.Field(
proto.MESSAGE,
number=2,
message=struct_pb2.Struct,
)
iam_policy_data: policy_pb2.Policy = proto.Field(
proto.MESSAGE,
number=3,
message=policy_pb2.Policy,
)
parent: str = proto.Field(
proto.STRING,
number=1,
)
custom_config: "CustomConfig" = proto.Field(
proto.MESSAGE,
number=2,
message="CustomConfig",
)
resource: SimulatedResource = proto.Field(
proto.MESSAGE,
number=3,
message=SimulatedResource,
)
class SimulatedFinding(proto.Message):
r"""A subset of the fields of the Security Center Finding proto.
The minimum set of fields needed to represent a simulated
finding from a SHA custom module.
Attributes:
name (str):
Identifier. The `relative resource
name <https://cloud.google.com/apis/design/resource_names#relative_resource_name>`__
of the finding. Example:
"organizations/{organization_id}/sources/{source_id}/findings/{finding_id}",
"folders/{folder_id}/sources/{source_id}/findings/{finding_id}",
"projects/{project_id}/sources/{source_id}/findings/{finding_id}".
parent (str):
The relative resource name of the source the finding belongs
to. See:
https://cloud.google.com/apis/design/resource_names#relative_resource_name
This field is immutable after creation time. For example:
"organizations/{organization_id}/sources/{source_id}".
resource_name (str):
For findings on Google Cloud resources, the full resource
name of the Google Cloud resource this finding is for. See:
https://cloud.google.com/apis/design/resource_names#full_resource_name
When the finding is for a non-Google Cloud resource, the
resourceName can be a customer or partner defined string.
This field is immutable after creation time.
category (str):
The additional taxonomy group within findings from a given
source. This field is immutable after creation time.
Example: "XSS_FLASH_INJECTION".
state (google.cloud.securitycentermanagement_v1.types.SimulatedFinding.State):
Output only. The state of the finding.
source_properties (MutableMapping[str, google.protobuf.struct_pb2.Value]):
Source specific properties. These properties are managed by
the source that writes the finding. The key names in the
source_properties map must be between 1 and 255 characters,
and must start with a letter and contain alphanumeric
characters or underscores only.
event_time (google.protobuf.timestamp_pb2.Timestamp):
The time the finding was first detected. If
an existing finding is updated, then this is the
time the update occurred. For example, if the
finding represents an open firewall, this
property captures the time the detector believes
the firewall became open. The accuracy is
determined by the detector. If the finding is
later resolved, then this time reflects when the
finding was resolved. This must not be set to a
value greater than the current timestamp.
severity (google.cloud.securitycentermanagement_v1.types.SimulatedFinding.Severity):
The severity of the finding. This field is
managed by the source that writes the finding.
finding_class (google.cloud.securitycentermanagement_v1.types.SimulatedFinding.FindingClass):
The class of the finding.
"""
class State(proto.Enum):
r"""The state of the finding.
Values:
STATE_UNSPECIFIED (0):
Unspecified state.
ACTIVE (1):
The finding requires attention and has not
been addressed yet.
INACTIVE (2):
The finding has been fixed, triaged as a
non-issue or otherwise addressed and is no
longer active.
"""
STATE_UNSPECIFIED = 0
ACTIVE = 1
INACTIVE = 2
class Severity(proto.Enum):
r"""The severity of the finding.
Values:
SEVERITY_UNSPECIFIED (0):
This value is used for findings when a source
doesn't write a severity value.
CRITICAL (1):
Vulnerability:
A critical vulnerability is easily discoverable
by an external actor, exploitable, and results
in the direct ability to execute arbitrary code,
exfiltrate data, and otherwise gain additional
access and privileges to cloud resources and
workloads. Examples include publicly accessible
unprotected user data and public SSH access with
weak or no passwords.
Threat:
Indicates a threat that is able to access,
modify, or delete data or execute unauthorized
code within existing resources.
HIGH (2):
Vulnerability:
A high risk vulnerability can be easily
discovered and exploited in combination with
other vulnerabilities in order to gain direct
access and the ability to execute arbitrary
code, exfiltrate data, and otherwise gain
additional access and privileges to cloud
resources and workloads. An example is a
database with weak or no passwords that is only
accessible internally. This database could
easily be compromised by an actor that had
access to the internal network.
Threat:
Indicates a threat that is able to create new
computational resources in an environment but
not able to access data or execute code in
existing resources.
MEDIUM (3):
Vulnerability:
A medium risk vulnerability could be used by an
actor to gain access to resources or privileges
that enable them to eventually (through multiple
steps or a complex exploit) gain access and the
ability to execute arbitrary code or exfiltrate
data. An example is a service account with
access to more projects than it should have. If
an actor gains access to the service account,
they could potentially use that access to
manipulate a project the service account was not
intended to.
Threat:
Indicates a threat that is able to cause
operational impact but may not access data or
execute unauthorized code.
LOW (4):
Vulnerability:
A low risk vulnerability hampers a security
organization's ability to detect vulnerabilities
or active threats in their deployment, or
prevents the root cause investigation of
security issues. An example is monitoring and
logs being disabled for resource configurations
and access.
Threat:
Indicates a threat that has obtained minimal
access to an environment but is not able to
access data, execute code, or create resources.
"""
SEVERITY_UNSPECIFIED = 0
CRITICAL = 1
HIGH = 2
MEDIUM = 3
LOW = 4
class FindingClass(proto.Enum):
r"""Represents what kind of Finding it is.
Values:
FINDING_CLASS_UNSPECIFIED (0):
Unspecified finding class.
THREAT (1):
Describes unwanted or malicious activity.
VULNERABILITY (2):
Describes a potential weakness in software
that increases risk to Confidentiality &
Integrity & Availability.
MISCONFIGURATION (3):
Describes a potential weakness in cloud
resource/asset configuration that increases
risk.
OBSERVATION (4):
Describes a security observation that is for
informational purposes.
SCC_ERROR (5):
Describes an error that prevents some SCC
functionality.
POSTURE_VIOLATION (6):
Describes a potential security risk due to a