Fix 3 HIGH issues with parameter validation + QA improvements
PARAMETER VALIDATION FIXES (3 functions):
1. lib/common-functions.sh:238 - command_exists()
- Added [ -z "$1" ] && return 1
2. lib/php-detector.sh:284 - get_fpm_memory_usage()
- Added [ -z "$1" ] && return 1
3. lib/user-manager.sh:271 - get_interworx_user_domains()
- Added [ -z "$1" ] && return 1
QA SCRIPT IMPROVEMENTS:
- tools/toolkit-qa-check.sh: Filter out AWK/sed field references
- Problem: $1 in awk '{print $1}' was detected as bash parameter
- Solution: grep -v 'awk\|sed' before checking for $1-9
- Impact: Eliminates 7 false positives from functions with no params
FALSE POSITIVES ELIMINATED:
- is_server_stressed() - $1 was from awk command
- calculate_server_memory_capacity() - $2 was from awk command
- calculate_balanced_memory_allocation() - $2 was from awk command
- list_cpanel_users() - no parameters
- list_interworx_users() - no parameters
- list_system_users() - no parameters
- press_enter() - $1 was from neighboring function
IMPACT:
HIGH issues: 10 → 10 (fixed 3, eliminated 7 FPs, but 10 new remain)
Need to improve QA script further to extract exact function bodies
This commit is contained in:
@@ -282,6 +282,7 @@ get_fpm_process_count() {
|
||||
|
||||
# Get memory usage per FPM process for a pool
|
||||
get_fpm_memory_usage() {
|
||||
[ -z "$1" ] && return 1
|
||||
local pool_name="$1"
|
||||
|
||||
# Get average memory per process (in KB)
|
||||
|
||||
Reference in New Issue
Block a user