Package: pylint-secure-coding-standard
Pylint Secure Coding Standard Pluginpylint plugin that enforces some secure coding standards.Installationpip install pylint-secure-coding-standardPylint codesCodeDescriptionR8000Useos.path.realpath()instead ofos.path.abspath()andos.path.relpath()E8001Avoid usingexec()andeval()E8002Avoid usingos.system()E8003Avoid usingshell=Truein subprocess functions or using functions that internally set thisR8004Avoid usingtempfile.mktemp(), prefertempfile.mkstemp()insteadE8005Avoid using unsafe PyYAML loading functionsE8006Avoid usingjsonpickle.decode()C8007Avoid debug statement in production codeC8008Avoidassertstatements in production codeR8009Use of builtinopenfor writing is discouraged in favor ofos.opento allow for setting file permissionsE8010Avoid usingos.popen()as it internally usessubprocess.Popenwithshell=TrueE8011Use ofshlex.quote()should be avoided on non-POSIX platformsW8012Avoid usingos.open()with unsafe permissions permissionsE8013Avoid usingpickle.load()andpickle.loads()E8014Avoid usingmarshal.load()andmarshal.loads()E8015Avoid usingshelve.open()W8016Avoid usingos.mkdirandos.makedirswith unsafe file permissionsW8017Avoid usingos.mkfifowith unsafe file permissionsW8018Avoid usingos.mknodwith unsafe file permissionsW8019Avoid usingos.chmodwith unsafe permissions (W ^ X for group and others)Plugin configuration optionsThis plugin supports some configuration options that may either be specified directly on the command line with a flag
using the option name as--nameor by specifying them in one of pylint's configuration files (ie.pyproject.toml,pylintrc, etc.).Available options:Option nameOption typeDefault valueRelated error codeos-open-modemode-like0 (off)W8012os-mkdir-modemode-like0 (off)E8016os-mkfifo-modemode-like0 (off)E8017os-mknod-modemode-like0 (off)E8018Mode-like optionsMode-like options are configuration options for errors/warnings that relate to some function that accepts amodeparameter (or similar) that control some file or directory permissions. For those kind of options, the plugin
understands a variety of values that must be specified asstring. They will then be parsed into a list of allowed mode
values:Any positive, non-zero (octal or decimal) integer value specifies the maximum value for the mode valueA comma-separated list of (octal or decimal) integers indicates the list of allowed mode values'y', 'yes', 'true' (case-insensitive) will turn on the warnings using the default value of0o755'n', 'no', 'false' (case-insensitive) will turn off the warningsExample of values:[tool.pylint.plugins]os-open-mode='0'# check disabledos-open-mode='no'# check disabledos-open-mode='493'# all modes from 0 to 493 (=0o755)os-open-mode='0o755'# all modes from 0 to 0o755os-open-mode='0o755,'# only 0o755 (notice the comma)os-open-mode='0o644,0o755'# only 0o644 and 0o755You can also specify those options directly on the command line:python3-mpylint--load-plugins=pylint_secure_coding_standard--os-open-mode='0o755'Pre-commit hookSeepre-commitfor instructionsSample.pre-commit-config.yaml:-repo:https://github.com/PyCQA/pylint/rev:pylint-2.6.0hooks:-id:pylintargs:[--load-plugins=pylint_secure_coding_standard]additional_dependencies:['pylint-secure-coding-standard']