Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/scripts/init/defaults/system_defaults_arm
Original file line number Diff line number Diff line change
Expand Up @@ -1497,3 +1497,5 @@ $FwDwld_AvlMem_RsrvThreshold=20
#FwDwld_ImageProcMemPercent Default value
$FwDwld_ImageProcMemPercent=0

#SelfHeal Cron - RFC flag is enabled by default
$SelfHealCronEnable=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve the merge conflict , also add this to bci and xle system defaults file.

3 changes: 3 additions & 0 deletions source/scripts/init/defaults/system_defaults_bci
Original file line number Diff line number Diff line change
Expand Up @@ -1346,3 +1346,6 @@ $FwDwld_AvlMem_RsrvThreshold=20

#FwDwld_ImageProcMemPercent Default value
$FwDwld_ImageProcMemPercent=0

#SelfHeal Cron - RFC flag is enabled by default
$SelfHealCronEnable=true
35 changes: 33 additions & 2 deletions source/scripts/init/service.d/service_crond.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,44 @@ service_start ()
# Don't Zero iptable Counter
echo "58 * * * * /usr/bin/GenFWLog -nz" >> $CRONTAB_FILE

# Monitor syscfg DB every 15minutes
echo "*/15 * * * * /usr/ccsp/tad/syscfg_recover.sh" >> $CRONTAB_FILE
SELFHEAL_CRON_ENABLE=$(syscfg get SelfHealCronEnable)
SELFHEAL_ENABLE=$(syscfg get selfheal_enable)
if [ "$SELFHEAL_CRON_ENABLE" = "true" ] && [ "$SELFHEAL_ENABLE" = "true" ]; then
echo_t "SelfHeal Cron is enabled"
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses a tab character at the start, while the surrounding code in this file consistently uses spaces for indentation. The echo_t statements should align with the indentation style used elsewhere in the file, which appears to be 3 spaces for statements inside if blocks.

Copilot uses AI. Check for mistakes.
# Monitor selfheal_aggressive.sh based on syscfg value
AGGRESSIVE_INTERVAL=$(syscfg get AggressiveInterval)
if [ -z "$AGGRESSIVE_INTERVAL" ]; then
AGGRESSIVE_INTERVAL=5
fi
#Write cron rule
echo "*/$AGGRESSIVE_INTERVAL * * * * /usr/ccsp/tad/selfheal_aggressive.sh" >> $CRONTAB_FILE

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo statements should align with the indentation style used elsewhere in the file.

Copilot uses AI. Check for mistakes.
# Monitor resource_monitor.sh based on syscfg value
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. Comment lines should follow the same indentation pattern as the rest of the file.

Suggested change
# Monitor resource_monitor.sh based on syscfg value
# Monitor resource_monitor.sh based on syscfg value

Copilot uses AI. Check for mistakes.
RESOURCE_MONITOR_INTERVAL=$(syscfg get resource_monitor_interval)
if [ -z "$RESOURCE_MONITOR_INTERVAL" ]; then
RESOURCE_MONITOR_INTERVAL=15
fi
echo "*/$RESOURCE_MONITOR_INTERVAL * * * * /usr/ccsp/tad/resource_monitor.sh" >> $CRONTAB_FILE

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. Line 187 uses spaces for indentation but line 188 uses tabs and extra spaces. The echo statement should align with the indentation style used elsewhere in the file, which appears to use spaces consistently.

Suggested change

Copilot uses AI. Check for mistakes.
# Monitor self_heal_connectivity_test.sh based on syscfg value
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing inconsistency in comment. There appears to be extra whitespace after "syscfg value". This comment should have consistent spacing with other similar comments in the block.

Suggested change
# Monitor self_heal_connectivity_test.sh based on syscfg value
# Monitor self_heal_connectivity_test.sh based on syscfg value

