Skip to content

Commit

Permalink
fix: ensure pilot wrapper decompresses files securely (including prox…
Browse files Browse the repository at this point in the history
…ies)
  • Loading branch information
fstagni committed Apr 8, 2024
1 parent 71c1e05 commit 635212e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from __future__ import print_function
import os
import io
import stat
import tempfile
import sys
Expand Down Expand Up @@ -174,7 +175,8 @@ def pilotWrapperScript(
for pfName, encodedPf in pilotFilesCompressedEncodedDict.items():
compressedString += """
try:
with open('%(pfName)s', 'wb') as fd:
fd = os.open('%(pfName)s', os.O_WRONLY | os.O_CREAT | os.O_TRUNC, stat.S_IRUSR | stat.S_IWUSR)
with io.open(fd, 'wb') as fd:
if sys.version_info < (3,):
fd.write(bz2.decompress(base64.b64decode(\"\"\"%(encodedPf)s\"\"\")))
else:
Expand Down

0 comments on commit 635212e

Please sign in to comment.