[PR #5291] [MERGED] [core]: add validation and replace recursion for invalid inputs in adv. settings #5437

Closed
opened 2026-02-26 14:34:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/5291
Author: @MickLesk
Created: 6/19/2025
Status: Merged
Merged: 6/19/2025
Merged by: @michelroegl-brunner

Base: mainHead: improve_validate_checks


📝 Commits (1)

  • cd24b7f Add hostname validation and replace recursion for invalid inputs in advanced settings

📊 Changes

1 file changed (+50 additions, -31 deletions)

View changed files

📝 misc/build.func (+50 -31)

📄 Description

✍️ Description

This PR improves the robustness of the interactive LXC configuration (advanced_settings) by:

  • Adding strict validation for the hostname (RFC 1123 compliant):
    • Only lowercase letters, digits, and hyphens (-) are allowed.
    • Underscores (_) and invalid start/end characters are rejected.
  • Replacing recursive re-entry of advanced_settings() with inline while-loops for:
    • DISK_SIZE
    • CORE_COUNT
    • RAM_SIZE
  • 🧠 Prevents unnecessary stack growth and infinite loops when users input invalid data.
  • 🔁 Ensures only the specific invalid field is re-entered, not the entire menu.

This change increases stability, correctness, and user experience when using advanced container setup options.

image
image
image
image

Link: #5290 #5245

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/5291 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 6/19/2025 **Status:** ✅ Merged **Merged:** 6/19/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `improve_validate_checks` --- ### 📝 Commits (1) - [`cd24b7f`](https://github.com/community-scripts/ProxmoxVE/commit/cd24b7fac912ae619cf4204412ab493ac100a50f) Add hostname validation and replace recursion for invalid inputs in advanced settings ### 📊 Changes **1 file changed** (+50 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `misc/build.func` (+50 -31) </details> ### 📄 Description ## ✍️ Description This PR improves the robustness of the interactive LXC configuration (advanced_settings) by: - ✅ Adding strict validation for the hostname (RFC 1123 compliant): - Only lowercase letters, digits, and hyphens (-) are allowed. - Underscores (_) and invalid start/end characters are rejected. - ✅ Replacing recursive re-entry of advanced_settings() with inline while-loops for: - DISK_SIZE - CORE_COUNT - RAM_SIZE - 🧠 Prevents unnecessary stack growth and infinite loops when users input invalid data. - 🔁 Ensures only the specific invalid field is re-entered, not the entire menu. This change increases stability, correctness, and user experience when using advanced container setup options. ![image](https://github.com/user-attachments/assets/765e26ec-7384-4fd6-a8e5-1d81a1d0424c) ![image](https://github.com/user-attachments/assets/c875bbfa-8187-40b7-89f3-f05e631162b1) ![image](https://github.com/user-attachments/assets/8e19cd40-1884-45b3-873f-e8c873c9cd66) ![image](https://github.com/user-attachments/assets/15931b99-880b-4be0-a71a-f00b456234c0) ## 🔗 Related PR / Issue Link: #5290 #5245 ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **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 14:34:09 +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#5437
No description provided.