Skip to content

Commit f5d5c82

Browse files
committed
fix: Check pickle usage
1 parent b06700d commit f5d5c82

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/DIRAC/Interfaces/Utilities/DConfigCache.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import re
44
import time
5-
import pickle
5+
import pickle # nosec: B403
66
import tempfile
77

88
from DIRAC import gLogger
@@ -69,7 +69,8 @@ def cacheConfig(self):
6969
else:
7070
try:
7171
with open(self.configCacheName, "rb") as fh:
72-
gConfigurationData.mergedCFG = pickle.load(fh)
72+
# Pickle files are cached locally, so should be safe
73+
gConfigurationData.mergedCFG = pickle.load(fh) # nosec: B301
7374
reset_all_caches()
7475
except:
7576
gLogger.error("Cache corrupt or unreadable")

src/DIRAC/TransformationSystem/Agent/TransformationAgent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import time
1515
import os
1616
import datetime
17-
import pickle
17+
import pickle # nosec: B403
1818
import concurrent.futures
1919
from pathlib import Path
2020

@@ -672,7 +672,8 @@ def __readCache(self, transID):
672672
self.replicaCache[transID] = {}
673673
else:
674674
with open(fileName, "rb") as cacheFile:
675-
self.replicaCache[transID] = pickle.load(cacheFile)
675+
# Pickle files are only written locally, so should be safe
676+
self.replicaCache[transID] = pickle.load(cacheFile) # nosec: B301
676677
self._logInfo(
677678
"Successfully loaded replica cache from file %s (%d files)"
678679
% (fileName, self.__filesInCache(transID)),

0 commit comments

Comments
 (0)