Skip to content

Potential fix for code scanning alert no. 1: Clear-text storage of sensitive information - #15

Open
karlspace wants to merge 1 commit into
mainfrom
fix/password-logging
Open

Potential fix for code scanning alert no. 1: Clear-text storage of sensitive information#15
karlspace wants to merge 1 commit into
mainfrom
fix/password-logging

Conversation

@karlspace

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/bauer-group/XPD-RPIImage/security/code-scanning/1

To fix this without changing overall functionality (users still get configured), stop embedding plaintext passwords in generated files. The best approach here is:

  1. Accept only pre-hashed passwords in config (e.g., $6$... SHA-512 crypt format).
  2. Generate chpasswd -e lines using the hash, not plaintext.
  3. Reject non-hash values early with a clear error message.

In scripts/generate.py, update the user creation block around lines 453–474:

  • Rename/read password field as hash (still from existing password key to avoid schema/functionality break).
  • Validate it looks like a crypt hash (prefix $id$).
  • Replace echo name:pw | chpasswd with echo name:hash | chpasswd -e.
  • Remove the demo-password-expiry check tied to plaintext matching, since plaintext is no longer available in generator output.

No new imports are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…nsitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@karlspace
karlspace marked this pull request as ready for review September 1, 2026 21:18
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