Skip to content

Commit 973d80c

Browse files
committed
fix: added missing validations
1 parent 41f378c commit 973d80c

File tree

2 files changed

+229
-0
lines changed

2 files changed

+229
-0
lines changed

modules/backend/metadata.display.yaml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,51 @@ spec:
3434
cdn_policy:
3535
name: cdn_policy
3636
title: Cdn Policy
37+
properties:
38+
signed_url_cache_max_age_sec:
39+
name: signed_url_cache_max_age_sec
40+
title: Signed URL Cache Max Age Sec
41+
regexValidation: "^[0-9]+$"
42+
validation: Must be a non-negative integer representing the maximum cache age in seconds, for example 0, 300, or 3600. Only numeric digits are allowed
43+
cache_mode:
44+
name: cache_mode
45+
title: Cache Mode
46+
enumValueLabels:
47+
- label: CACHE_ALL_STATIC
48+
value: CACHE_ALL_STATIC
49+
- label: USE_ORIGIN_HEADERS
50+
value: USE_ORIGIN_HEADERS
51+
- label: FORCE_CACHE_ALL
52+
value: FORCE_CACHE_ALL
53+
bypass_cache_on_request_headers:
54+
name: bypass_cache_on_request_headers
55+
title: Bypass Cache On Request Headers
56+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
57+
validation: "Must be a valid HTTP header name: start with a letter, contain only letters [A–Z, a–z], digits [0–9], or hyphens [-], and be at most 63 characters long"
58+
cache_key_policy:
59+
name: cache_key_policy
60+
title: Cache Key Policy
61+
properties:
62+
query_string_blacklist:
63+
name: query_string_blacklist
64+
title: Query String Blacklist
65+
regexValidation: ^[a-zA-Z0-9_-]+$
66+
validation: Must only contain letters (a–z, A–Z), numbers (0–9), underscores (_), or hyphens (-)
67+
query_string_whitelist:
68+
name: query_string_whitelist
69+
title: Query String Whitelist
70+
regexValidation: ^[a-zA-Z0-9_-]+$
71+
validation: Must only contain letters (a–z, A–Z), numbers (0–9), underscores (_), or hyphens (-)
72+
include_http_headers:
73+
name: include_http_headers
74+
title: Include Http Headers
75+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
76+
validation: "Must be a valid HTTP header name: start with a letter, contain only letters [A–Z, a–z], digits [0–9], or hyphens [-], and be at most 63 characters long"
77+
include_named_cookies:
78+
name: include_named_cookies
79+
title: Include Named Cookies
80+
regexValidation: "^[A-Za-z0-9!#%&'*+.^_|~-]{1,63}$"
81+
validation: "Must be a valid cookie name: 1–63 characters, containing only letters [A–Z, a–z], digits [0–9], and the special characters [! # % & ' * + . ^ _ | ~ -]"
3782
compression_mode:
3883
name: compression_mode
3984
title: Compression Mode
@@ -48,9 +93,13 @@ spec:
4893
custom_request_headers:
4994
name: custom_request_headers
5095
title: Custom Request Headers
96+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
97+
validation: "Must be a valid HTTP header name: start with a letter, contain only letters [A–Z, a–z], digits [0–9], or hyphens [-], and be at most 63 characters long"
5198
custom_response_headers:
5299
name: custom_response_headers
53100
title: Custom Response Headers
101+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
102+
validation: "Must be a valid HTTP header name: start with a letter, contain only letters [A–Z, a–z], digits [0–9], or hyphens [-], and be at most 63 characters long"
54103
description:
55104
name: description
56105
title: Description
@@ -63,15 +112,93 @@ spec:
63112
firewall_networks:
64113
name: firewall_networks
65114
title: Firewall Networks
115+
regexValidation: "^(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/networks/[a-zA-Z0-9-_]+|[a-zA-Z0-9-_]+)$"
116+
validation: Network must be a valid network name or a full resource path.
66117
firewall_projects:
67118
name: firewall_projects
68119
title: Firewall Projects
120+
regexValidation: ^[a-z][a-z0-9-]{4,28}[a-z0-9]$
121+
validation: Project ID must be 6 to 30 characters, consist of lowercase letters, numbers, and hyphens, and start with a letter
122+
firewall_source_ranges:
123+
name: firewall_source_ranges
124+
title: Firewall Source Ranges
125+
regexValidation: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])/([0-9]|[1-2][0-9]|3[0-2])$"
126+
validation: Must be a valid CIDR range
69127
groups:
70128
name: groups
71129
title: Groups
130+
properties:
131+
balancing_mode:
132+
name: balancing_mode
133+
title: Balancing Mode
134+
enumValueLabels:
135+
- label: CONNECTION
136+
value: CONNECTION
137+
- label: RATE
138+
value: RATE
139+
- label: UTILIZATION
140+
value: UTILIZATION
141+
- label: CUSTOM_METRICS
142+
value: CUSTOM_METRICS
72143
health_check:
73144
name: health_check
74145
title: Health Check
146+
properties:
147+
host:
148+
name: host
149+
title: Host
150+
regexValidation: "^(([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?[.])+[a-zA-Z]{2,63}|[0-9]{1,3}([.][0-9]{1,3}){3}|(\\[?[A-Fa-f0-9:]+\\]?))$"
151+
validation: Must be a valid hostname (RFC 1035), IPv4 address, or IPv6 address
152+
request_path:
153+
name: request_path
154+
title: Request Path
155+
regexValidation: "^/.*$"
156+
validation: Must start with a forward slash `/` and can include any valid path characters.
157+
request:
158+
name: request
159+
title: Request
160+
regexValidation: "^[ -~]*$"
161+
validation: Must contain only ASCII characters
162+
response:
163+
name: response
164+
title: Response
165+
regexValidation: "^[ -~]*$"
166+
validation: Must contain only ASCII characters
167+
port_name:
168+
name: port_name
169+
title: Port Name
170+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
171+
validation: Must start with a lowercase letter, contain only lowercase letters, digits, or hyphens, and end with a letter or digit
172+
proxy_header:
173+
name: proxy_header
174+
title: Proxy Header
175+
enumValueLabels:
176+
- label: NONE
177+
value: NONE
178+
- label: PROXY_V1
179+
value: PROXY_V1
180+
port_specification:
181+
name: port_specification
182+
title: Port Specification
183+
enumValueLabels:
184+
- label: USE_FIXED_PORT
185+
value: USE_FIXED_PORT
186+
- label: USE_NAMED_PORT
187+
value: USE_NAMED_PORT
188+
- label: USE_SERVING_PORT
189+
value: USE_SERVING_PORT
190+
protocol:
191+
name: protocol
192+
title: Protocol
193+
enumValueLabels:
194+
- label: HTTP
195+
value: HTTP
196+
- label: HTTPS
197+
value: HTTPS
198+
- label: HTTP2
199+
value: HTTP2
200+
- label: TCP
201+
value: TCP
75202
host_path_mappings:
76203
name: host_path_mappings
77204
title: Host Path Mappings
@@ -90,6 +217,23 @@ spec:
90217
locality_lb_policy:
91218
name: locality_lb_policy
92219
title: Locality Lb Policy
220+
enumValueLabels:
221+
- label: ROUND_ROBIN
222+
value: ROUND_ROBIN
223+
- label: LEAST_REQUEST
224+
value: LEAST_REQUEST
225+
- label: RING_HASH
226+
value: RING_HASH
227+
- label: RANDOM
228+
value: RANDOM
229+
- label: ORIGINAL_DESTINATION
230+
value: ORIGINAL_DESTINATION
231+
- label: MAGLEV
232+
value: MAGLEV
233+
- label: WEIGHTED_MAGLEV
234+
value: WEIGHTED_MAGLEV
235+
- label: WEIGHTED_ROUND_ROBIN
236+
value: WEIGHTED_ROUND_ROBIN
93237
log_config:
94238
name: log_config
95239
title: Log Config
@@ -104,24 +248,72 @@ spec:
104248
port_name:
105249
name: port_name
106250
title: Port Name
251+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
252+
validation: Must start with a lowercase letter, contain only lowercase letters, digits, or hyphens, and end with a letter or digit
107253
project_id:
108254
name: project_id
109255
title: Project Id
110256
protocol:
111257
name: protocol
112258
title: Protocol
259+
enumValueLabels:
260+
- label: HTTP
261+
value: HTTP
262+
- label: HTTPS
263+
value: HTTPS
264+
- label: HTTP2
265+
value: HTTP2
266+
- label: TCP
267+
value: TCP
113268
security_policy:
114269
name: security_policy
115270
title: Security Policy
271+
regexValidation: "^(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/securityPolicies/[a-z0-9-]+|[a-z0-9-]+)$"
272+
validation: Must be a valid security policy name or full resource path in the format "projects/{project}/global/securityPolicies/{policy}"
116273
serverless_neg_backends:
117274
name: serverless_neg_backends
118275
title: Serverless Neg Backends
276+
properties:
277+
type:
278+
name: type
279+
title: Type
280+
enumValueLabels:
281+
- label: Cloud Run
282+
value: cloud-run
283+
- label: Cloud Function
284+
value: cloud-function
285+
- label: App Engine
286+
value: app-engine
287+
service_name:
288+
name: service_name
289+
title: Service Name
290+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
291+
validation: Must be a valid service name (lowercase, hyphens, numbers, up to 63 chars).
119292
session_affinity:
120293
name: session_affinity
121294
title: Session Affinity
295+
enumValueLabels:
296+
- label: NONE
297+
value: NONE
298+
- label: CLIENT_IP
299+
value: CLIENT_IP
300+
- label: CLIENT_IP_PORT_PROTO
301+
value: CLIENT_IP_PORT_PROTO
302+
- label: CLIENT_IP_PROTO
303+
value: CLIENT_IP_PROTO
304+
- label: GENERATED_COOKIE
305+
value: GENERATED_COOKIE
306+
- label: HEADER_FIELD
307+
value: HEADER_FIELD
308+
- label: HTTP_COOKIE
309+
value: HTTP_COOKIE
310+
- label: STRONG_COOKIE_AFFINITY
311+
value: STRONG_COOKIE_AFFINITY
122312
target_service_accounts:
123313
name: target_service_accounts
124314
title: Target Service Accounts
315+
regexValidation: ^[a-z][a-z0-9-]{4,28}[a-z0-9]@[a-z][a-z0-9-]{4,28}[a-z0-9].iam.gserviceaccount.com$
316+
validation: Service account email must be in the format {account-id}@{project-id}.iam.gserviceaccount.com
125317
target_tags:
126318
name: target_tags
127319
title: Target Tags

