Commit fbeacd8
Set default config file permissions after renaming (#2184)
* Set default config file permissions after renaming
Add permission change for the updated config file
* Use os.open with restricted permissions from file creation
Replace open()+chmod approach with os.open() using O_CREAT|O_TRUNC
and mode 0o400 to ensure the temp config file is never temporarily
world-readable. Wraps fd with os.fdopen for safe writing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Guard fd close if os.fdopen fails
os.fdopen takes ownership of the fd, so the with-statement handles
closing on normal/write-error paths. Add explicit os.close for the
rare case where os.fdopen itself raises before taking ownership.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 09727a9 commit fbeacd8
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
967 | 967 | | |
968 | 968 | | |
969 | 969 | | |
970 | | - | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
971 | 977 | | |
972 | 978 | | |
973 | 979 | | |
974 | 980 | | |
975 | 981 | | |
976 | 982 | | |
977 | | - | |
| 983 | + | |
978 | 984 | | |
979 | 985 | | |
980 | 986 | | |
| |||
0 commit comments