Copilot uses AI. Check for mistakes.
SELFHEAL_PING_INTERVAL=$(syscfg get ConnTest_PingInterval)
if [ -z "$SELFHEAL_PING_INTERVAL" ]; then
SELFHEAL_PING_INTERVAL=60
fi
echo "*/$SELFHEAL_PING_INTERVAL * * * * /usr/ccsp/tad/self_heal_connectivity_test.sh" >> $CRONTAB_FILE
Comment on lines +175 to +194
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cron entries for selfheal_aggressive.sh, resource_monitor.sh, and self_heal_connectivity_test.sh are built directly from syscfg values (AggressiveInterval, resource_monitor_interval, ConnTest_PingInterval) without validating that they are numeric, so a malicious value containing spaces or additional fields can inject an arbitrary command into the crontab line and be executed as root. For example, if an attacker can set AggressiveInterval via any remote or untrusted configuration path to include extra cron fields and a custom command, the resulting echoed line will cause cron to run that attacker-controlled command instead of the intended script. Restrict these intervals to a safe numeric range (e.g., via a regex or arithmetic check) before use, and reject or sanitize any value that is not purely numeric to prevent cron injection.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected after the cron rule. The line should end immediately after CRONTAB_FILE without any trailing spaces or tabs, for consistency with other cron entries in the file.

Copilot uses AI. Check for mistakes.
echo_t "Selfheal cron jobs are started"
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo_t statement should align with the indentation style used elsewhere in the file.

Copilot uses AI. Check for mistakes.

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected. The line should not have any spaces or tabs after the closing quote, for consistency with other lines in the file.

Copilot uses AI. Check for mistakes.
else
echo_t "Selfheal cron is disabled"
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo_t statement should align with the indentation style used elsewhere in the file.

Copilot uses AI. Check for mistakes.
# Monitor syscfg DB every 15minutes
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing inconsistency in comment. There appears to be extra whitespace after the comment text. This comment should end immediately after "15minutes" without trailing spaces for consistency with other comments in the file.

Copilot uses AI. Check for mistakes.
echo "*/15 * * * * /usr/ccsp/tad/syscfg_recover.sh" >> $CRONTAB_FILE
Comment on lines +170 to +200
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, syscfg_recover.sh is only scheduled when SelfHeal cron is disabled. If monitoring/recovering the syscfg DB is still required when SelfHeal cron is enabled, this is a behavior change from the previous unconditional cron entry. Consider keeping syscfg_recover.sh scheduled in both modes or explicitly replacing that functionality in the enabled branch.

Copilot uses AI. Check for mistakes.

# Monitor resource_monitor.sh every 5 minutes TCCBR-3288
# if [ "$BOX_TYPE" = "TCCBR" ]; then
echo "*/5 * * * * /usr/ccsp/tad/resource_monitor_recover.sh" >> $CRONTAB_FILE
# fi

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo statement should align with the indentation style used elsewhere in the file.

Copilot uses AI. Check for mistakes.
fi
Comment on lines 202 to +207
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource_monitor_recover.sh cron entry is now inside the else branch, so it will only run when SelfHealCronEnable/selfheal_enable are not both true. Previously this job ran unconditionally; if it’s still required regardless of SelfHeal cron mode, move it (and its comment) outside the conditional or add it to both branches to avoid losing the recovery behavior when SelfHeal cron is enabled.

Suggested change
# Monitor resource_monitor.sh every 5 minutes TCCBR-3288
# if [ "$BOX_TYPE" = "TCCBR" ]; then
echo "*/5 * * * * /usr/ccsp/tad/resource_monitor_recover.sh" >> $CRONTAB_FILE
# fi
fi
fi
# Monitor resource_monitor.sh every 5 minutes TCCBR-3288
# if [ "$BOX_TYPE" = "TCCBR" ]; then
echo "*/5 * * * * /usr/ccsp/tad/resource_monitor_recover.sh" >> $CRONTAB_FILE
# fi

Copilot uses AI. Check for mistakes.

# RDKB-23651
if [ "$THERMALCTRL_ENABLE" = "true" ]; then
Expand Down
Loading