modules/frontend/metadata.display.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ spec:
3131
address:
3232
name: address
3333
title: Address
34+
regexValidation: "^(0.0.0.0|((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9]).){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])|([0-9a-fA-F:]+(/[0-9]{1,3})?)|(https://www.googleapis.com/compute/v1/projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/(global|regions/[a-z0-9-]+)/addresses/[a-z][a-z0-9-]{0,61}[a-z0-9])|(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/(global|regions/[a-z0-9-]+)/addresses/[a-z][a-z0-9-]{0,61}[a-z0-9])|(regions/[a-z0-9-]+/addresses/[a-z][a-z0-9-]{0,61}[a-z0-9])|(global/addresses/[a-z][a-z0-9-]{0,61}[a-z0-9])|([a-z][a-z0-9-]{0,61}[a-z0-9]))$"
35+
validation: "Must be a valid IP address (IPv4, IPv6, or 0.0.0.0) or a Compute Address reference in one of the following formats: https://www.googleapis.com/compute/v1/projects/{project}/(global|regions/{region})/addresses/{name}, projects/{project}/(global|regions/{region})/addresses/{name}, regions/{region}/addresses/{name}, global/addresses/{name}, or {address-name}"
3436
certificate:
3537
name: certificate
3638
title: Certificate
3739
certificate_map:
3840
name: certificate_map
3941
title: Certificate Map
42+
regexValidation: "^projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/locations/global/certificateMaps/[a-zA-Z][a-zA-Z0-9-]{0,62}[a-zA-Z0-9]$"
43+
validation: "Must be in the format projects/{project}/locations/global/certificateMaps/{name}"
4044
create_address:
4145
name: create_address
4246
title: Create Address
@@ -70,6 +74,8 @@ spec:
7074
ipv6_address:
7175
name: ipv6_address
7276
title: Ipv6 Address
77+
regexValidation: ^(([0-9A-Fa-f]{1,4}:){1,7}[0-9A-Fa-f]{1,4}|::1|::)$
78+
validation: Must be a valid IPv6 address.
7379
labels:
7480
name: labels
7581
title: Labels
@@ -92,6 +98,8 @@ spec:
9298
network:
9399
name: network
94100
title: Network
101+
regexValidation: "^(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/networks/[a-zA-Z0-9-_]+|[a-zA-Z0-9-_]+)$"
102+
validation: Network must be a valid network name or a full resource path.
95103
private_key:
96104
name: private_key
97105
title: Private Key
@@ -101,24 +109,53 @@ spec:
101109
quic:
102110
name: quic
103111
title: Quic
112+
enumValueLabels:
113+
- label: ENABLE
114+
value: ENABLE
115+
- label: DISABLE
116+
value: DISABLE
117+
- label: NONE
118+
value: NONE
104119
random_certificate_suffix:
105120
name: random_certificate_suffix
106121
title: Random Certificate Suffix
107122
server_tls_policy:
108123
name: server_tls_policy
109124
title: Server Tls Policy
125+
regexValidation: "^projects/[a-z0-9][-a-z0-9]{4,28}[a-z0-9]/locations/[a-z0-9-]+/serverTlsPolicies/[a-z]([-a-z0-9]{0,61}[a-z0-9])$"
126+
validation: Must be a valid server TLS policy full resource URL.
110127
ssl:
111128
name: ssl
112129
title: Ssl
113130
ssl_certificates:
114131
name: ssl_certificates
115132
title: Ssl Certificates
133+
regexValidation: "^(https://www.googleapis.com/compute/v1/)?projects/[a-z0-9][-a-z0-9]{4,28}[a-z0-9]/global/sslCertificates/[a-z]([-a-z0-9]{0,61}[a-z0-9])$|^[a-z]([-a-z0-9]{0,61}[a-z0-9])$"
134+
validation: Must be a valid SSL certificate resource URL.
116135
ssl_policy:
117136
name: ssl_policy
118137
title: Ssl Policy
138+
regexValidation: "^(https://www.googleapis.com/compute/v1/)?projects/[a-z0-9][-a-z0-9]{4,28}[a-z0-9]/global/sslPolicies/[a-z]([-a-z0-9]{0,61}[a-z0-9])$|^[a-z]([-a-z0-9]{0,61}[a-z0-9])$"
139+
validation: Must be a valid SSL policy name or full resource URL.
119140
url_map_input:
120141
name: url_map_input
121142
title: Url Map Input
143+
properties:
144+
host:
145+
name: host
146+
title: Host
147+
regexValidation: "^([*]|([*][.])?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+)$"
148+
validation: "Must be a valid host pattern: a fully qualified domain name (e.g., example.com), or a wildcard in the first component only (e.g., *.example.com). Must contain only lowercase letters, digits, hyphens (-), and dots (.), and be 1–255 characters long"
149+
path:
150+
name: path
151+
title: Path
152+
regexValidation: "^(.*)$"
153+
validation: Path values must start with "/"
154+
backend_service:
155+
name: backend_service
156+
title: Backend Service
157+
regexValidation: "^projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/(backendServices|backendBuckets)/[a-z]([a-z0-9-]{0,61}[a-z0-9])?$"
158+
validation: Must be a reference to a global backend service or backend bucket in the format [projects/{project}/global/backendServices/{name}] or [projects/{project}/global/backendBuckets/{name}]
122159
url_map_resource_uri:
123160
name: url_map_resource_uri
124161
title: Url Map Resource Uri

0 commit comments

Comments
 (0)