mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-22 21:16:29 +02:00
file persistance fix
This commit is contained in:
parent
a6bc24e22e
commit
3bd73d07a9
3 changed files with 59 additions and 6 deletions
25
tests/file_persistance.py
Normal file
25
tests/file_persistance.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""
|
||||
Description
|
||||
Files can be written into world writable directories without being removed,
|
||||
potentially leading to disk space exhaustion
|
||||
|
||||
Run this test twice and there should be no output
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
directories = [
|
||||
"/dev/shm",
|
||||
"/run/lock",
|
||||
"/tmp",
|
||||
"/var/tmp"
|
||||
]
|
||||
|
||||
for dir in directories:
|
||||
fpath = f"{dir}/bean"
|
||||
if os.path.exists(fpath):
|
||||
print(f"{fpath} exists")
|
||||
else:
|
||||
with open(fpath, "w") as f:
|
||||
f.write("beannn")
|
Loading…
Add table
Add a link
Reference in a new issue