Fix DEP check false positives for detect_control_panel
detect_control_panel is in system-detect.sh, not domain-discovery.sh Check now properly validates that system-detect.sh is sourced
This commit is contained in:
@@ -1845,10 +1845,6 @@ while IFS=: read -r file line_num line_content; do
|
|||||||
|
|
||||||
if [[ "$func_used" =~ (print_|confirm_action) ]]; then
|
if [[ "$func_used" =~ (print_|confirm_action) ]]; then
|
||||||
required_lib="common-functions.sh"
|
required_lib="common-functions.sh"
|
||||||
else
|
|
||||||
required_lib="domain-discovery.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -q "source.*$required_lib" "$file" 2>/dev/null; then
|
if ! grep -q "source.*$required_lib" "$file" 2>/dev/null; then
|
||||||
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing $required_lib"
|
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing $required_lib"
|
||||||
echo " Risk: Function undefined error at runtime"
|
echo " Risk: Function undefined error at runtime"
|
||||||
@@ -1857,6 +1853,28 @@ while IFS=: read -r file line_num line_content; do
|
|||||||
((count++))
|
((count++))
|
||||||
[ "$count" -ge 10 ] && break
|
[ "$count" -ge 10 ] && break
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$func_used" =~ detect_control_panel ]]; then
|
||||||
|
# detect_control_panel is in system-detect.sh
|
||||||
|
if ! grep -q "source.*system-detect\.sh" "$file" 2>/dev/null; then
|
||||||
|
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing system-detect.sh"
|
||||||
|
echo " Risk: Function undefined error at runtime"
|
||||||
|
echo " Fix: Add 'source \$(dirname \$0)/../lib/system-detect.sh' at top of script"
|
||||||
|
count_issue "HIGH"
|
||||||
|
((count++))
|
||||||
|
[ "$count" -ge 10 ] && break
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Domain/user functions are in domain-discovery.sh
|
||||||
|
required_lib="domain-discovery.sh"
|
||||||
|
if ! grep -q "source.*$required_lib" "$file" 2>/dev/null; then
|
||||||
|
echo "HIGH|$file|$line_num|[DEP] Using $func_used without sourcing $required_lib"
|
||||||
|
echo " Risk: Function undefined error at runtime"
|
||||||
|
echo " Fix: Add 'source \$(dirname \$0)/../lib/$required_lib' at top of script"
|
||||||
|
count_issue "HIGH"
|
||||||
|
((count++))
|
||||||
|
[ "$count" -ge 10 ] && break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done < <(grep -rnE "\b($common_funcs|$detect_funcs)\b" "$TOOLKIT_PATH" --include="*.sh" --exclude="common-functions.sh" --exclude="domain-discovery.sh" --exclude="system-detect.sh" 2>/dev/null | head -100)
|
done < <(grep -rnE "\b($common_funcs|$detect_funcs)\b" "$TOOLKIT_PATH" --include="*.sh" --exclude="common-functions.sh" --exclude="domain-discovery.sh" --exclude="system-detect.sh" 2>/dev/null | head -100)
|
||||||
|
|
||||||
echo "Found: $count missing function dependencies"
|
echo "Found: $count missing function dependencies"
|
||||||
|
|||||||
Reference in New Issue
Block a user