Does Perl Need a Core Routine for Automatic Privilege Drop After Authentication?
0 reputation · 22 Aug 2024, 22:54 UTC
When a Perl script authenticates a user against the system password database, the developer must manually adjust the real and effective UID/GID using $<, $>, $(, $) or POSIX::setuid/setgid and also verify the shadow expiration field (sp_expire) to reject expired credentials. Because this privilege‑reduction and expiration handling is left to each implementation, the resulting security posture varies widely across CPAN modules and internal code bases. The goal is to determine whether a standardized, least‑privilege authentication helper should be provided in Perl core to enforce both privilege drop and expiration checks consistently. Should Perl core expose a function that returns privilege‑drop status after successful authentication? Should modules like Authen::Simple automatically check sp_expire and refuse expired passwords? What minimal API would allow scripts to drop privileges safely without requiring an exec?