[PR #10995] [MERGED] core: add input validations for several functions #9160

Closed
opened 2026-02-26 16:35:21 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/10995
Author: @MickLesk
Created: 1/20/2026
Status: Merged
Merged: 1/20/2026
Merged by: @tremor021

Base: mainHead: core_validations


📝 Commits (3)

  • f657c04 feat(build): add comprehensive input validation for advanced settings
  • dfc1864 feat(build): add validation to load_vars_file for default.vars/app.vars
  • 8bae2c0 Update RAM validation to require at least 256 MiB

📊 Changes

1 file changed (+475 additions, -40 deletions)

View changed files

📝 misc/build.func (+475 -40)

📄 Description

✍️ Description

Feat 1 - Advanced Settings:

  • validate_mac_address(): MAC format XX:XX:XX:XX:XX:XX
  • validate_vlan_tag(): VLAN range 1-4094
  • validate_mtu(): MTU range 576-65535
  • validate_ipv6_address(): IPv6 with CIDR, supports :: compression
  • validate_bridge(): Check bridge interface exists via ip link
  • validate_gateway_in_subnet(): Verify gateway in same subnet as IP
  • validate_ip_address(): IPv4 CIDR with octet validation (0-255)
  • validate_gateway_ip(): Gateway IP without CIDR notation
  • validate_timezone(): Validate against /usr/share/zoneinfo/
  • validate_tags(): Proxmox tags format (alphanumeric, -, _, ;)

Feat 2 - User Friendly Error-Texts:
Applied validations to Steps 8-16, 24 with user-friendly error messages.

Feat 3 - Validation for vars (Default.vars / App.vars / or var_-Input before bash)

  • var_mac: MAC address format
  • var_vlan: VLAN range 1-4094
  • var_mtu: MTU range 576-65535
  • var_brg: Bridge must exist
  • var_gateway: Valid gateway IP
  • var_net: dhcp, IP/CIDR, or IP range
  • var_hostname: RFC 1123 compliant
  • var_cpu: 1-128 cores
  • var_ram: >= 256 MiB
  • var_disk: >= 1 GB
  • var_unprivileged: 0 or 1
  • var_nesting/var_keyctl: 0 or 1
  • var_fuse/tun/gpu/ssh/verbose/protection: yes or no
  • var_ipv6_method: auto/dhcp/static/none
  • var_tags: alphanumeric, -, _, ; only
  • var_timezone: must exist in /usr/share/zoneinfo/

Invalid values are ignored with warning, using defaults instead.

Fixes #

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/10995 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 1/20/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@tremor021](https://github.com/tremor021) **Base:** `main` ← **Head:** `core_validations` --- ### 📝 Commits (3) - [`f657c04`](https://github.com/community-scripts/ProxmoxVE/commit/f657c044d4a461da252c560b09c30f75a45d5c7b) feat(build): add comprehensive input validation for advanced settings - [`dfc1864`](https://github.com/community-scripts/ProxmoxVE/commit/dfc1864db736095ee7ae4fe824ac12d0b3c7ffbf) feat(build): add validation to load_vars_file for default.vars/app.vars - [`8bae2c0`](https://github.com/community-scripts/ProxmoxVE/commit/8bae2c0590d0b60c602983102db8efba70885a4c) Update RAM validation to require at least 256 MiB ### 📊 Changes **1 file changed** (+475 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `misc/build.func` (+475 -40) </details> ### 📄 Description <!--🛑 New scripts must be submitted to [ProxmoxVED](https://github.com/community-scripts/ProxmoxVED) for testing. PRs without prior testing will be closed. --> ## ✍️ Description Feat 1 - Advanced Settings: - validate_mac_address(): MAC format XX:XX:XX:XX:XX:XX - validate_vlan_tag(): VLAN range 1-4094 - validate_mtu(): MTU range 576-65535 - validate_ipv6_address(): IPv6 with CIDR, supports :: compression - validate_bridge(): Check bridge interface exists via ip link - validate_gateway_in_subnet(): Verify gateway in same subnet as IP - validate_ip_address(): IPv4 CIDR with octet validation (0-255) - validate_gateway_ip(): Gateway IP without CIDR notation - validate_timezone(): Validate against /usr/share/zoneinfo/ - validate_tags(): Proxmox tags format (alphanumeric, -, _, ;) Feat 2 - User Friendly Error-Texts: Applied validations to Steps 8-16, 24 with user-friendly error messages. Feat 3 - Validation for vars (Default.vars / App.vars / or var_-Input before bash) - var_mac: MAC address format - var_vlan: VLAN range 1-4094 - var_mtu: MTU range 576-65535 - var_brg: Bridge must exist - var_gateway: Valid gateway IP - var_net: dhcp, IP/CIDR, or IP range - var_hostname: RFC 1123 compliant - var_cpu: 1-128 cores - var_ram: >= 256 MiB - var_disk: >= 1 GB - var_unprivileged: 0 or 1 - var_nesting/var_keyctl: 0 or 1 - var_fuse/tun/gpu/ssh/verbose/protection: yes or no - var_ipv6_method: auto/dhcp/static/none - var_tags: alphanumeric, -, _, ; only - var_timezone: must exist in /usr/share/zoneinfo/ Invalid values are ignored with warning, using defaults instead. ## 🔗 Related Issue Fixes # ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [ ] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [x] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [ ] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 16:35:21 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#9160
No description provided.