B102
Detect use of exec (security issue)
The Codiga Static Analysis engine is powered by the best open-source tools to check your Python code. Make sure your code does not have any security issues and follow design and other best practices. Automate your code reviews today and merge with confidence with Codiga.
Detect use of exec (security issue)
Chmod setting a permissive mask 0o755 on file (entryfile).
Possible binding to all interfaces.
Insecure usage of file or directory
Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data
Deserialization with the marshal module is possibly dangerous.
Use of insecure MD2
Use of insecure cipher mode cryptography.hazmat.primitives.ciphers.modes.ECB.
Use of insecure and deprecated function (mktemp).
Use of possibly insecure function - consider using safer ast.literal\_eval.
Use of mark\_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
Use of HTTPSConnection on older versions of Python prior to 2.7.9 and 3.4.3 do not provide security
Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.
Using xml.etree.cElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.cElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Using xml.etree.ElementTree.iterparse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.iterparse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Using xml.sax.make\_parser to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.sax.make\_parser with its defusedxml equivalent function or make sure defusedxml.defuse\_stdlib() is called
Using xml.dom.minidom.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.
Detect unsecure use of HTTPS connexion
Use of insecure MD4 or MD5 hash function.
Use of unsafe yaml load. Allows instantiation of arbitrary objects. Consider yaml.safe_load().
Possible shell injection via Paramiko call
Possible SQL injection vector through string-based query construction.
Mako templates allow HTML/JS rendering by default and are inherently open to XSS attacks. Ensure variables in all templates are properly sanitized via the 'n'
Potential XSS on mark\_safe function.
Ensure that __slots__ is an iterable and not a base type
More than one statement on a single line
Use len() without explicit argument
Unrecognized options
Bad option value
Use of return in init
Detect functions that already exist
break or continue used outside a loop
Return outside function
The yield keyword is used outside a function
Use of operator that does not exist
Abstract class instantiation attempt
Bad argument passed to reversed()
A nonlocal variable does not have an attached name somewhere in the parent scopes.
Method has the same name as an attribute
Access to members before they are defined
A method which should have the bound instance as first argument has no argument defined.
Method should have self as first argument
Assigning an attribute not defined in the class slots
Detect class that inherit non-classes
Value conflict with __slots__
__iter__ returns non-iterator
The special method __int__ should have 0 parameter
__repr__ does not return str
Module that cannot be imported
Attempted relative import beyond top-level package
Undefined variable is trying to be accessed
Undefined variable name referenced in __all\__
Invalid object referenced in __all__
Attempting to unpack a non-sequence
Raising int while only classes or instances are allowed
The raise statement is not inside an except clause
Raising a new style class which doesn't inherit from BaseException
NotImplemented raised and should raise NotImplementedError instead
Another argument than the current class is given as first argument of the super builtin
Missing mandatory keyword argument in function call
Sequence type is indexed with an invalid type
Context manager doesn't implement __enter__ and __exit__
Unary operand is used on an object which does not support this type of operation.
Got multiple values for keyword argument in function call
Non-mapping value is used in a mapping context
Value is unsubscriptable
Invalid metaclass used
Format string ends in middle of conversion specifier
Incorrect format string
The argument to a str.{l,r,}strip call contains a duplicate character
Invalid literal comparison
Misplacing comma that creates a tuple
Do not raise StopIteration in generator
Inconsistent return type in function
Consider using tuple unpacking for swapping variables
Consider using str.join() for concatenating strings from an iterable
Consider using dict.get for getting values from a dict if a key is present or a default if not
Conditions can be simplified
Dangerous default value as argument
Statement have no effect
String statement has no effect
Expression not assigned
Lambda may not be necessary
Useless else on loop
Use of exec
With statement returns multiple values
Conditional statement with potentially wrong function or method call due to missing parentheses
Assigning a variable to itself
Redeclared variable in assignment
Attribute defined outside __init__
Static method with self as first argument
Parameters differ from overridden method
Abstract method not overriden
An __init__ method is called on a class which is not in the direct ancestors for the analyzed class
Invalid overridden method
Uses of deprecated modules
Global variable used but not defined
Using the global statement at the module level
Redefining name from outer scope
Redefining built-in from Python
Loop variable used outside a loop
Possible unbalanced tuple unpacking with sequence
Use variable in closure when defined in a loop
Not using specific exception in an except statement
Catching too general exception
Catching the same exception twice
Use the right exception when raising an exception in an except block
Passing multiple incorrect arguments to an exception constructor
Argument of isinstance is not a type
Use %s in logging function
Invalid format string
Missing format() argument key
Unused format argument
Using an f-string that does not have any interpolated variables
Implicit string concatenation found in list
Implicit string concatenation
Invalid file open mode
Invalid default value when getting the environment
Using subprocess.run without explicitly set `check` is not recommended.
Method parameter has a different name than in the implemented interface or in an overridden method
Disallowed name (e.g. foo, bar, etc)
Use in instead of iterating over value and using equal
Boolean value has always the same value
'await' should be used within an async function
Iterated dict is being modified inside for loop body, iterate through a copy of it instead.
Blacklist Python calls known to be dangerous
Potential SQL injection on extra function
Potential SQL injection on RawSQL function
Paramiko call with policy set to automatically trust the unknown host key.
Using deprecated class
Using deprecated method
Using deprecated module
Missing timeout argument can cause your program to hang indefinitely
Non-string value assigned
Useless parent or super() delegation
Member is unhashable
We use cookies to improve your site experience, including analytics cookies to understand how you use our product and design better experiences. Please read our Cookie Policy.