You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hook commands are logged in full, including at WARN, so a token in one reaches the logfile #35
A hook command is written to the log in full, at DEBUG when it is spawned and again when it is reaped — and at WARN, the default level, whenever it fails. A hook command is an arbitrary shell line, so it routinely carries the thing that must not be logged: a bearer token in a curl -H, a signed webhook URL, an API key in a query string.
The lines, all in src/hooks.cpp:
run() — Running %s hook [%d]: %s at DEBUG (:152-153).
poll() — The %s hook could not be waited on (%s): %s at DEBUG (:180-181).
poll() — The %s hook exited %d: %s at WARN (:184-185).
poll() — The %s hook was killed by signal %d: %s at WARN (:187-188).
poll() — The %s hook finished: %s at DEBUG (:190-191).
The two WARN lines are the sharp end: they need no -L debug, so an ordinary run of a hook that exits non-zero puts the credential in the logfile — which under -f is a file on disk, and often one a supervisor ships elsewhere.
What the lines are actually for is answered without the command. The event name and the pid identify which hook this is (there are only two, start and stop, and the pid disambiguates repeats), and the exit status or signal is the diagnosis. The command itself is already known to whoever set it: it is in the flag or the config file.
Suggested shape: log event and pid plus the status, and drop %s: command from all five lines. If the command is genuinely wanted for debugging, it belongs behind an explicit opt-in rather than at DEBUG, since DEBUG is a level an operator turns on to chase an unrelated problem.
Raised by Copilot on #31 against src/hooks.cpp:109 and :129; the code is #28's, so it belongs here rather than on that PR.
Activity