dd55365dee
* os: (WinOS) mimic current practices of `busybox` and `coreutils` * os: trim any possible surounding whitespace |
||
---|---|---|
.. | ||
bare | ||
cmdline | ||
filelock | ||
font | ||
notify | ||
args.v | ||
const_nix.c.v | ||
const_windows.c.v | ||
const.v | ||
dir_expansions_test.v | ||
environment_test.v | ||
environment.c.v | ||
environment.js.v | ||
fd.c.v | ||
file_test.v | ||
file.c.v | ||
file.js.v | ||
filepath_test.v | ||
filepath_windows.v | ||
filepath.v | ||
find_abs_path_of_executable_test.v | ||
glob_test.v | ||
inode_test.v | ||
inode.c.v | ||
open_uri_default.c.v | ||
open_uri_windows.c.v | ||
os_android_outside_termux.c.v | ||
os_darwin.c.v | ||
os_js.js.v | ||
os_linux.c.v | ||
os_nix.c.v | ||
os_structs_dirent_default.c.v | ||
os_structs_sigaction_default.c.v | ||
os_structs_stat_default.c.v | ||
os_structs_stat_linux.c.v | ||
os_structs_utsname_default.c.v | ||
os_test.v | ||
os_windows.c.v | ||
os.c.v | ||
os.js.v | ||
os.v | ||
password_nix.c.v | ||
password_windows.c.v | ||
process_nix.c.v | ||
process_test.v | ||
process_windows.c.v | ||
process.c.v | ||
process.js.v | ||
process.v | ||
README.md | ||
signal_test.v | ||
signal.c.v | ||
signal.js.v | ||
signal.v |
Description:
os
provides common OS/platform independent functions for accessing
command line arguments, reading/writing files, listing folders,
handling processes etc.
Security advice related to TOCTOU attacks
A few os
module functions can lead to the TOCTOU vulnerability if used incorrectly.
TOCTOU (Time-of-Check-to-Time-of-Use problem) can occur when a file, folder or similar
is checked for certain specifications (e.g. read, write permissions) and a change is made
afterwards.
In the time between the initial check and the edit, an attacker can then cause damage.
The following example shows an attack strategy on the left and an improved variant on the right
so that TOCTOU is no longer possible.
Example
Hint: os.create()
opens a file in write-only mode
Possibility for TOCTOU attack
|
TOCTOU not possible
|
Proven affected functions
The following functions should be used with care and only when used correctly.
- os.is_readable()
- os.is_writable()
- os.is_executable()
- os.is_link()