- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
fix: Regex for network, subnetwork, CIDR block and Workload Pool in standard and autopilot cluster #2479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Regex for network, subnetwork, CIDR block and Workload Pool in standard and autopilot cluster #2479
Changes from 4 commits
96749e4
              3aee13f
              b67c65b
              a2a8079
              f04aaf8
              c3f31bf
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -256,6 +256,16 @@ spec: | |
| master_authorized_networks_config: | ||
| name: master_authorized_networks_config | ||
| title: Master Authorized Networks Config | ||
| properties: | ||
| cidr_blocks: | ||
| name: cidr_blocks | ||
| title: Cidr Blocks | ||
| properties: | ||
| cidr_block: | ||
| name: cidr_block | ||
| title: Cidr Block | ||
| regexValidation: ^((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[12]?[0-9]))|((\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*\/(12[0-8]|1[01][0-9]|[1-9]?[0-9]))))$ | ||
| validation: Enter the valid CIDR notation. | ||
| mesh_certificates: | ||
| name: mesh_certificates | ||
| title: Mesh Certificates | ||
|  | @@ -306,6 +316,11 @@ spec: | |
| network: | ||
| name: network | ||
| title: Network | ||
| regexValidation: ^[a-z]([a-z0-9-]{0,60}[a-z0-9])?$ | ||
| validation: Network name must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens and cannot end with a hyphen. | ||
|         
                  apeabody marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| altDefaults: | ||
| - type: ALTERNATE_TYPE_DC | ||
| value: default | ||
| node_locations: | ||
| name: node_locations | ||
| title: Node Locations | ||
|  | @@ -456,6 +471,11 @@ spec: | |
| subnetwork: | ||
| name: subnetwork | ||
| title: Subnetwork | ||
| regexValidation: ^[a-z]([a-z0-9-]{0,60}[a-z0-9])?$ | ||
| validation: Network name must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens and cannot end with a hyphen. | ||
|          | ||
| altDefaults: | ||
| - type: ALTERNATE_TYPE_DC | ||
| value: default | ||
| timeouts: | ||
| name: timeouts | ||
| title: Timeouts | ||
|  | @@ -468,6 +488,12 @@ spec: | |
| workload_identity_config: | ||
| name: workload_identity_config | ||
| title: Workload Identity Config | ||
| properties: | ||
| workload_pool: | ||
| name: workload_pool | ||
| title: Workload Pool | ||
| regexValidation: ^.+\.svc\.id\.goog$ | ||
| validation: Workload pool must be in the format <project_id>.svc.id.goog. | ||
|          | ||
| runtime: | ||
| outputs: | ||
| cluster_id: | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -375,6 +375,16 @@ spec: | |
| master_authorized_networks_config: | ||
| name: master_authorized_networks_config | ||
| title: Master Authorized Networks Config | ||
| properties: | ||
| cidr_blocks: | ||
| name: cidr_blocks | ||
| title: Cidr Blocks | ||
| properties: | ||
| cidr_block: | ||
| name: cidr_block | ||
| title: Cidr Block | ||
| regexValidation: ^((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[12]?[0-9]))|((\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*\/(12[0-8]|1[01][0-9]|[1-9]?[0-9]))))$ | ||
|          | ||
| validation: Enter the valid CIDR notation. | ||
| mesh_certificates: | ||
| name: mesh_certificates | ||
| title: Mesh Certificates | ||
|  | @@ -406,6 +416,11 @@ spec: | |
| network: | ||
| name: network | ||
| title: Network | ||
| regexValidation: ^[a-z]([a-z0-9-]{0,60}[a-z0-9])?$ | ||
| validation: Network name must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens and cannot end with a hyphen. | ||
|         
                  apeabody marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| altDefaults: | ||
| - type: ALTERNATE_TYPE_DC | ||
| value: default | ||
| network_policy: | ||
| name: network_policy | ||
| title: Network Policy | ||
|  | @@ -977,6 +992,11 @@ spec: | |
| subnetwork: | ||
| name: subnetwork | ||
| title: Subnetwork | ||
| regexValidation: ^[a-z]([a-z0-9-]{0,60}[a-z0-9])?$ | ||
| validation: Network name must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens and cannot end with a hyphen. | ||
|          | ||
| altDefaults: | ||
| - type: ALTERNATE_TYPE_DC | ||
| value: default | ||
| timeouts: | ||
| name: timeouts | ||
| title: Timeouts | ||
|  | @@ -989,6 +1009,12 @@ spec: | |
| workload_identity_config: | ||
| name: workload_identity_config | ||
| title: Workload Identity Config | ||
| properties: | ||
| workload_pool: | ||
| name: workload_pool | ||
| title: Workload Pool | ||
| regexValidation: ^.+\.svc\.id\.goog$ | ||
| validation: Workload pool must be in the format <project_id>.svc.id.goog. | ||
|          | ||
| runtime: | ||
| outputs: | ||
| cluster_id: | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex for CIDR validation is very complex and contains an inconsistency. It allows optional whitespace (
\s*) for IPv6 CIDRs, both at the beginning of the string and before the/, but not for IPv4 CIDRs. For consistency and stricter validation, it's better to remove the whitespace allowance from the IPv6 part.regexValidation: ^((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[12]?[0-9]))|((((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0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