SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • GroovyGroovy
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Python

Python static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your PYTHON code

  • All rules 414
  • Vulnerability45
  • Bug104
  • Security Hotspot50
  • Code Smell215

  • Quick Fix 33
Filtered: 88 rules found
cwe
    Impact
      Clean code attribute
        1. Functions and methods should only return expected values

           Bug
        2. The number and name of arguments passed to a function should match its parameters

           Bug
        3. Non-empty statements should change control flow or have at least one side-effect

           Bug
        4. AI agent code execution without sandboxing is security-sensitive

           Security Hotspot
        5. Server-side requests should not be vulnerable to traversing attacks

           Vulnerability
        6. GraphQL introspection should be disabled in production

           Vulnerability
        7. JWT secret keys should not be disclosed

           Vulnerability
        8. Flask secret keys should not be disclosed

           Vulnerability
        9. Loop boundaries should not be vulnerable to injection attacks

           Vulnerability
        10. Memory allocations should not be vulnerable to Denial of Service attacks

           Vulnerability
        11. Allowing unrestricted outbound communications is security-sensitive

           Security Hotspot
        12. Hard-coded secrets are security-sensitive

           Security Hotspot
        13. Constructing arguments of system commands from user input is security-sensitive

           Security Hotspot
        14. Creating public APIs is security-sensitive

           Security Hotspot
        15. Using unencrypted EFS file systems is security-sensitive

           Security Hotspot
        16. Using unencrypted SQS queues is security-sensitive

           Security Hotspot
        17. Allowing public network access to cloud resources is security-sensitive

           Security Hotspot
        18. Using unencrypted SNS topics is security-sensitive

           Security Hotspot
        19. Administration services access should be restricted to specific IP addresses

           Vulnerability
        20. Using unencrypted SageMaker notebook instances is security-sensitive

           Security Hotspot
        21. AWS IAM policies should limit the scope of permissions given

           Vulnerability
        22. Using unencrypted OpenSearch domains is security-sensitive

           Security Hotspot
        23. Policies granting access to all resources of an account are security-sensitive

           Security Hotspot
        24. Using unencrypted RDS DB resources is security-sensitive

           Security Hotspot
        25. Policies granting all privileges are security-sensitive

           Security Hotspot
        26. Applications should not create session cookies from untrusted input

           Vulnerability
        27. Allowing public ACLs or policies on a S3 bucket is security-sensitive

           Security Hotspot
        28. Using unencrypted EBS volumes is security-sensitive

           Security Hotspot
        29. Policies authorizing public access to resources are security-sensitive

           Security Hotspot
        30. Granting access to S3 buckets to all or authenticated users is security-sensitive

           Security Hotspot
        31. Authorizing HTTP communications with S3 buckets is security-sensitive

           Security Hotspot
        32. Using slow regular expressions is security-sensitive

           Security Hotspot
        33. JWT should be signed and verified

           Vulnerability
        34. Cipher algorithms should be robust

           Vulnerability
        35. Encryption algorithms should be used with secure mode and padding scheme

           Vulnerability
        36. Server hostnames should be verified during SSL/TLS connections

           Vulnerability
        37. Server-side templates should not be vulnerable to injection attacks

           Vulnerability
        38. Insecure temporary file creation methods should not be used

           Vulnerability
        39. Using publicly writable directories is security-sensitive

           Security Hotspot
        40. Passwords should not be stored in plaintext or with a fast hashing algorithm

           Vulnerability
        41. Dynamic code execution should not be vulnerable to injection attacks

           Vulnerability
        42. Using clear-text protocols is security-sensitive

           Security Hotspot
        43. Disabling auto-escaping in template engines is security-sensitive

           Security Hotspot
        44. NoSQL operations should not be vulnerable to injection attacks

           Vulnerability
        45. HTTP request redirections should not be open to forging attacks

           Vulnerability
        46. Logging should not be vulnerable to injection attacks

           Vulnerability
        47. Server-side requests should not be vulnerable to forging attacks

           Vulnerability
        48. Deserialization should not be vulnerable to injection attacks

           Vulnerability
        49. Endpoints should not be vulnerable to reflected cross-site scripting (XSS) attacks

           Vulnerability
        50. Having a permissive Cross-Origin Resource Sharing policy is security-sensitive

           Security Hotspot
        51. Expanding archive files without controlling resource consumption is security-sensitive

           Security Hotspot
        52. Server certificates should be verified during SSL/TLS connections

           Vulnerability
        53. Signaling processes is security-sensitive

           Security Hotspot
        54. Using weak hashing algorithms is security-sensitive

           Security Hotspot
        55. Delivering code in production with debug features activated is security-sensitive

           Security Hotspot
        56. Disabling CSRF protections is security-sensitive

           Security Hotspot
        57. Unread "private" attributes should be removed

           Code Smell
        58. LDAP connections should be authenticated

           Vulnerability
        59. Cryptographic key generation should be based on strong parameters

           Vulnerability
        60. Weak SSL/TLS protocols should not be used

           Vulnerability
        61. Allowing both safe and unsafe HTTP methods is security-sensitive

           Security Hotspot
        62. Database queries should not be vulnerable to injection attacks

           Vulnerability
        63. Zero should not be a possible denominator

           Bug
        64. Creating cookies without the "HttpOnly" flag is security-sensitive

           Security Hotspot
        65. Cipher Block Chaining IVs should be unpredictable

           Vulnerability
        66. XML parsers should not be vulnerable to XXE attacks

           Vulnerability
        67. Regular expressions should not be vulnerable to Denial of Service attacks

           Vulnerability
        68. Setting loose POSIX file permissions is security-sensitive

           Security Hotspot
        69. Boolean expressions should not be gratuitous

           Code Smell
        70. Conditionally executed code should be reachable

           Bug
        71. Attributes should not be accessed on "None" values

           Bug
        72. Using non-standard cryptographic algorithms is security-sensitive

           Security Hotspot
        73. Using pseudorandom number generators (PRNGs) is security-sensitive

           Security Hotspot
        74. A secure password should be used when connecting to a database

           Vulnerability
        75. Creating cookies without the "secure" flag is security-sensitive

           Security Hotspot
        76. XPath expressions should not be vulnerable to injection attacks

           Vulnerability
        77. I/O function calls should not be vulnerable to path injection attacks

           Vulnerability
        78. LDAP queries should not be vulnerable to injection attacks

           Vulnerability
        79. Formatting SQL queries is security-sensitive

           Security Hotspot
        80. OS commands should not be vulnerable to command injection attacks

           Vulnerability
        81. Hard-coded passwords are security-sensitive

           Security Hotspot
        82. Password hashing functions should use an unpredictable salt

           Vulnerability
        83. Unused assignments should be removed

           Code Smell
        84. All code should be reachable

           Bug
        85. Break, continue and return statements should not occur in "finally" blocks

           Bug
        86. Track uses of "TODO" tags

           Code Smell
        87. Track uses of "FIXME" tags

           Code Smell
        88. "Exception" and "BaseException" should not be raised

           Code Smell

        Server-side templates should not be vulnerable to injection attacks

        intentionality - complete
        security
        Vulnerability
        • cwe
        • python3
        • injection

        Why is this an issue?

        How can I fix it?

        More Info

        Server-side template injections occur when an application retrieves data from a user or a third-party service and inserts it into a template, without sanitizing it first.

        If an application contains a template that is vulnerable to injections, it is exposed to attacks that target the underlying rendering server.

        A user with malicious intent can create requests that will cause the template to change its logic into unwanted behavior.

        What is the potential impact?

        An attacker exploiting a server-side template injection vulnerability will be able to execute arbitrary commands on the underlying operating system.

        The impact depends on the access control measures taken on the target system OS. In the worst-case scenario, the process runs with root privileges, and therefore any OS commands or programs may be affected.

        Below are some real-world scenarios that illustrate some impacts of an attacker exploiting the vulnerability.

        Denial of service and data leaks

        In this scenario, the attack aims to disrupt the organization’s activities and profit from data leaks.

        An attacker could, for example:

        • download the internal server’s data, most likely to sell it
        • modify data, send malware
        • stop services or exhaust resources (with fork bombs for example)

        This threat is particularly insidious if the attacked organization does not maintain a disaster recovery plan (DRP).

        Root privilege escalation and pivot

        In this scenario, the attacker can do everything described in the previous section. The difference is that the attacker also manages to elevate their privileges to an administrative level and attacks other servers.

        Here, the impact depends on how much the target company focuses on its Defense In Depth. For example, the entire infrastructure can be compromised by a combination of OS injections and misconfiguration of:

        • Docker or Kubernetes clusters
        • cloud services
        • network firewalls and routing
        • OS access control
          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Developer Edition
          Available Since
          10.0

        © 2026 SonarSource Sàrl. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use