Add parameter validation to 6 more functions + QA improvements
PARAMETER VALIDATION FIXES (6 functions):
1. lib/common-functions.sh:219 - format_duration()
2. lib/php-detector.sh:277 - get_fpm_process_count()
3. lib/user-manager.sh:263 - get_plesk_user_domains()
4. modules/performance/hardware-health-check.sh:44 - add_finding()
5. modules/performance/hardware-health-check.sh:55 - command_exists()
6. modules/performance/network-bandwidth-analyzer.sh:45 - add_finding()
7. modules/performance/network-bandwidth-analyzer.sh:56 - command_exists()
All functions now validate required parameters with:
- [ -z "$1" ] && return 1 (single param)
- [ -z "$1" ] || [ -z "$2" ] && return 1 (multiple params)
QA SCRIPT IMPROVEMENTS:
- tools/toolkit-qa-check.sh: Skip $@ / $* passthrough functions
- Added filter for echo/printf functions using only $@ or $*
- Example: cecho() { echo -e "$@" }
- These don't need validation as they passthrough all args
PROGRESS:
- HIGH issues remain at 10 (different ones now)
- Eliminated more false positives
- Next: Fix remaining issues in bot-analyzer.sh
This commit is contained in:
@@ -42,6 +42,7 @@ declare -a FINDINGS=()
|
||||
|
||||
# Function to add finding
|
||||
add_finding() {
|
||||
[ -z "$1" ] || [ -z "$2" ] && return 1
|
||||
local severity="$1"
|
||||
local title="$2"
|
||||
local details="$3"
|
||||
@@ -53,6 +54,7 @@ add_finding() {
|
||||
|
||||
# Function to check if command exists
|
||||
command_exists() {
|
||||
[ -z "$1" ] && return 1
|
||||
command -v "$1" &>/dev/null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user