fix(xcatd): redact secrets in the commands.log response
xcatd redacts the request in commands.log but appends the command response verbatim. A command whose output holds a secret writes it in clear text. Examples are tabdump passwd, gettab of a passwd column, and getcredentials. Collect the response into a per-command buffer. Set a sensitive flag when the command is getcredentials, an argument names a password, or the request was redacted. When the command finishes, replace the whole buffer if the flag is set or the buffer still holds password content, then append the buffer. A connection can carry more than one command, so the buffer is finalized at the next command's start and at the end of the connection. The buffer holds the full response, so a secret split across several callbacks is also redacted. A per-callback check cannot do this. The word-content check is a fallback. The request classification is the main signal. A secret with no password marker, such as the output of an xdsh cat of a shadow file, is a pre-existing leak of the root-only log. It is out of scope. Recovered from the lenovobuild branch. Reimplemented against master.
V
Vinícius Ferrão committed
eda5c35bbae1e09b065de75d879b7de04bdd014a
Parent: 91505a2