@@ -175,7 +175,6 @@ _scan_hook_build_env() {
175175 fi
176176 fi
177177
178- # Export LMD_* variables into current process env for hook inheritance
179178 export LMD_SCAN_TYPE=" $_scan_type "
180179 export LMD_SCANID=" ${scanid:- } "
181180 export LMD_HITS=" $_hits "
@@ -291,15 +290,13 @@ _scan_hook_exec_sync() {
291290 local _scan_type=" $3 "
292291 local _json_stdin=" $4 "
293292
294- # Discover timeout command at dispatch time
295293 local _timeout_cmd
296294 _timeout_cmd=$( command -v timeout 2> /dev/null) || _timeout_cmd=" " # may be absent on minimal installs
297295
298296 if [ -z " $_timeout_cmd " ] && [ " $_timeout " -gt 0 ]; then
299297 eout " {hook} WARNING: 'timeout' command not found; hook will run without timeout protection"
300298 fi
301299
302- # Build positional arguments: $1=SCANID $2=HITS $3=FILES $4=EXIT_CODE $5=SCAN_TYPE $6=PATH
303300 local _hook_hits=" ${tot_hits:- 0} "
304301 case " $_scan_type " in
305302 digest)
@@ -326,7 +323,6 @@ _scan_hook_exec_sync() {
326323 " ${hrspath:- } "
327324 )
328325
329- # Set LMD_* env and clear sensitive vars before executing
330326 _scan_hook_build_env " $_scan_type "
331327
332328 # Capture stderr for diagnostics on non-zero exit
@@ -367,7 +363,6 @@ _scan_hook_exec_sync() {
367363 fi
368364 fi
369365
370- # Log result and fire elog event
371366 if [ " $_hook_rc " -eq 124 ]; then
372367 eout " {hook} post-scan hook timeout after ${_timeout} s: $_hook_path "
373368 _lmd_elog_event " ${ELOG_EVT_HOOK_TIMEOUT:- hook_timeout} " " warning" \
@@ -385,7 +380,6 @@ _scan_hook_exec_sync() {
385380 " hook completed" " hook=$_hook_path " " rc=$_hook_rc "
386381 fi
387382
388- # Clean up temp stderr file
389383 [ -f " ${_stderr_tmp:- } " ] && command rm -f " $_stderr_tmp " # temp cleanup; ignore error if already removed
390384
391385 return " $_hook_rc "
@@ -477,7 +471,6 @@ _scan_hook_exec_async() {
477471 # Replace subshell fds: prevents inherited pipe fds from blocking the parent
478472 exec > /dev/null 2>&1
479473
480- # Export all LMD_* env vars using snapshotted values
481474 export LMD_SCAN_TYPE=" $_scan_type "
482475 export LMD_SCANID=" $_snap_scanid "
483476 export LMD_HITS=" $_snap_hits "
@@ -495,7 +488,6 @@ _scan_hook_exec_async() {
495488 export LMD_MONITOR_UPTIME=" 0"
496489 export LMD_HOOK_HITS=" $_snap_hits "
497490
498- # Clear sensitive credential variables
499491 unset slack_token smtp_pass smtp_user telegram_bot_token
500492 unset discord_webhook_url elk_host ALERT_SMTP_PASS ALERT_SMTP_USER
501493
@@ -568,20 +560,17 @@ _scan_hook_dispatch() {
568560 _exec=" async"
569561 fi
570562
571- # Build optional JSON for json format tier
572563 local _format=" ${post_scan_hook_format:- args} "
573564 local _json_stdin=" "
574565 if [ " $_format " = " json" ]; then
575566 _json_stdin=$( _scan_hook_build_json " $_scan_type " )
576567 fi
577568
578- # Log dispatch and fire elog event
579569 eout " {hook} ${_hook_type} -scan hook started: $_hook ($_exec , $_format )" 1
580570 _lmd_elog_event " ${ELOG_EVT_HOOK_STARTED:- hook_started} " " info" \
581571 " hook started" \
582572 " hook=$_hook " " type=$_scan_type " " exec=$_exec " " format=$_format "
583573
584- # Route to sync or async executor
585574 if [ " $_exec " = " sync" ]; then
586575 _scan_hook_exec_sync " $_hook " " $_timeout " " $_scan_type " " $_json_stdin "
587576 else
0 commit comments