eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/generalHardcodedTmp.py

changeset 7615
ca2949b1a29a
parent 7614
646742c260bd
child 7923
91e843545d9a
equal deleted inserted replaced
7614:646742c260bd 7615:ca2949b1a29a
11 # This is a modified version of the one found in the bandit package. 11 # This is a modified version of the one found in the bandit package.
12 # 12 #
13 # Original Copyright 2014 Hewlett-Packard Development Company, L.P. 13 # Original Copyright 2014 Hewlett-Packard Development Company, L.P.
14 # 14 #
15 # SPDX-License-Identifier: Apache-2.0 15 # SPDX-License-Identifier: Apache-2.0
16 # 16 #...r\Security\Checks\generalHardcodedTmp.py
17
18 from Security.SecurityDefaults import SecurityDefaults
17 19
18 20
19 def getChecks(): 21 def getChecks():
20 """ 22 """
21 Public method to get a dictionary with checks handled by this module. 23 Public method to get a dictionary with checks handled by this module.
43 @type dict 45 @type dict
44 """ 46 """
45 if config and "hardcoded_tmp_directories" in config: 47 if config and "hardcoded_tmp_directories" in config:
46 tmpDirs = config["hardcoded_tmp_directories"] 48 tmpDirs = config["hardcoded_tmp_directories"]
47 else: 49 else:
48 tmpDirs = ["/tmp", "/var/tmp", "/dev/shm", "~/tmp"] 50 tmpDirs = SecurityDefaults["hardcoded_tmp_directories"]
49 51
50 if any(context.stringVal.startswith(s) for s in tmpDirs): 52 if any(context.stringVal.startswith(s) for s in tmpDirs):
51 reportError( 53 reportError(
52 context.node.lineno - 1, 54 context.node.lineno - 1,
53 context.node.col_offset, 55 context.node.col_offset,

eric ide

mercurial