Skip to content

[F-20] fix(bup,sync): add return-value checks on external script system() calls#140

Merged
adequatelimited merged 1 commit intoaudit-fixesfrom
audit/F-20-external-script-checks
Apr 6, 2026
Merged

[F-20] fix(bup,sync): add return-value checks on external script system() calls#140
adequatelimited merged 1 commit intoaudit-fixesfrom
audit/F-20-external-script-checks

Conversation

@adequatelimited
Copy link
Copy Markdown
Collaborator

Closes #109

Summary

The two external script hooks — ../update-external.sh (called on every block update) and ../init-external.sh (called after resync) — had no return-value checks on their system() calls. A failed script was silently ignored.

Change

Added system() != 0 check with pwarn() logging at both sites. The scripts remain invoked via system() since their purpose is to run external programs.

// Before
system("../update-external.sh");

// After
if (system("../update-external.sh") != 0) {
   pwarn("../update-external.sh returned error");
}

The relative path and fexists() pre-check are unchanged — the audit noted these as concerns, but they are by-design (the scripts are optional hooks located relative to the node's working directory).

Testing

  • Clean build with -Wall -Werror -Wextra -Wpedantic

Closes #109

system() calls to ../update-external.sh and ../init-external.sh
had no return-value checks. A failed or erroring script was
silently ignored. Added checks and pwarn() logging on non-zero
return so failures are visible in the node log.
@adequatelimited
Copy link
Copy Markdown
Collaborator Author

Last two system() calls in the codebase, we'll at least check the return codes to make sure they did what we wanted, or log a warning if they didn't. Merging.

@adequatelimited adequatelimited merged commit 606d0c6 into audit-fixes Apr 6, 2026
4 of 5 checks passed
@adequatelimited adequatelimited deleted the audit/F-20-external-script-checks branch April 13, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant