fix: ignore default .env probe on permission denied - #925
Conversation
The default .env lookup is an implicit convenience, not something the user asked for. When the working directory denies even probing for it (EACCES on stat — e.g. sudo -u other-user with a 0700 home as cwd), warn and skip the default instead of failing the whole command. Only os.IsPermission is softened, and only for the implicit default: any other stat failure stays fatal, and an explicit env file behind the same permission wall still errors in WithDotEnv. Fixes docker/compose#14166 Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
|
I'm not 100% sure if this is correct though; running with a different user, then skipping Given that there's already an escape hatch through the env-var, I'm not sure if we should do this. |
|
(and the correct mitigation would be to |
This is also true if you run from the wrong folder, or any comparable situation where the target environment is set by |
The default
.envlookup is an implicit convenience, not something the user asked for. When the working directory denies even probing for it (EACCES on stat — e.g.sudo -u other-userwith a 0700 home as cwd), warn and skip the default instead of failing the whole command.Conservative scope: only
os.IsPermissionis softened, and only for the implicit default — any other stat failure stays fatal, and an explicit env file behind the same permission wall still errors inWithDotEnv.Fixes docker/compose#14166
🤖 Generated with Claude Code