Mitigated possible directory escape scenario

pull/6/head
Illia Chub 2021-11-30 07:10:00 +02:00
parent fb98fd1e60
commit d1fdaf186d
1 changed files with 5 additions and 1 deletions

View File

@ -31,8 +31,10 @@ class PullRepositoryChanges(Resource):
git_pull_command = ["git", "pull"]
current_working_directory = os.getcwd()
os.chdir("/etc/nixos")
git_pull_process_descriptor = subprocess.Popen(
git_pull_command,
stdout=subprocess.PIPE,
@ -43,6 +45,8 @@ class PullRepositoryChanges(Resource):
git_pull_process_descriptor.communicate()[0]
os.chdir(current_working_directory)
if git_pull_process_descriptor.returncode == 0:
return {
"status": 0,