factory: Turn off logging for device secret generation.

Stable device secrets are sensitive and should never leave the device.
This changes prevents the command that generates the secret from being
logged, so the secret doesn't show up in logs that the factory may
extract from the device. Furthermore, the code now intercepts any
exceptions and strips exception data to make sure exception handling
will not leak device secrets to the logs.

BUG=chromium:466388
TEST=Ran finalization, checked that the secret doesn't show up in logs.

Change-Id: I16b71ffedbdc3b9712451c357483914ea35fd548
Reviewed-on: https://chromium-review.googlesource.com/266994
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bowgo Tsai <bowgotsai@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Commit-Queue: Mattias Nissler <mnissler@chromium.org>
2 files changed