Skip to content

Commit da1e488

Browse files
committed
fix: added missing validations
1 parent 97c69e6 commit da1e488

File tree

2 files changed

+233
-0
lines changed

2 files changed

+233
-0
lines changed

modules/backend/metadata.display.yaml

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,55 @@ 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: ^\d+$
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+
properties:
57+
header_name:
58+
name: header_name
59+
title: Header Name
60+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
61+
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"
62+
cache_key_policy:
63+
name: cache_key_policy
64+
title: Cache Key Policy
65+
properties:
66+
query_string_blacklist:
67+
name: query_string_blacklist
68+
title: Query String Blacklist
69+
regexValidation: ^[a-zA-Z0-9_-]+$
70+
validation: Must only contain letters (a–z, A–Z), numbers (0–9), underscores (_), or hyphens (-)
71+
query_string_whitelist:
72+
name: query_string_whitelist
73+
title: Query String Whitelist
74+
regexValidation: ^[a-zA-Z0-9_-]+$
75+
validation: Must only contain letters (a–z, A–Z), numbers (0–9), underscores (_), or hyphens (-)
76+
include_http_headers:
77+
name: include_http_headers
78+
title: Include Http Headers
79+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
80+
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"
81+
include_named_cookies:
82+
name: include_named_cookies
83+
title: Include Named Cookies
84+
regexValidation: ^[A-Za-z0-9!#%&'*+.^_|~\-]{1,63}$
85+
validation: "Must be a valid cookie name: 1–63 characters, containing only letters [A–Z, a–z], digits [0–9], and the special characters [! # % & ' * + . ^ _ | ~ -]"
3786
compression_mode:
3887
name: compression_mode
3988
title: Compression Mode
@@ -48,9 +97,13 @@ spec:
4897
custom_request_headers:
4998
name: custom_request_headers
5099
title: Custom Request Headers
100+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
101+
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"
51102
custom_response_headers:
52103
name: custom_response_headers
53104
title: Custom Response Headers
105+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
106+
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"
54107
description:
55108
name: description
56109
title: Description
@@ -63,15 +116,93 @@ spec:
63116
firewall_networks:
64117
name: firewall_networks
65118
title: Firewall Networks
119+
regexValidation: ^(projects\/[a-z0-9\-]+\/global\/networks\/[a-zA-Z0-9\-_]+|[a-zA-Z0-9\-_]+)$
120+
validation: Network must be a valid network name or a full resource path.
66121
firewall_projects:
67122
name: firewall_projects
68123
title: Firewall Projects
124+
regexValidation: ^[a-z][a-z0-9-]{4,28}[a-z0-9]$
125+
validation: Project ID must be 6 to 30 characters, consist of lowercase letters, numbers, and hyphens, and start with a letter
126+
firewall_source_ranges:
127+
name: firewall_source_ranges
128+
title: Firewall Source Ranges
129+
regexValidation: ^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/([0-9]|[1-2][0-9]|3[0-2])$
130+
validation: Must be a valid CIDR range
69131
groups:
70132
name: groups
71133
title: Groups
134+
properties:
135+
balancing_mode:
136+
name: balancing_mode
137+
title: Balancing Mode
138+
enumValueLabels:
139+
- label: CONNECTION
140+
value: CONNECTION
141+
- label: RATE
142+
value: RATE
143+
- label: UTILIZATION
144+
value: UTILIZATION
145+
- label: CUSTOM_METRICS
146+
value: CUSTOM_METRICS
72147
health_check:
73148
name: health_check
74149
title: Health Check
150+
properties:
151+
host:
152+
name: host
153+
title: Host
154+
regexValidation: ^(([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}|\d{1,3}(\.\d{1,3}){3}|\[?[A-Fa-f0-9:]+\]?)$
155+
validation: Must be a valid hostname (RFC 1035), IPv4 address, or IPv6 address
156+
request_path:
157+
name: request_path
158+
title: Request Path
159+
regexValidation: ^\/.*$
160+
validation: Must start with a forward slash `/` and can include any valid path characters.
161+
request:
162+
name: request
163+
title: Request
164+
regexValidation: ^[\x20-\x7E]*$
165+
validation: Must contain only ASCII characters
166+
response:
167+
name: response
168+
title: Response
169+
regexValidation: ^[\x20-\x7E]*$
170+
validation: Must contain only ASCII characters
171+
port_name:
172+
name: port_name
173+
title: Port Name
174+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
175+
validation: Must start with a lowercase letter, contain only lowercase letters, digits, or hyphens, and end with a letter or digit
176+
proxy_header:
177+
name: proxy_header
178+
title: Proxy Header
179+
enumValueLabels:
180+
- label: NONE
181+
value: NONE
182+
- label: PROXY_V1
183+
value: PROXY_V1
184+
port_specification:
185+
name: port_specification
186+
title: Port Specification
187+
enumValueLabels:
188+
- label: USE_FIXED_PORT
189+
value: USE_FIXED_PORT
190+
- label: USE_NAMED_PORT
191+
value: USE_NAMED_PORT
192+
- label: USE_SERVING_PORT
193+
value: USE_SERVING_PORT
194+
protocol:
195+
name: protocol
196+
title: Protocol
197+
enumValueLabels:
198+
- label: HTTP
199+
value: HTTP
200+
- label: HTTPS
201+
value: HTTPS
202+
- label: HTTP2
203+
value: HTTP2
204+
- label: TCP
205+
value: TCP
75206
host_path_mappings:
76207
name: host_path_mappings
77208
title: Host Path Mappings
@@ -90,6 +221,23 @@ spec:
90221
locality_lb_policy:
91222
name: locality_lb_policy
92223
title: Locality Lb Policy
224+
enumValueLabels:
225+
- label: ROUND_ROBIN
226+
value: ROUND_ROBIN
227+
- label: LEAST_REQUEST
228+
value: LEAST_REQUEST
229+
- label: RING_HASH
230+
value: RING_HASH
231+
- label: RANDOM
232+
value: RANDOM
233+
- label: ORIGINAL_DESTINATION
234+
value: ORIGINAL_DESTINATION
235+
- label: MAGLEV
236+
value: MAGLEV
237+
- label: WEIGHTED_MAGLEV
238+
value: WEIGHTED_MAGLEV
239+
- label: WEIGHTED_ROUND_ROBIN
240+
value: WEIGHTED_ROUND_ROBIN
93241
log_config:
94242
name: log_config
95243
title: Log Config
@@ -104,24 +252,72 @@ spec:
104252
port_name:
105253
name: port_name
106254
title: Port Name
255+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
256+
validation: Must start with a lowercase letter, contain only lowercase letters, digits, or hyphens, and end with a letter or digit
107257
project_id:
108258
name: project_id
109259
title: Project Id
110260
protocol:
111261
name: protocol
112262
title: Protocol
263+
enumValueLabels:
264+
- label: HTTP
265+
value: HTTP
266+
- label: HTTPS
267+
value: HTTPS
268+
- label: HTTP2
269+
value: HTTP2
270+
- label: TCP
271+
value: TCP
113272
security_policy:
114273
name: security_policy
115274
title: Security Policy
275+
regexValidation: ^(projects\/[a-z][a-z0-9-]{4,61}[a-z0-9]\/global\/securityPolicies\/[a-z]([-a-z0-9]{0,61}[a-z0-9])?|[a-z]([-a-z0-9]{0,61}[a-z0-9])?)$
276+
validation: Must be a valid security policy name or full resource path in the format "projects/{project}/global/securityPolicies/{policy}"
116277
serverless_neg_backends:
117278
name: serverless_neg_backends
118279
title: Serverless Neg Backends
280+
properties:
281+
type:
282+
name: type
283+
title: Type
284+
enumValueLabels:
285+
- label: Cloud Run
286+
value: cloud-run
287+
- label: Cloud Function
288+
value: cloud-function
289+
- label: App Engine
290+
value: app-engine
291+
service_name:
292+
name: service_name
293+
title: Service Name
294+
regexValidation: ^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$
295+
validation: Must be a valid service name (lowercase, hyphens, numbers, up to 63 chars).
119296
session_affinity:
120297
name: session_affinity
121298
title: Session Affinity
299+
enumValueLabels:
300+
- label: NONE
301+
value: NONE
302+
- label: CLIENT_IP
303+
value: CLIENT_IP
304+
- label: CLIENT_IP_PORT_PROTO
305+
value: CLIENT_IP_PORT_PROTO
306+
- label: CLIENT_IP_PROTO
307+
value: CLIENT_IP_PROTO
308+
- label: GENERATED_COOKIE
309+
value: GENERATED_COOKIE
310+
- label: HEADER_FIELD
311+
value: HEADER_FIELD
312+
- label: HTTP_COOKIE
313+
value: HTTP_COOKIE
314+
- label: STRONG_COOKIE_AFFINITY
315+
value: STRONG_COOKIE_AFFINITY
122316
target_service_accounts:
123317
name: target_service_accounts
124318
title: Target Service Accounts
319+
regexValidation: ^[a-z][a-z0-9-]{4,29}@[a-z][a-z0-9-]{4,29}\.iam\.gserviceaccount\.com$
320+
validation: Service account email must be in the format {account-id}@{project-id}.iam.gserviceaccount.com
125321
target_tags:
126322
name: target_tags
127323
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: ^(((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:]+)|projects/[a-z0-9-]+/(global|regions/[a-z0-9-]+)/addresses/[a-z][a-z0-9-]{0,61}[a-z0-9])$
35+
validation: Must be a valid IPv4 address, IPv6 address, or a reference to a Compute Address resource in the format [projects/{project}/global/addresses/{name}] or [projects/{project}/regions/{region}/addresses/{name}]
3436
certificate:
3537
name: certificate
3638
title: Certificate
3739
certificate_map:
3840
name: certificate_map
3941
title: Certificate Map
42+
regexValidation: ^//certificatemanager\.googleapis\.com/projects/[a-z][a-z0-9-]{0,61}[a-z0-9]/locations/global/certificateMaps/[a-zA-Z][a-zA-Z0-9_-]{0,62}[a-zA-Z0-9]$
43+
validation: full resource path of a GCP CertificateMap resource
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-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])?)*)(\.[a-z]{2,})?$
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-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)