Skip to content

Commit 05a8b23

Browse files
committed
fix: added missing validations
1 parent ad5d851 commit 05a8b23

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
@@ -37,6 +37,51 @@ spec:
3737
cdn_policy:
3838
name: cdn_policy
3939
title: Cdn Policy
40+
properties:
41+
signed_url_cache_max_age_sec:
42+
name: signed_url_cache_max_age_sec
43+
title: Signed URL Cache Max Age Sec
44+
regexValidation: "^[0-9]+$"
45+
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
46+
cache_mode:
47+
name: cache_mode
48+
title: Cache Mode
49+
enumValueLabels:
50+
- label: CACHE_ALL_STATIC
51+
value: CACHE_ALL_STATIC
52+
- label: USE_ORIGIN_HEADERS
53+
value: USE_ORIGIN_HEADERS
54+
- label: FORCE_CACHE_ALL
55+
value: FORCE_CACHE_ALL
56+
bypass_cache_on_request_headers:
57+
name: bypass_cache_on_request_headers
58+
title: Bypass Cache On Request Headers
59+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
60+
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"
61+
cache_key_policy:
62+
name: cache_key_policy
63+
title: Cache Key Policy
64+
properties:
65+
query_string_blacklist:
66+
name: query_string_blacklist
67+
title: Query String Blacklist
68+
regexValidation: ^[a-zA-Z0-9_-]+$
69+
validation: Must only contain letters (a–z, A–Z), numbers (0–9), underscores (_), or hyphens (-)
70+
query_string_whitelist:
71+
name: query_string_whitelist
72+
title: Query String Whitelist
73+
regexValidation: ^[a-zA-Z0-9_-]+$
74+
validation: Must only contain letters (a–z, A–Z), numbers (0–9), underscores (_), or hyphens (-)
75+
include_http_headers:
76+
name: include_http_headers
77+
title: Include Http Headers
78+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
79+
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"
80+
include_named_cookies:
81+
name: include_named_cookies
82+
title: Include Named Cookies
83+
regexValidation: "^[A-Za-z0-9!#%&'*+.^_|~-]{1,63}$"
84+
validation: "Must be a valid cookie name: 1–63 characters, containing only letters [A–Z, a–z], digits [0–9], and the special characters [! # % & ' * + . ^ _ | ~ -]"
4085
compression_mode:
4186
name: compression_mode
4287
title: Compression Mode
@@ -51,9 +96,13 @@ spec:
5196
custom_request_headers:
5297
name: custom_request_headers
5398
title: Custom Request Headers
99+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
100+
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"
54101
custom_response_headers:
55102
name: custom_response_headers
56103
title: Custom Response Headers
104+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
105+
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"
57106
description:
58107
name: description
59108
title: Description
@@ -66,18 +115,96 @@ spec:
66115
firewall_networks:
67116
name: firewall_networks
68117
title: Firewall Networks
118+
regexValidation: "^(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/networks/[a-zA-Z0-9-_]+|[a-zA-Z0-9-_]+)$"
119+
validation: Network must be a valid network name or a full resource path.
69120
firewall_projects:
70121
name: firewall_projects
71122
title: Firewall Projects
123+
regexValidation: ^[a-z][a-z0-9-]{4,28}[a-z0-9]$
124+
validation: Project ID must be 6 to 30 characters, consist of lowercase letters, numbers, and hyphens, and start with a letter
125+
firewall_source_ranges:
126+
name: firewall_source_ranges
127+
title: Firewall Source Ranges
128+
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])$"
129+
validation: Must be a valid CIDR range
72130
firewall_source_ranges:
73131
name: firewall_source_ranges
74132
title: Firewall Source Ranges
75133
groups:
76134
name: groups
77135
title: Groups
136+
properties:
137+
balancing_mode:
138+
name: balancing_mode
139+
title: Balancing Mode
140+
enumValueLabels:
141+
- label: CONNECTION
142+
value: CONNECTION
143+
- label: RATE
144+
value: RATE
145+
- label: UTILIZATION
146+
value: UTILIZATION
147+
- label: CUSTOM_METRICS
148+
value: CUSTOM_METRICS
78149
health_check:
79150
name: health_check
80151
title: Health Check
152+
properties:
153+
host:
154+
name: host
155+
title: Host
156+
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:]+\\]?))$"
157+
validation: Must be a valid hostname (RFC 1035), IPv4 address, or IPv6 address
158+
request_path:
159+
name: request_path
160+
title: Request Path
161+
regexValidation: "^/.*$"
162+
validation: Must start with a forward slash `/` and can include any valid path characters.
163+
request:
164+
name: request
165+
title: Request
166+
regexValidation: "^[ -~]*$"
167+
validation: Must contain only ASCII characters
168+
response:
169+
name: response
170+
title: Response
171+
regexValidation: "^[ -~]*$"
172+
validation: Must contain only ASCII characters
173+
port_name:
174+
name: port_name
175+
title: Port Name
176+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
177+
validation: Must start with a lowercase letter, contain only lowercase letters, digits, or hyphens, and end with a letter or digit
178+
proxy_header:
179+
name: proxy_header
180+
title: Proxy Header
181+
enumValueLabels:
182+
- label: NONE
183+
value: NONE
184+
- label: PROXY_V1
185+
value: PROXY_V1
186+
port_specification:
187+
name: port_specification
188+
title: Port Specification
189+
enumValueLabels:
190+
- label: USE_FIXED_PORT
191+
value: USE_FIXED_PORT
192+
- label: USE_NAMED_PORT
193+
value: USE_NAMED_PORT
194+
- label: USE_SERVING_PORT
195+
value: USE_SERVING_PORT
196+
protocol:
197+
name: protocol
198+
title: Protocol
199+
enumValueLabels:
200+
- label: HTTP
201+
value: HTTP
202+
- label: HTTPS
203+
value: HTTPS
204+
- label: HTTP2
205+
value: HTTP2
206+
- label: TCP
207+
value: TCP
81208
host_path_mappings:
82209
name: host_path_mappings
83210
title: Host Path Mappings
@@ -102,6 +229,23 @@ spec:
102229
locality_lb_policy:
103230
name: locality_lb_policy
104231
title: Locality Lb Policy
232+
enumValueLabels:
233+
- label: ROUND_ROBIN
234+
value: ROUND_ROBIN
235+
- label: LEAST_REQUEST
236+
value: LEAST_REQUEST
237+
- label: RING_HASH
238+
value: RING_HASH
239+
- label: RANDOM
240+
value: RANDOM
241+
- label: ORIGINAL_DESTINATION
242+
value: ORIGINAL_DESTINATION
243+
- label: MAGLEV
244+
value: MAGLEV
245+
- label: WEIGHTED_MAGLEV
246+
value: WEIGHTED_MAGLEV
247+
- label: WEIGHTED_ROUND_ROBIN
248+
value: WEIGHTED_ROUND_ROBIN
105249
log_config:
106250
name: log_config
107251
title: Log Config
@@ -116,24 +260,72 @@ spec:
116260
port_name:
117261
name: port_name
118262
title: Port Name
263+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
264+
validation: Must start with a lowercase letter, contain only lowercase letters, digits, or hyphens, and end with a letter or digit
119265
project_id:
120266
name: project_id
121267
title: Project Id
122268
protocol:
123269
name: protocol
124270
title: Protocol
271+
enumValueLabels:
272+
- label: HTTP
273+
value: HTTP
274+
- label: HTTPS
275+
value: HTTPS
276+
- label: HTTP2
277+
value: HTTP2
278+
- label: TCP
279+
value: TCP
125280
security_policy:
126281
name: security_policy
127282
title: Security Policy
283+
regexValidation: "^(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/securityPolicies/[a-z0-9-]+|[a-z0-9-]+)$"
284+
validation: Must be a valid security policy name or full resource path in the format "projects/{project}/global/securityPolicies/{policy}"
128285
serverless_neg_backends:
129286
name: serverless_neg_backends
130287
title: Serverless Neg Backends
288+
properties:
289+
type:
290+
name: type
291+
title: Type
292+
enumValueLabels:
293+
- label: Cloud Run
294+
value: cloud-run
295+
- label: Cloud Function
296+
value: cloud-function
297+
- label: App Engine
298+
value: app-engine
299+
service_name:
300+
name: service_name
301+
title: Service Name
302+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
303+
validation: Must be a valid service name (lowercase, hyphens, numbers, up to 63 chars).
131304
session_affinity:
132305
name: session_affinity
133306
title: Session Affinity
307+
enumValueLabels:
308+
- label: NONE
309+
value: NONE
310+
- label: CLIENT_IP
311+
value: CLIENT_IP
312+
- label: CLIENT_IP_PORT_PROTO
313+
value: CLIENT_IP_PORT_PROTO
314+
- label: CLIENT_IP_PROTO
315+
value: CLIENT_IP_PROTO
316+
- label: GENERATED_COOKIE
317+
value: GENERATED_COOKIE
318+
- label: HEADER_FIELD
319+
value: HEADER_FIELD
320+
- label: HTTP_COOKIE
321+
value: HTTP_COOKIE
322+
- label: STRONG_COOKIE_AFFINITY
323+
value: STRONG_COOKIE_AFFINITY
134324
target_service_accounts:
135325
name: target_service_accounts
136326
title: Target Service Accounts
327+
regexValidation: ^[a-z][a-z0-9-]{4,28}[a-z0-9]@[a-z][a-z0-9-]{4,28}[a-z0-9].iam.gserviceaccount.com$
328+
validation: Service account email must be in the format {account-id}@{project-id}.iam.gserviceaccount.com
137329
target_tags:
138330
name: target_tags
139331
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
@@ -73,6 +77,8 @@ spec:
7377
ipv6_address:
7478
name: ipv6_address
7579
title: Ipv6 Address
80+
regexValidation: ^(([0-9A-Fa-f]{1,4}:){1,7}[0-9A-Fa-f]{1,4}|::1|::)$
81+
validation: Must be a valid IPv6 address.
7682
labels:
7783
name: labels
7884
title: Labels
@@ -95,6 +101,8 @@ spec:
95101
network:
96102
name: network
97103
title: Network
104+
regexValidation: "^(projects/[a-z][a-z0-9-]{4,28}[a-z0-9]/global/networks/[a-zA-Z0-9-_]+|[a-zA-Z0-9-_]+)$"
105+
validation: Network must be a valid network name or a full resource path.
98106
private_key:
99107
name: private_key
100108
title: Private Key
@@ -104,24 +112,53 @@ spec:
104112
quic:
105113
name: quic
106114
title: Quic
115+
enumValueLabels:
116+
- label: ENABLE
117+
value: ENABLE
118+
- label: DISABLE
119+
value: DISABLE
120+
- label: NONE
121+
value: NONE
107122
random_certificate_suffix:
108123
name: random_certificate_suffix
109124
title: Random Certificate Suffix
110125
server_tls_policy:
111126
name: server_tls_policy
112127
title: Server Tls Policy
128+
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])$"
129+
validation: Must be a valid server TLS policy full resource URL.
113130
ssl:
114131
name: ssl
115132
title: Ssl
116133
ssl_certificates:
117134
name: ssl_certificates
118135
title: Ssl Certificates
136+
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])$"
137+
validation: Must be a valid SSL certificate resource URL.
119138
ssl_policy:
120139
name: ssl_policy
121140
title: Ssl Policy
141+
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])$"
142+
validation: Must be a valid SSL policy name or full resource URL.
122143
url_map_input:
123144
name: url_map_input
124145
title: Url Map Input
146+
properties:
147+
host:
148+
name: host
149+
title: Host
150+
regexValidation: "^([*]|([*][.])?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+)$"
151+
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"
152+
path:
153+
name: path
154+
title: Path
155+
regexValidation: "^(.*)$"
156+
validation: Path values must start with "/"
157+
backend_service:
158+
name: backend_service
159+
title: Backend Service
160+
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])?$"
161+
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}]
125162
url_map_resource_uri:
126163
name: url_map_resource_uri
127164
title: Url Map Resource Uri

0 commit comments

Comments
 (0)