Abhishekmishra2808 commented on code in PR #18396:
URL: https://github.com/apache/nuttx/pull/18396#discussion_r2984093542


##########
boards/Kconfig:
##########
@@ -5423,3 +5423,53 @@ config BOARD_MEMORY_RANGE
                end: end address of memory range
                flags: Executable 0x1, Writable 0x2, Readable 0x4
                
example:{0x1000,0x2000,0x4},{0x2000,0x3000,0x6},{0x3000,0x4000,0x7} ... 
{0x0,0x0,0x0}
+
+config BOARD_ETC_ROMFS_PASSWD_ENABLE
+       bool "Auto-generate /etc/passwd at build time"
+       default n
+       depends on ETC_ROMFS
+       ---help---
+               Generate the /etc/passwd file at build time from a user-supplied
+               password.  This avoids shipping a hard-coded default password
+               (CWE-798).  When enabled, the build will fail if no password
+               is configured, forcing each build to set its own credentials.
+
+               The password is hashed at build time by the host tool
+               tools/mkpasswd (compiled from tools/mkpasswd.c) using the Tiny
+               Encryption Algorithm (TEA) — the same algorithm used at runtime
+               in libs/libc/misc/lib_tea_encrypt.c.  The plaintext password is
+               never stored in the firmware image.
+
+               See Documentation/components/passwd_autogen.rst for details.
+
+if BOARD_ETC_ROMFS_PASSWD_ENABLE
+
+config BOARD_ETC_ROMFS_PASSWD_USER
+       string "Admin username"
+       default "admin"
+       ---help---
+               The username for the auto-generated /etc/passwd entry.
+
+config BOARD_ETC_ROMFS_PASSWD_PASSWORD
+       string "Admin password (required)"
+       default ""

Review Comment:
   I think we can satisfy both points by keeping the behavior but removing 
redundancy: I’ll remove the explicit default "" line (since empty is already 
implicit for string Kconfig symbols), and I’ll keep the fail-fast check when 
passwd autogen is enabled so we still enforce that the user sets a password in 
menuconfig. So we keep the same user-facing behavior, but with cleaner Kconfig 
and less duplicated logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to