Skip to content

Commit d5fb176

Browse files
yoshi-automationbusunkim96
authored andcommitted
fix(websecurityscanner): add FORBIDDEN_UPDATE_TO_MANAGED_SCAN error code, make DeleteScanConfig non-idempotent (via synth) (#9442)
Add proto annotations to web security scanner. * Add `FORBIDDEN_UPDATE_TO_MANAGED_SCAN` error code * Mark `DeleteScanConfig` as non-idempotent * Remove notes about output only fields in docstrings
1 parent ad0cec6 commit d5fb176

26 files changed

+527
-451
lines changed

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/proto/web_security_scanner.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ message GetScanRunRequest {
255255
string name = 1 [
256256
(google.api.field_behavior) = REQUIRED,
257257
(google.api.resource_reference) = {
258-
type: "websecurityscanner.googleapis.com/ScanConfig"
258+
type: "websecurityscanner.googleapis.com/ScanRun"
259259
}
260260
];
261261
}

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/proto/web_security_scanner_pb2.py

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/gapic/enums.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Code(enum.IntEnum):
8888
"""
8989
Output only.
9090
Defines an error reason code.
91-
Next id: 43
91+
Next id: 44
9292
9393
Attributes:
9494
CODE_UNSPECIFIED (int): There is no error.
@@ -121,6 +121,7 @@ class Code(enum.IntEnum):
121121
FINDING_TYPE_UNSPECIFIED (int): Finding type value is not specified in the list findings request.
122122
FORBIDDEN_TO_SCAN_COMPUTE (int): Scan targets Compute Engine, yet current project was not whitelisted for
123123
Google Compute Engine Scanning Alpha access.
124+
FORBIDDEN_UPDATE_TO_MANAGED_SCAN (int): User tries to update managed scan
124125
MALFORMED_FILTER (int): The supplied filter is malformed. For example, it can not be parsed, does
125126
not have a filter type in expression, or the same filter type appears
126127
more than once.
@@ -171,6 +172,7 @@ class Code(enum.IntEnum):
171172
FAILED_TO_AUTHENTICATE_TO_TARGET = 19
172173
FINDING_TYPE_UNSPECIFIED = 20
173174
FORBIDDEN_TO_SCAN_COMPUTE = 21
175+
FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43
174176
MALFORMED_FILTER = 22
175177
MALFORMED_RESOURCE_NAME = 23
176178
PROJECT_INACTIVE = 24
@@ -248,7 +250,7 @@ class Code(enum.IntEnum):
248250
authentication or some other page outside of the scan scope.
249251
TOO_MANY_HTTP_ERRORS (int): Indicates that a scan encountered numerous errors from the web site
250252
pages. When available, most\_common\_http\_error\_code field indicates
251-
the the most common HTTP error code encountered during the scan.
253+
the most common HTTP error code encountered during the scan.
252254
"""
253255

254256
CODE_UNSPECIFIED = 0
@@ -265,7 +267,7 @@ class Code(enum.IntEnum):
265267
"""
266268
Output only.
267269
Defines a warning message code.
268-
Next id: 5
270+
Next id: 6
269271
270272
Attributes:
271273
CODE_UNSPECIFIED (int): Default value is never used.

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/gapic/web_security_scanner_client.py

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,9 @@ def create_scan_config(
260260
>>> response = client.create_scan_config(parent, scan_config)
261261
262262
Args:
263-
parent (str): Required.
264-
The parent resource name where the scan is created, which should be a
263+
parent (str): Required. The parent resource name where the scan is created, which should be a
265264
project resource name in the format 'projects/{projectId}'.
266-
scan_config (Union[dict, ~google.cloud.websecurityscanner_v1beta.types.ScanConfig]): Required.
267-
The ScanConfig to be created.
265+
scan_config (Union[dict, ~google.cloud.websecurityscanner_v1beta.types.ScanConfig]): Required. The ScanConfig to be created.
268266
269267
If a dict is provided, it must be of the same form as the protobuf
270268
message :class:`~google.cloud.websecurityscanner_v1beta.types.ScanConfig`
@@ -338,8 +336,7 @@ def delete_scan_config(
338336
>>> client.delete_scan_config(name)
339337
340338
Args:
341-
name (str): Required.
342-
The resource name of the ScanConfig to be deleted. The name follows the
339+
name (str): Required. The resource name of the ScanConfig to be deleted. The name follows the
343340
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
344341
retry (Optional[google.api_core.retry.Retry]): A retry object used
345342
to retry requests. If ``None`` is specified, requests will
@@ -406,8 +403,7 @@ def get_scan_config(
406403
>>> response = client.get_scan_config(name)
407404
408405
Args:
409-
name (str): Required.
410-
The resource name of the ScanConfig to be returned. The name follows the
406+
name (str): Required. The resource name of the ScanConfig to be returned. The name follows the
411407
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
412408
retry (Optional[google.api_core.retry.Retry]): A retry object used
413409
to retry requests. If ``None`` is specified, requests will
@@ -490,8 +486,7 @@ def list_scan_configs(
490486
... pass
491487
492488
Args:
493-
parent (str): Required.
494-
The parent resource name, which should be a project resource name in the
489+
parent (str): Required. The parent resource name, which should be a project resource name in the
495490
format 'projects/{projectId}'.
496491
page_size (int): The maximum number of resources contained in the
497492
underlying API response. If page streaming is performed per-
@@ -587,8 +582,7 @@ def update_scan_config(
587582
>>> response = client.update_scan_config(scan_config, update_mask)
588583
589584
Args:
590-
scan_config (Union[dict, ~google.cloud.websecurityscanner_v1beta.types.ScanConfig]): Required.
591-
The ScanConfig to be updated. The name field must be set to identify the
585+
scan_config (Union[dict, ~google.cloud.websecurityscanner_v1beta.types.ScanConfig]): Required. The ScanConfig to be updated. The name field must be set to identify the
592586
resource to be updated. The values of fields not covered by the mask
593587
will be ignored.
594588
@@ -670,8 +664,7 @@ def start_scan_run(
670664
>>> response = client.start_scan_run(name)
671665
672666
Args:
673-
name (str): Required.
674-
The resource name of the ScanConfig to be used. The name follows the
667+
name (str): Required. The resource name of the ScanConfig to be used. The name follows the
675668
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
676669
retry (Optional[google.api_core.retry.Retry]): A retry object used
677670
to retry requests. If ``None`` is specified, requests will
@@ -741,8 +734,7 @@ def get_scan_run(
741734
>>> response = client.get_scan_run(name)
742735
743736
Args:
744-
name (str): Required.
745-
The resource name of the ScanRun to be returned. The name follows the
737+
name (str): Required. The resource name of the ScanRun to be returned. The name follows the
746738
format of
747739
'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
748740
retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -827,8 +819,7 @@ def list_scan_runs(
827819
... pass
828820
829821
Args:
830-
parent (str): Required.
831-
The parent resource name, which should be a scan resource name in the
822+
parent (str): Required. The parent resource name, which should be a scan resource name in the
832823
format 'projects/{projectId}/scanConfigs/{scanConfigId}'.
833824
page_size (int): The maximum number of resources contained in the
834825
underlying API response. If page streaming is performed per-
@@ -919,8 +910,7 @@ def stop_scan_run(
919910
>>> response = client.stop_scan_run(name)
920911
921912
Args:
922-
name (str): Required.
923-
The resource name of the ScanRun to be stopped. The name follows the
913+
name (str): Required. The resource name of the ScanRun to be stopped. The name follows the
924914
format of
925915
'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
926916
retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -1004,8 +994,7 @@ def list_crawled_urls(
1004994
... pass
1005995
1006996
Args:
1007-
parent (str): Required.
1008-
The parent resource name, which should be a scan run resource name in the
997+
parent (str): Required. The parent resource name, which should be a scan run resource name in the
1009998
format
1010999
'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
10111000
page_size (int): The maximum number of resources contained in the
@@ -1097,8 +1086,7 @@ def get_finding(
10971086
>>> response = client.get_finding(name)
10981087
10991088
Args:
1100-
name (str): Required.
1101-
The resource name of the Finding to be returned. The name follows the
1089+
name (str): Required. The resource name of the Finding to be returned. The name follows the
11021090
format of
11031091
'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'.
11041092
retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -1186,12 +1174,11 @@ def list_findings(
11861174
... pass
11871175
11881176
Args:
1189-
parent (str): Required.
1190-
The parent resource name, which should be a scan run resource name in the
1177+
parent (str): Required. The parent resource name, which should be a scan run resource name in the
11911178
format
11921179
'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
1193-
filter_ (str): The filter expression. The expression must be in the format: . Supported
1194-
field: 'finding\_type'. Supported operator: '='.
1180+
filter_ (str): Required. The filter expression. The expression must be in the format: .
1181+
Supported field: 'finding\_type'. Supported operator: '='.
11951182
page_size (int): The maximum number of resources contained in the
11961183
underlying API response. If page streaming is performed per-
11971184
resource, this parameter does not affect the return value. If page
@@ -1281,8 +1268,7 @@ def list_finding_type_stats(
12811268
>>> response = client.list_finding_type_stats(parent)
12821269
12831270
Args:
1284-
parent (str): Required.
1285-
The parent resource name, which should be a scan run resource name in the
1271+
parent (str): Required. The parent resource name, which should be a scan run resource name in the
12861272
format
12871273
'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
12881274
retry (Optional[google.api_core.retry.Retry]): A retry object used

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/gapic/web_security_scanner_client_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"DeleteScanConfig": {
2626
"timeout_millis": 60000,
27-
"retry_codes_name": "idempotent",
27+
"retry_codes_name": "non_idempotent",
2828
"retry_params_name": "default",
2929
},
3030
"GetScanConfig": {

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/proto/crawled_url.proto

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ syntax = "proto3";
1717

1818
package google.cloud.websecurityscanner.v1beta;
1919

20-
import "google/api/annotations.proto";
21-
2220
option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner";
2321
option java_multiple_files = true;
2422
option java_outer_classname = "CrawledUrlProto";
@@ -29,16 +27,13 @@ option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta";
2927
// Security Scanner Service crawls the web applications, following all links
3028
// within the scope of sites, to find the URLs to test against.
3129
message CrawledUrl {
32-
// Output only.
3330
// The http method of the request that was used to visit the URL, in
3431
// uppercase.
3532
string http_method = 1;
3633

37-
// Output only.
3834
// The URL that was crawled.
3935
string url = 2;
4036

41-
// Output only.
4237
// The body of the request that was used to visit the URL.
4338
string body = 3;
4439
}

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/proto/crawled_url_pb2.py

Lines changed: 7 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/proto/finding.proto

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ syntax = "proto3";
1717

1818
package google.cloud.websecurityscanner.v1beta;
1919

20-
import "google/api/annotations.proto";
20+
import "google/api/resource.proto";
2121
import "google/cloud/websecurityscanner/v1beta/finding_addon.proto";
2222

2323
option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner";
@@ -29,79 +29,68 @@ option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta";
2929
// A Finding resource represents a vulnerability instance identified during a
3030
// ScanRun.
3131
message Finding {
32-
// Output only.
32+
option (google.api.resource) = {
33+
type: "websecurityscanner.googleapis.com/Finding"
34+
pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}"
35+
};
36+
3337
// The resource name of the Finding. The name follows the format of
3438
// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'.
3539
// The finding IDs are generated by the system.
3640
string name = 1;
3741

38-
// Output only.
3942
// The type of the Finding.
4043
// Detailed and up-to-date information on findings can be found here:
4144
// https://cloud.google.com/security-scanner/docs/scan-result-details
4245
string finding_type = 2;
4346

44-
// Output only.
4547
// The http method of the request that triggered the vulnerability, in
4648
// uppercase.
4749
string http_method = 3;
4850

49-
// Output only.
5051
// The URL produced by the server-side fuzzer and used in the request that
5152
// triggered the vulnerability.
5253
string fuzzed_url = 4;
5354

54-
// Output only.
5555
// The body of the request that triggered the vulnerability.
5656
string body = 5;
5757

58-
// Output only.
5958
// The description of the vulnerability.
6059
string description = 6;
6160

62-
// Output only.
6361
// The URL containing human-readable payload that user can leverage to
6462
// reproduce the vulnerability.
6563
string reproduction_url = 7;
6664

67-
// Output only.
6865
// If the vulnerability was originated from nested IFrame, the immediate
6966
// parent IFrame is reported.
7067
string frame_url = 8;
7168

72-
// Output only.
7369
// The URL where the browser lands when the vulnerability is detected.
7470
string final_url = 9;
7571

76-
// Output only.
7772
// The tracking ID uniquely identifies a vulnerability instance across
7873
// multiple ScanRuns.
7974
string tracking_id = 10;
8075

81-
// Output only.
8276
// An addon containing information reported for a vulnerability with an HTML
8377
// form, if any.
8478
Form form = 16;
8579

86-
// Output only.
8780
// An addon containing information about outdated libraries.
8881
OutdatedLibrary outdated_library = 11;
8982

90-
// Output only.
9183
// An addon containing detailed information regarding any resource causing the
9284
// vulnerability such as JavaScript sources, image, audio files, etc.
9385
ViolatingResource violating_resource = 12;
9486

95-
// Output only.
9687
// An addon containing information about vulnerable or missing HTTP headers.
9788
VulnerableHeaders vulnerable_headers = 15;
9889

99-
// Output only.
10090
// An addon containing information about request parameters which were found
10191
// to be vulnerable.
10292
VulnerableParameters vulnerable_parameters = 13;
10393

104-
// Output only.
10594
// An addon containing information reported for an XSS, if any.
10695
Xss xss = 14;
10796
}

packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/proto/finding_addon.proto

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ syntax = "proto3";
1717

1818
package google.cloud.websecurityscanner.v1beta;
1919

20-
import "google/api/annotations.proto";
21-
2220
option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner";
2321
option java_multiple_files = true;
2422
option java_outer_classname = "FindingAddonProto";

0 commit comments

Comments
 (0)