Commit 56e88cb
committed
fix(cli): say so when a rescue password is redirected out of the terminal
CodeQL alert #10 flagged the rescue command printing a freshly generated password as
clear-text logging. It is a false positive and was dismissed as one: the value reaches no
log sink — it is created by auth.RandomPassword, goes to exactly one fmt.Printf, and the
audit row keeps only the action and the login — and printing it to the operator who ran
the command is the command's entire purpose.
That justification has one hole, and this closes it. Redirect stdout and the password
lands in a file or a pipe, where it outlives the moment it was needed and the operator
has no reason to suspect a copy exists. When stdout is not a terminal the output now says
so and tells them to delete it. The credentials are still printed: refusing would break
the escape hatch this command exists to be.
Mutation-checked — removing the warning fails the test.1 parent 435aaed commit 56e88cb
2 files changed
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
754 | 761 | | |
755 | 762 | | |
756 | 763 | | |
757 | 764 | | |
758 | 765 | | |
759 | 766 | | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
760 | 771 | | |
761 | 772 | | |
762 | 773 | | |
763 | 774 | | |
764 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
765 | 786 | | |
766 | 787 | | |
767 | 788 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments