How to use this page

Paste a rule ID from a scanner's output or a SARIF file (G704, rb/insecure-mass-assignment or tainted-sql-string) into search or the identifier lookup: it opens the card that recorded the rule, at its scanner table, or this page when several cards did. Semgrep rules match by their full ID or its last part.

Tools that run on one language also name a stack in search: "brakeman sql injection" finds the Rails card. All fix cards are listed by weakness and stack, and the fix-card API maps every rule to its cards for SARIF helpUri links.

Semgrep

156 rules on cards for Node.js, Python, Java, C#, Next.js, FastAPI, Django, Go, Rails, Laravel

Semgrep rules and the fix cards that record them
RuleFix cards and what it found
csharp.dotnet.security.audit.mass-assignment.mass-assignment
csharp.dotnet.security.audit.missing-or-broken-authorization.missing-or-broken-authorization
csharp.dotnet.security.audit.razor-use-of-htmlstring.razor-use-of-htmlstring
csharp.dotnet.security.audit.xpath-injection.xpath-injection
  • Fix XPath injection in C# and ASP.NET Core2 findings: the concatenated XPath in VulnerableUserDirectory and in WrongUserDirectory (the still-concatenated password). 0 findings on FixedUserDirectory, where the values are bound as XPath variables through an…
csharp.dotnet.security.mvc-missing-antiforgery.mvc-missing-antiforgery
  • Fix CSRF in C# and ASP.NET CoreNo findings on this card: the rule matches MVC controller actions marked [HttpPost], [HttpPut], [HttpPatch] or [HttpDelete] that return IActionResult without [ValidateAntiForgeryToken].
csharp.lang.security.ad.jwt-tokenvalidationparameters-no-expiry-validation.jwt-tokenvalidationparameters-no-expiry-validation
csharp.lang.security.cryptography.unsigned-security-token.unsigned-security-token
csharp.lang.security.filesystem.unsafe-path-combine.unsafe-path-combine
csharp.lang.security.open-redirect.open-redirect
  • Fix open redirects in C# and ASP.NET CoreNo findings on this card, for any implementation: the rule follows a string parameter of a public method into a bare Redirect(...) call, and here the redirect sits in a protected override.
csharp.lang.security.sqli.csharp-sqli.csharp-sqli
generic.html-templates.security.var-in-href.var-in-href
  • Fix XSS in Python and DjangoFlagged href="{{ website }}" in all three templates, the fixed one included: it cannot see the is_web_url check around the link, so treat it as a reminder to look, not as a verdict.
generic.secrets.gitleaks.generic-api-key.generic-api-key
generic.secrets.security.detected-generic-api-key.detected-generic-api-key
go.jwt-go.security.audit.jwt-parse-unverified.jwt-go-parse-unverified
go.lang.security.audit.crypto.math_random.math-random-used
go.lang.security.audit.crypto.missing-ssl-minversion.missing-ssl-minversion
go.lang.security.audit.crypto.use_of_weak_rsa_key.use_of_weak_rsa_key
go.lang.security.audit.dangerous-exec-cmd.dangerous-exec-cmd
go.lang.security.audit.dangerous-exec-command.dangerous-exec-command
go.lang.security.audit.database.string-formatted-query.string-formatted-query
  • Fix SQL injection in Go and net/httpFlagged all four fmt.Sprintf queries: two in impl/vulnerable.go and two in impl/wrong.go; nothing in impl/fixed.go, whose ORDER BY is built with + from allowlisted fragments.
go.lang.security.audit.md5-used-as-password.md5-used-as-password
go.lang.security.audit.sqli.gosql-sqli.gosql-sqli
  • Fix SQL injection in Go and net/httpFive findings: the four QueryContext calls in impl/vulnerable.go and impl/wrong.go, and one in impl/fixed.go, where the ORDER BY clause is concatenated from the allowlist map.
go.lang.security.audit.xss.import-text-template.import-text-template
go.lang.security.audit.xss.no-fprintf-to-responsewriter.no-fprintf-to-responsewriter
go.lang.security.audit.xss.template-html-does-not-escape.unsafe-template-type
go.lang.security.filepath-clean-misuse.filepath-clean-misuse
go.lang.security.injection.open-redirect.open-redirect
  • Fix open redirects in Go and net/httpOne finding, a false positive: app.go's own redirect of signed-out visitors to "/login?next=" + url.QueryEscape(r.URL.RequestURI()); the rule treats a concatenation as safe only when its constant part names a host.
go.lang.security.injection.tainted-sql-string.tainted-sql-string
go.lang.security.injection.tainted-url-host.tainted-url-host
java.java-jwt.security.audit.jwt-decode-without-verify.java-jwt-decode-without-verify
java.lang.security.audit.command-injection-process-builder.command-injection-process-builder
java.lang.security.audit.crlf-injection-logs.crlf-injection-logs
java.lang.security.audit.crypto.ssl.insecure-trust-manager.insecure-trust-manager
java.lang.security.audit.crypto.unencrypted-socket.unencrypted-socketUnencrypted socket (observed on the production dialer)
java.lang.security.audit.crypto.weak-random.weak-random
java.lang.security.audit.http-response-splitting.http-response-splitting
java.lang.security.audit.ldap-injection.ldap-injection
java.lang.security.audit.md5-used-as-password.md5-used-as-password
java.lang.security.audit.object-deserialization.object-deserialization
java.lang.security.audit.permissive-cors.permissive-cors
java.lang.security.audit.tainted-ldapi-from-http-request.tainted-ldapi-from-http-request
java.lang.security.audit.unvalidated-redirect.unvalidated-redirect
java.lang.security.audit.weak-ssl-context.weak-ssl-context
java.lang.security.audit.xxe.documentbuilderfactory-disallow-doctype-decl-false.documentbuilderfactory-disallow-doctype-decl-false
java.lang.security.audit.xxe.documentbuilderfactory-disallow-doctype-decl-missing.documentbuilderfactory-disallow-doctype-decl-missing
java.spring.security.audit.spel-injection.spel-injection
java.spring.security.audit.spring-csrf-disabled.spring-csrf-disabled
java.spring.security.audit.spring-sqli.spring-sqli
java.spring.security.audit.spring-unvalidated-redirect.spring-unvalidated-redirect
java.spring.security.injection.tainted-file-path.tainted-file-path
java.spring.security.injection.tainted-sql-string.tainted-sql-string
java.spring.security.injection.tainted-url-host.tainted-url-host
java.spring.security.unrestricted-request-mapping.unrestricted-request-mapping
  • Fix CSRF in Java and Spring BootFlagged the @RequestMapping("/account/email") handler in VulnerableSecurity and in WrongSecurity; no findings in FixedSecurity, which uses @PostMapping.
javascript.argon2.security.unsafe-argon2-config.unsafe-argon2-config
javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf-middleware-usage
  • Fix CSRF in Node.js and ExpressNo findings on this card, for any implementation: the rule only matches apps that load Express with require('express'), and this card uses ES module imports.
javascript.express.security.audit.express-open-redirect.express-open-redirect
javascript.express.security.audit.express-path-join-resolve-traversal.express-path-join-resolve-traversal
javascript.express.security.audit.express-ssrf.express-ssrf
javascript.express.security.audit.possible-user-input-redirect.unknown-value-in-redirect
javascript.express.security.audit.xss.ejs.explicit-unescape.template-explicit-unescape
javascript.express.security.audit.xss.ejs.var-in-href.var-in-href
javascript.express.security.cors-misconfiguration.cors-misconfiguration
javascript.express.security.express-data-exfiltration.express-data-exfiltration
javascript.express.security.injection.tainted-sql-string.tainted-sql-string
javascript.jose.security.jwt-none-alg.jwt-none-alg
javascript.jsonwebtoken.security.audit.jwt-decode-without-verify.jwt-decode-without-verify
javascript.lang.security.audit.code-string-concat.code-string-concat
javascript.lang.security.audit.detect-non-literal-fs-filename.detect-non-literal-fs-filename
javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
javascript.lang.security.audit.md5-used-as-password.md5-used-as-password
javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
javascript.lang.security.audit.prototype-pollution.prototype-pollution-loop
javascript.lang.security.detect-child-process.detect-child-process
javascript.lang.security.detect-eval-with-expression.detect-eval-with-expression
php.lang.security.injection.echoed-request.echoed-request
php.lang.security.injection.tainted-filename.tainted-filename
php.lang.security.injection.tainted-sql-string.tainted-sql-string
php.lang.security.md5-used-as-password.md5-used-as-password
php.lang.security.redirect-to-request-uri.redirect-to-request-uri
php.lang.security.weak-crypto.weak-crypto
  • Fix weak password hashing in PHP and LaravelNo findings on this card: it flags calls such as md5() and sha1(), and a probe with md5($password) was flagged, but hash('sha256', $password) in VulnerablePasswords.php is not.
php.laravel.security.laravel-api-route-sql-injection.laravel-api-route-sql-injection
php.laravel.security.laravel-blade-form-missing-csrf.laravel-blade-form-missing-csrf
php.laravel.security.laravel-dangerous-model-construction.laravel-dangerous-model-construction
php.laravel.security.laravel-sql-injection.laravel-sql-injection
problem-based-packs.insecure-transport.go-stdlib.bypass-tls-verification.bypass-tls-verification
problem-based-packs.insecure-transport.java-stdlib.bypass-tls-verification.bypass-tls-verification
problem-based-packs.insecure-transport.js-node.bypass-tls-verification.bypass-tls-verification
python.django.security.audit.csrf-exempt.no-csrf-exempt
python.django.security.audit.unvalidated-password.unvalidated-password
python.django.security.audit.xss.template-autoescape-off.template-autoescape-off
python.django.security.injection.csv-writer-injection.csv-writer-injection
  • Fix CSV formula injection in Python and DjangoNo findings: it is file-local taint from request data into csv.writer(...).writerow(), and here the records are stored data (a module constant standing in for the database) written in a separate module.
python.django.security.injection.mass-assignment.mass-assignment
python.django.security.injection.open-redirect.open-redirect
python.django.security.injection.path-traversal.path-traversal-file-name.path-traversal-file-name
python.django.security.injection.path-traversal.path-traversal-join.path-traversal-join
  • Fix path traversal in Python and DjangoNo findings on this card: it matches os.path.join() with request data inside one view, and this card reads request.GET in views.py and builds the path with pathlib in files_app/impl/.
python.django.security.injection.path-traversal.path-traversal-open.path-traversal-open
python.django.security.injection.sql.sql-injection-using-db-cursor-execute.sql-injection-db-cursor-execute
  • Fix SQL injection in Python and DjangoNo findings on this card: it matches request data and cursor.execute inside one view function, and here the view in views.py calls a data-access function in orders/impl/.
python.django.security.injection.ssrf.ssrf-injection-requests
python.django.security.injection.ssrf.ssrf-injection-requests.ssrf-injection-requests
python.flask.security.audit.flask-cors-misconfiguration.flask-cors-misconfiguration
python.flask.security.audit.render-template-string.render-template-string
python.flask.security.audit.wtf-csrf-disabled.flask-wtf-csrf-disabled
python.flask.security.dangerous-template-string.dangerous-template-string
python.flask.security.injection.csv-writer-injection.csv-writer-injection
  • Fix CSV formula injection in Python and FlaskNo findings: it is file-local taint from request data into csv.writer(...).writerow(), and here the records are stored data (a module constant standing in for the database) written in a separate module.
python.flask.security.injection.path-traversal-open.path-traversal-open
python.flask.security.injection.tainted-sql-string.tainted-sql-string
python.flask.security.open-redirect.open-redirect
  • Fix open redirects in Python and FlaskNo findings on this card, for any implementation: the rule looks only inside functions decorated with @app.route, and this card's routes use @app.post with the redirect in impl/*.py.
python.flask.security.xss.audit.template-unescaped-with-safe.template-unescaped-with-safe
  • Fix cross-site scripting in Python and FlaskFlagged the three {{ ... | safe }} expressions in templates/profile/vulnerable.html; no findings in fixed.html (plain {{ }}) or wrong.html, where the |safe sits inside a {% set %} and the regex only looks between {{…
  • Fix XSS in Python and DjangoFiled under Flask, but it is a regular expression over HTML templates, so it also reads Django's: it flagged the three {{ ... |safe }} lines in vulnerable.html and the three {{ ...|striptags|safe }} lines in…
python.flask.security.xss.audit.template-unquoted-attribute-var.template-unquoted-attribute-var
python.jwt.security.jwt-none-alg.jwt-python-none-alg
python.jwt.security.unverified-jwt-decode.unverified-jwt-decode
python.lang.security.audit.dangerous-subprocess-use-audit.dangerous-subprocess-use-audit
python.lang.security.audit.eval-detected.eval-detected
python.lang.security.audit.formatted-sql-query.formatted-sql-query
python.lang.security.audit.logging.logger-credential-leak.python-logger-credential-disclosure
python.lang.security.audit.md5-used-as-password.md5-used-as-password
python.lang.security.audit.network.disabled-cert-validation.disabled-cert-validation
python.lang.security.audit.subprocess-shell-true.subprocess-shell-true
python.lang.security.deserialization.avoid-pyyaml-load.avoid-pyyaml-load
python.lang.security.deserialization.pickle.avoid-pickle
python.lang.security.use-defused-xml.use-defused-xml
python.lang.security.use-defusedcsv.use-defusedcsv
python.requests.security.disabled-cert-validation.disabled-cert-validation
python.sqlalchemy.security.audit.avoid-sqlalchemy-text.avoid-sqlalchemy-text
  • Fix SQL injection in Python and FastAPIFlagged both text(f"...") calls in impl/vulnerable.py and in impl/wrong.py; no findings in impl/fixed.py, whose text() is a constant with :customer and :status.
python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query
ruby.lang.security.missing-csrf-protection.missing-csrf-protection
  • Fix CSRF in Ruby on Rails1 finding on ApplicationController, a false positive: it looks for protect_from_forgery in the class, while load_defaults 5.2 and later add protect_from_forgery with: :exception to ActionController::Base.
ruby.lang.security.model-attr-accessible.model-attr-accessible
ruby.rails.security.audit.avoid-tainted-file-access.avoid-tainted-file-access
ruby.rails.security.audit.rails-skip-forgery-protection.rails-skip-forgery-protection
ruby.rails.security.audit.xss.avoid-redirect.avoid-redirect
  • Fix open redirects in Ruby on Rails1 finding on this card, the redirect_to account_path in SessionsController#create (a false positive), and on the probe every redirect, the fixed url_from one included: it is an audit rule that reports request data…
ruby.rails.security.audit.xss.templates.alias-for-html-safe.alias-for-html-safe
ruby.rails.security.audit.xss.templates.avoid-html-safe.avoid-html-safe
ruby.rails.security.audit.xss.templates.avoid-raw.avoid-raw
  • Fix XSS in Ruby on Rails1 finding in vulnerable.html.erb and 3 in wrong.html.erb (raw strip_tags(...)), none in fixed.html.erb.
ruby.rails.security.brakeman.check-permit-attributes-high.check-permit-attributes-high
ruby.rails.security.brakeman.check-redirect-to.check-redirect-to
ruby.rails.security.brakeman.check-send-file.check-send-file
ruby.rails.security.brakeman.check-sql.check-sql
ruby.rails.security.brakeman.check-unscoped-find.check-unscoped-find
ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
  • Fix SQL injection in Ruby on RailsNo findings on this card: the rule follows params into a SQL string within one file, and here the controller passes the values to OrderQueries in app/queries/.
typescript.lang.security.audit.cors-regex-wildcard.cors-regex-wildcard
typescript.react.security.audit.react-dangerouslysetinnerhtml.react-dangerouslysetinnerhtml
  • Fix XSS in TypeScript and Next.jsFlagged both dangerouslySetInnerHTML props in lib/impl/vulnerable.tsx (bio and JSON-LD), both in wrong.tsx, and the JSON-LD prop in fixed.tsx.

CodeQL

136 rules on cards for Node.js, Python, Java, C#, Next.js, FastAPI, Django, Go, Rails

CodeQL rules and the fix cards that record them
RuleFix cards and what it found
cs/cleartext-storage-of-sensitive-information
cs/code-injection
cs/command-line-injection
cs/hardcoded-credentials
cs/hash-without-salt
cs/json-webtoken-handler/delegated-security-validations-always-return-true
cs/json-webtoken-handler/security-validations-disabled
  • Fix JWT validation in C# and ASP.NET CoreFrom the query and JsonWebTokenHandlerLib.qll: reports ValidateIssuer, ValidateAudience, ValidateLifetime, RequireExpirationTime or RequireAudience set to false, so it should flag VulnerableTokenValidation.cs and…
cs/path-injection
cs/redos
  • Fix ReDoS in C# and ASP.NET CoreExpected to flag vulnerable and wrong. cs/redos ("Denial of Service from comparison of user input against expensive regex") detects a regex with super-linear/exponential backtracking matched against data; the nested…
cs/request-forgery
  • Fix SSRF in C# and ASP.NET CoreAn experimental query: the default and security-extended code-scanning suites exclude experimental/ (misc/suite-helpers), so run it by path.
cs/session-reuse
cs/sql-injection
  • Fix SQL injection in C# and ASP.NET CoreAssignments to any CommandText that implements IDbCommand.CommandText are SQL sinks (semmle/code/csharp/frameworks/Sql.qll), which covers SqliteCommand, and MapGet handler parameters are remote flow sources…
cs/unsafe-deserialization
cs/web/file-upload
cs/web/insecure-direct-object-reference
cs/web/missing-function-level-access-control
cs/web/missing-token-validation
  • Fix CSRF in C# and ASP.NET CoreNot expected to report anything on this card: the query checks [HttpPost] actions on ASP.NET MVC and ASP.NET Core controllers for ValidateAntiForgeryToken, a global AutoValidateAntiforgeryTokenAttribute or…
cs/web/unvalidated-url-redirection
cs/web/xss
  • Fix cross-site scripting in C# and ASP.NET CoreExpected to flag this card: semmle/code/csharp/security/dataflow/XSSSinks.qll defines MicrosoftAspNetCoreMvcHtmlHelperRawSink as the 'Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.Raw() method', so…
cs/xml/insecure-dtd-handling
cs/xml/xpath-injection
go-security-extended
go/bad-redirect-check
go/command-injection
go/disabled-certificate-check
go/html-template-escaping-bypass-xss
go/insecure-randomness
go/insecure-tls
go/missing-jwt-signature-check
go/path-injection
go/reflected-xss
go/request-forgery
  • Fix SSRF in Go and net/httpThree results, one per implementation: the request in impl/vulnerable.go, impl/wrong.go and impl/fixed.go, each traced from r.URL in app.go through the Fetcher interface.
go/sql-injection
  • Fix SQL injection in Go and net/httpFour results: the two QueryContext calls in impl/vulnerable.go and the two in impl/wrong.go, each traced from r.URL in app.go's queryParam through the Repository interface.
go/uncontrolled-allocation-size
go/unvalidated-url-redirection
go/weak-sensitive-data-hashing
  • Fix weak password hashing in Go and net/httpFive results, each a value named password reaching sha256.Sum256, which the query calls "not a computationally expensive hash function": Hash in impl/vulnerable.go, Hash and both Verify branches in impl/wrong.go, and…
java/command-line-injection
java/concatenated-sql-query
  • Fix SQL injection in Java and Spring BootMedium-precision companion query: reports SQL built by concatenating strings that are not compile-time constants, where java/sql-injection has not already found a tainted path.
java/csrf-unprotected-request-type
  • Fix CSRF in Java and Spring BootExpected to flag updateEmail in VulnerableSecurity and WrongSecurity: the query treats @RequestMapping without a method, and @GetMapping, as unprotected, and reports such handlers when they reach a database update or…
java/hardcoded-credential-api-call
java/hash-without-salt
java/http-response-splitting
java/insecure-randomness
java/insecure-trustmanager
java/ldap-injection
  • Fix LDAP filter injection in Java and Spring BootExpected to flag the vulnerable implementation and clear the fixed one. semmle/code/java/security/LdapInjection.qll models Spring LDAP (LdapTemplate searches and LdapQueryBuilder.filter/base) and UnboundID…
java/log-injection
java/missing-jwt-signature-check
java/partial-path-traversal-from-remote
java/path-injection
  • Fix path traversal in Java and Spring BootFrom the models: @RequestParam parameters are remote sources (FlowSources.qll), Path.resolve and toRealPath carry taint, and Files.readAllBytes(Path) is a path-injection sink (ext/java.nio.file.model.yml).
  • Fix unrestricted file upload in Java and Spring BootFrom ext/org.springframework.web.multipart.model.yml: getOriginalFilename() and getContentType() are remote sources, and Path.resolve() carries taint (ext/java.nio.file.model.yml).
java/predictable-seed
java/redos
  • Fix ReDoS in Java and Spring Bootjava/redos ("Inefficient regular expression") detects super-linear/exponential ambiguity in a pattern, and java/polynomial-redos needs a dataflow path from an untrusted source (@RequestParam) into the match.
java/sensitive-log
  • Fix hard-coded secrets in Java and Spring BootNot expected to report the vulnerable log line: SensitiveLoggingQuery.qll takes reads of sensitively named variables as sources but excludes compile-time constants, and FORECAST_API_KEY is a static final String constant.
java/server-side-template-injection
java/spel-expression-injection
  • Fix code injection in Java and Spring BootModels an expression parsed by SpelExpressionParser and evaluated against a StandardEvaluationContext as a SpEL-injection sink, with @RequestBody as a remote source, so it is expected to flag the vulnerable and wrong…
  • Fix server-side template (SpEL) injection in Java and Spring BootModels an expression parsed by SpelExpressionParser and evaluated against a StandardEvaluationContext as a SpEL-injection sink, with @RequestParam as a remote source, so this query is expected to flag the vulnerable…
java/spring-disabled-csrf-protection
  • Fix CSRF in Java and Spring BootExpected to flag VulnerableSecurity and WrongSecurity: java/ql/lib/semmle/code/java/security/SpringCsrfProtection.qll matches disable() called on CsrfConfigurer<HttpSecurity>, which covers the lambda form, and…
java/sql-injection
java/ssrf
java/unsafe-deserialization
java/unsafe-hostname-verification
  • Fix TLS certificate validation in Java and Spring BootThe CWE-297 query looks for HostnameVerifier implementations that accept every host, as used by HttpsURLConnection and Apache HttpClient. java.net.http.HttpClient has no HostnameVerifier, so it does not apply to this…
java/unvalidated-cors-origin-set
java/unvalidated-url-redirection
  • Fix open redirects in Java and Spring BootFrom the query source: sinks are HttpServletResponse.sendRedirect, Location headers set with setHeader or addHeader, Apache HttpComponents Location headers and modelled sinks; none of the Spring model files marks…
java/xml/xpath-injection
  • Fix XPath injection in Java and Spring BootModels a string built from remote input and passed to XPath.compile/evaluate as an XPath-injection sink, with @RequestBody/@RequestParam as sources, so it is expected to flag the vulnerable concatenation and the…
java/xss
  • Fix cross-site scripting in Java and Spring BootLikely to miss this card too. semmle/code/java/security/XSS.qll models sinks that write to a servlet, JSP or JSF response and treats HtmlUtils.htmlEscape as a sanitizer, but it does not model Thymeleaf th:utext, so a…
java/xxe
js/clear-text-logging
js/code-injection
  • Fix code injection in Node.js and ExpressModels eval, the Function constructor and the node:vm functions (runInContext/runInNewContext/runInThisContext) as code-execution sinks and HTTP request data as a source, so it is expected to flag the vulnerable new…
  • Fix server-side template injection in Node.js and ExpressCodeQL's JavaScript library models EJS as a template engine (EjsStyleSyntax, package 'ejs', in semmle/javascript/frameworks/Templating.qll) and treats a template compiled from untrusted input as a code-injection…
js/command-line-injection
js/cors-misconfiguration-for-credentials
  • Fix CORS misconfiguration in Node.js and ExpressNot expected to report anything on this card: it tracks remote input or a null value into an Access-Control-Allow-Origin header that a route handler sets explicitly next to Access-Control-Allow-Credentials: true, and…
js/cors-permissive-configuration
  • Fix CORS misconfiguration in Node.js and ExpressFrom the query source and javascript/ql/lib/ext/cors.model.yml: the origin option of cors() is a sink, and true, null, "*" or remote input reaching it is reported unless the same options set credentials: false.
js/decode-jwt-without-verification
  • Fix JWT validation in Node.js and ExpressFrom the query and its JWT.qll: it reports remote input that reaches jose's decodeJwt() (or jsonwebtoken's decode(), jwt-decode, jwt-simple without verification) and never reaches a verifying call.
  • Fix JWT validation in TypeScript and Next.jsReports remote input that reaches jose's decodeJwt() and never a verifying call, but it is experimental (not in the default or security-extended suites).
js/disabling-certificate-validation
js/hardcoded-credentials
js/http-to-file-access
js/insecure-randomness
js/insufficient-password-hash
js/jwt-missing-verification
js/log-injection
js/missing-token-validation
  • Fix CSRF in Node.js and ExpressFrom the query source: it reports handlers registered for a specific unsafe method (app.post, app.put and so on, not app.all) that read req.session or req.cookies behind cookie middleware such as express-session, and…
js/path-injection
  • Fix path traversal in Node.js and ExpressFrom TaintedPathCustomizations.qll and NodeJSLib.qll: node:-prefixed and fs/promises imports are modelled, path.resolve and the callback and sync forms of fs.realpath count as normalisation, and a startsWith(dir)…
  • Fix path traversal in TypeScript and Next.jsNext.qll models request.url of a GET exported from app/**/route.ts as a remote source; here GET is the return value of a factory in lib/files-handler.ts, and whether the analysis follows it was not tested.
  • Fix unrestricted file upload in Node.js and ExpressFrom Express.qll: req.file and req.files are modelled as request input, but the file object multer passes to the diskStorage filename callback is not, and the vulnerable code has no file-system call of its own for…
js/prototype-polluting-assignment
js/prototype-pollution
js/redos
  • Fix ReDoS in Node.js and ExpressExpected to flag vulnerable.js and wrong.js. js/redos ("Inefficient regular expression") statically analyses the pattern for a sub-expression with exponential or super-linear ambiguity; the nested quantifier…
js/reflected-xss
  • Fix cross-site scripting in Node.js and ExpressExpected to model this card: semmle/javascript/frameworks/Templating.qll understands EJS delimiters and which interpolation escapes (getEscapingInterpolationRegexp), so a request value reaching a <%- %> placeholder…
js/request-forgery
js/second-order-command-line-injection
js/server-side-unvalidated-url-redirection
js/session-fixation
js/shell-command-injection-from-environment
js/sql-injection
js/unsafe-deserialization
js/xss
py/clear-text-logging-sensitive-data
py/code-injection
  • Fix code injection in Python and FlaskCodeInjectionCustomizations.qll treats the code argument of any modelled code execution (eval) as a sink, and Flask.qll makes the request body a remote source, so the vulnerable and wrong eval(expression, ...) should…
  • Fix code injection in Python and FastAPICodeInjectionCustomizations.qll treats the code argument of any modelled code execution (eval) as a sink, and FastApi.qll makes the request body a remote source, so the vulnerable and wrong eval(expression, ...)…
  • Fix server-side template injection in Python and FlaskCompanion CWE-094 query for code built from untrusted input (eval/exec and template construction); listed for coverage alongside py/template-injection.
py/command-line-injection
py/cors-bypass
py/cors-misconfiguration-with-credentials
py/csrf-protection-disabled
  • Fix CSRF in Python and FlaskNot expected to report anything on this card: the only CSRF settings the Python library models are Django's MIDDLEWARE list and its csrf decorators (semmle/python/frameworks/Django.qll); Flask and Flask-WTF are not…
  • Fix CSRF in Python and DjangoNot expected to flag this card.
py/full-ssrf
py/hardcoded-credentials
  • Fix hard-coded secrets in Python and FlaskNot expected to report anything: its sinks are keyword arguments and comparisons with names that look like a password, user name or certificate, plus credentials-* models, of which the Python library has none for…
py/http-response-splitting
  • Fix CRLF and log injection in Python and FlaskNot expected to flag this card: its sinks are header writes whose value can carry a newline, and the Flask and Werkzeug models declare valueAllowsNewline() as none, matching Werkzeug's ValueError.
py/jwt-missing-verification
  • Fix JWT validation in Python and FlaskFrom the query and its PyJWT model (python/ql/src/experimental/semmle/python/libraries/PyJWT.qll): it reports a jwt.decode() call whose verify argument is False or whose options dict literal has any key containing…
  • Fix JWT validation in Python and FastAPIFrom the query and its PyJWT model (python/ql/src/experimental/semmle/python/libraries/PyJWT.qll): it reports a jwt.decode() call whose verify argument is False or whose options dict literal has any key containing…
py/ldap-injection
  • Fix LDAP filter injection in Python and FlaskExpected to flag the vulnerable and wrong implementations and clear the fixed one. semmle/python/frameworks/Ldap3.qll models ldap3 Connection.search as the LDAP filter sink, escape_filter_chars as the filter…
py/log-injection
  • Fix CRLF and log injection in Python and FlaskFrom the source: the sink is any input of a logging call, the msg argument, the format arguments and extra=; the sanitizer is a .replace() whose first argument is the literal "\n" or "\r\n", with a comment that it…
py/nosql-injection
  • Fix NoSQL operator injection in Python and FlaskThe query's PyMongo model (semmle/python/frameworks/PyMongo.qll) treats the filter of the find methods (find, find_one, find_one_and_update and others) and aggregate on collections reached from pymongo.MongoClient…
py/path-injection
  • Fix path traversal in Python and FlaskFrom PathInjectionQuery.qll and frameworks/Stdlib.qll: the model treats a path as checked after a normalisation (os.path.normpath, abspath or realpath) followed by a str.startswith test. pathlib's / operator and…
  • Fix path traversal in Python and FastAPIFastApi.qll models FileResponse's path argument as file-system access and the path query parameter as a remote source.
  • Fix path traversal in Python and DjangoFrom PathInjectionQuery.qll and frameworks/Stdlib.qll: the model treats a path as checked after a normalisation (os.path.normpath, abspath or realpath) followed by a str.startswith test. pathlib's / operator and…
  • Fix unrestricted file upload in Python and FlaskFrom Flask.qll and Werkzeug.qll: request.files.get() returns a modelled FileStorage, its filename attribute carries taint, and FileStorage.save() is a file-system access whose first argument is a path sink, so the…
  • Fix unrestricted file upload in Python and FastAPIFastApi.qll treats path-operation parameters as remote sources; whether UploadFile.filename carries taint into the vulnerable open(os.path.join(uploads, avatar.filename)) depends on Starlette's UploadFile model…
  • Fix unrestricted file upload in Python and DjangoDjango.qll makes request.FILES a remote source, so the vulnerable open(os.path.join(uploads, file.name)) may be reported although Django has already stripped the path.
py/redos
  • Fix ReDoS in Python and FlaskExpected to flag vulnerable.py and wrong.py. py/redos ("Inefficient regular expression") statically detects a sub-expression with super-linear/exponential ambiguity; the nested quantifier ([a-zA-Z0-9._%+-]+)+ is that…
py/reflective-xss
  • Fix cross-site scripting in Python and FlaskModels Flask: semmle/python/frameworks/Flask.qll treats request data as a source and render_template / render_template_string as template sinks. py/jinja2/autoescape-false is the companion that flags Jinja…
  • Fix XSS in Python and DjangoNot expected to flag this card: CodeQL does not read Django template files, so |safe and striptags are invisible to it.
py/request-without-cert-validation
py/sql-injection
  • Fix SQL injection in Python and FlaskThe Python library models sqlite3 as a PEP 249 database module (semmle/python/frameworks/Stdlib.qll), so execute() calls on its connections are SQL sinks.
  • Fix SQL injection in Python and FastAPIBoth ends are modelled: FastApi.qll treats the parameters of a routed handler as remote sources, and SqlAlchemy.qll treats the first argument of sqlalchemy.text() as SQL.
  • Fix SQL injection in Python and DjangoExpected to flag vulnerable.py and wrong.py: semmle/python/frameworks/Django.qll models request.GET as remote input and django.db.connection as a PEP 249 connection, so cursor.execute() is a SQL sink, and the query…
py/template-injection
py/unsafe-deserialization
py/url-redirection
  • Fix open redirects in Python and FlaskFrom the query source: sinks are HTTP redirect responses such as Flask's redirect().
  • Fix open redirects in Python and FastAPIBoth ends are modelled: FastApi.qll treats routed handler parameters (Form fields included) as remote sources and the first argument of RedirectResponse as a redirect location.
  • Fix open redirects in Python and DjangoFrom the sources: Django.qll models HttpResponseRedirect and redirect() as redirect sinks and request.POST as remote input, and Django.model.yml declares url_has_allowed_host_and_scheme() a barrier guard, so the…
py/weak-sensitive-data-hashing
  • Fix weak password hashing in Python and FlaskRead from the source, not run: a parameter named password is a sensitive source (SensitiveDataSources.qll), and for password data the input of any plain hashing call such as hashlib.sha256() is a sink, because only…
  • Fix weak password hashing in Python and FastAPIRead from the source, not run: a parameter named password is a sensitive source (SensitiveDataSources.qll), and for password data the input of any plain hashing call such as hashlib.sha256() is a sink, because only…
  • Fix weak password hashing in Python and DjangoRead from the source, not run: a parameter named password is a sensitive source, and for password data any plain hash such as hashlib.sha256() is a sink.
py/xpath-injection
  • Fix XPath injection in Python and FlaskLxml.qll models the first argument of an lxml .xpath() call (and etree.XPath/ETXPath) as an XPath sink, and Flask.qll makes request.args a remote source, so the %-formatted queries in the vulnerable and wrong code…
py/xxe
rb/csrf-protection-disabled
  • Fix CSRF in Ruby on RailsExpected to flag skip_forgery_protection in vulnerable.rb and in wrong.rb: ActionController.qll matches the call by name, inside a concern's included block too, and ignores the if: condition.
rb/csrf-protection-not-enabled
  • Fix CSRF in Ruby on RailsNot expected to flag ApplicationController: the query accepts a config.load_defaults of 5.2 or later as protection being on (this card has 8.1); it does not read default_protect_from_forgery itself.
rb/csv-injection
rb/insecure-mass-assignment
  • Fix mass assignment in Ruby on RailsNot expected to report anything on this card: besides the const_get dispatch, the taint on params does not survive except() in the model (its summary keeps only element content), so the permit! calls are never…
rb/missing-token-validation
rb/path-injection
  • Fix path traversal in Ruby on RailsNot expected to report anything on this card as written (params.expect and const_get, as for the other cards).
  • Fix unrestricted file upload in Ruby on RailsRack keeps only the last path segment of the client's file name, so the vulnerable handler's File.join cannot be steered out of the uploads folder, and CodeQL has no query for an uploaded file's type or size; it says…
rb/reflected-xss
  • Fix XSS in Ruby on RailsNot expected to report anything on this card: XSS.qll follows controller instance variables only into the action's default template (app/views/profiles/show.html.erb), and the card renders "profiles/#{impl}".
rb/request-forgery
rb/sensitive-get-query
rb/sql-injection
  • Fix SQL injection in Ruby on RailsNot expected to report anything on this card as written: the controllers read values with params.expect, which codeql/ruby/frameworks/ActionController.qll does not carry taint through, and OrderQueries.current…
rb/unsafe-deserialization
rb/url-redirection
  • Fix open redirects in Ruby on RailsNot expected to report anything on this card: the redirect is in SessionsController#create, a POST action, which the query skips, and the implementation is a module included through const_get.

gosec

17 rules on cards for Go

gosec rules and the fix cards that record them
RuleFix cards and what it found
G107URL provided to HTTP request as taint input
  • Fix SSRF in Go and net/httpNo findings: it is an AST rule for http.Get and friends with a variable URL, and the card builds requests with http.NewRequestWithContext.
G123TLS resumption may bypass VerifyPeerCertificate when VerifyConnection is unset
G124Insecure HTTP cookie configuration
  • Fix open redirects in Go and net/httpOne finding on the session cookie in app.go (MEDIUM severity, HIGH confidence), for the same reason as Semgrep's cookie-missing-secure: Secure comes from configuration.
G201SQL query construction using format string
G202SQL query construction using string concatenation
G203Use of unescaped data in HTML templates
G204Audit use of command execution
G304File path provided as taint input
  • Fix path traversal in Go and net/httpFlagged the os.Open call in impl/vulnerable.go and the one in impl/wrong.go (MEDIUM severity, HIGH confidence): it fires on os.Open with a non-constant name, so it cannot tell the prefix check apart.
G401Detect the usage of MD5 or SHA1
G402Look for bad TLS connection settings
G404Insecure random number source (rand)
G701SQL injection via taint analysis
G702Command injection via taint analysis
G703Path traversal via taint analysis
G704SSRF via taint analysis
  • Fix SSRF in Go and net/httpNo findings: the taint analysis does not follow the URL from the handler through the impl.Fetcher interface.
G708Server-side template injection via text/template
G710Open redirect via taint analysis

Bandit

15 rules on cards for Python, FastAPI, Django

Bandit rules and the fix cards that record them
RuleFix cards and what it found
B104hardcoded_bind_all_interfaces (no SSRF plugin exists)
B105blacklist: eval; hardcoded_password_string
B301pickle (loads of untrusted data)
B307blacklist: eval; hardcoded_password_string
B308mark_safe and django_mark_safe
  • Fix XSS in Python and DjangoNo findings: these checks look for mark_safe() calls in Python, and this card's unsafe output is the |safe filter inside templates, which Bandit does not read.
B311
B324hashlib_insecure_functions
B405import/use of xml.etree (blacklist)
B501request_with_no_cert_validation
B506yaml_load
B602subprocess_popen_with_shell_equals_true
B608hardcoded_sql_expressions
  • Fix SQL injection in Python and FlaskFlagged both queries in impl/vulnerable.py and impl/wrong.py, and also the allowlisted ORDER BY f-string in impl/fixed.py (confidence LOW).
  • Fix SQL injection in Python and FastAPIFlagged both f-string queries in impl/vulnerable.py and impl/wrong.py (MEDIUM severity, LOW confidence); nothing in impl/fixed.py, because its sort is built with select() and column objects rather than an f-string.
  • Fix SQL injection in Python and Django2 findings in vulnerable.py and 2 in wrong.py (MEDIUM severity, LOW confidence), none in fixed.py, which has no SQL strings at all.
B701jinja2_autoescape_false
B703mark_safe and django_mark_safe
  • Fix XSS in Python and DjangoNo findings: these checks look for mark_safe() calls in Python, and this card's unsafe output is the |safe filter inside templates, which Bandit does not read.
noneNo Bandit test covers session cookies or session fixation

Brakeman

16 rules on cards for Rails

Brakeman rules and the fix cards that record them
RuleFix cards and what it found
CrossSiteScriptingCross-site scripting
  • Fix XSS in Ruby on RailsNo warnings on this card: the controller picks the template with render "profiles/#{impl}", and Brakeman cannot follow params into a template it cannot name.
CSRFTokenForgeryCVECross-site request forgery
  • Fix CSRF in Ruby on RailsNo warnings on this card, or on a probe with skip_forgery_protection, skip_forgery_protection if: -> { request.format.json? } and skip_before_action :verify_authenticity_token written directly in controllers.
DeserializeBrakeman 8.1.0
FileAccessBrakeman 8.1.0
ForgerySettingCross-site request forgery
  • Fix CSRF in Ruby on RailsNo warnings on this card, or on a probe with skip_forgery_protection, skip_forgery_protection if: -> { request.format.json? } and skip_before_action :verify_authenticity_token written directly in controllers.
LinkToHrefCross-site scripting
  • Fix XSS in Ruby on RailsNo warnings on this card: the controller picks the template with render "profiles/#{impl}", and Brakeman cannot follow params into a template it cannot name.
MassAssignmentMass assignment
PathnameFile access, path traversal
PermitAttributesMass assignment
RedirectRedirect
SendFileFile access, path traversal
SessionSettingsSession settings
SkipBeforeFilterCross-site request forgery
  • Fix CSRF in Ruby on RailsNo warnings on this card, or on a probe with skip_forgery_protection, skip_forgery_protection if: -> { request.format.json? } and skip_before_action :verify_authenticity_token written directly in controllers.
SQLSQL injection
  • Fix SQL injection in Ruby on Rails4 warnings, all in app/queries/: the two interpolated where() strings and the Arel.sql() order in vulnerable.rb (Medium confidence) and the where() with sanitize_sql_like in wrong.rb (High).
SSRFBrakeman 8.1.0
UnscopedFindUnscoped find

Psalm

4 rules on cards for Laravel

Psalm rules and the fix cards that record them
RuleFix cards and what it found
TaintedFilePsalm taint analysis with the Laravel plugin
  • Fix path traversal in PHP and LaravelOne TaintedFile issue in each implementation, at the call that serves the file: response()->file($path) in VulnerableFileServer.php, $disk->response($requested) in WrongFileServer.php and response()->file($target) in…
TaintedHeaderPsalm taint analysis with the Laravel plugin
  • Fix open redirects in PHP and Laravel1 TaintedHeader issue in VulnerableLoginRedirect.php (intended($next)) and 1 in WrongLoginRedirect.php (redirect()->to()), none in FixedLoginRedirect.php.
TaintedHtmlPsalm taint analysis with the Laravel plugin
TaintedSqlPsalm taint analysis with the Laravel plugin
  • Fix SQL injection in PHP and Laravel3 TaintedSql issues in VulnerableOrderRepository.php (the DB::select() string, whereRaw() and orderByRaw()) and 4 in WrongOrderRepository.php (both whereRaw() calls with addslashes(), the status whereRaw() and…

Find Security Bugs (SpotBugs)

23 rules on cards for Java

Find Security Bugs (SpotBugs) rules and the fix cards that record them
RuleFix cards and what it found
COMMAND_INJECTIONPotential Command Injection
ENTITY_MASS_ASSIGNMENTMass assignment
FILE_UPLOAD_FILENAMETainted filename read
HARD_CODE_PASSWORDHard coded password (and HARD_CODE_KEY)
LDAP_INJECTIONPotential LDAP Injection
OBJECT_DESERIALIZATIONObject deserialization is used (untrusted data)
PATH_TRAVERSAL_INPotential Path Traversal (file read)
PERMISSIVE_CORSOverly permissive CORS policy
SPEL_INJECTIONPotential code injection when using Spring Expression
SPRING_CSRF_PROTECTION_DISABLEDSpring CSRF protection disabled
SPRING_CSRF_UNRESTRICTED_REQUEST_MAPPINGSpring CSRF unrestricted RequestMapping
SPRING_ENDPOINTFound Spring endpoint
SPRING_UNVALIDATED_REDIRECTSpring Unvalidated Redirect (and UNVALIDATED_REDIRECT for sendRedirect)
SQL_INJECTION_SPRING_JDBCPotential JDBC Injection (Spring JDBC)
UNSAFE_HASH_EQUALSUnsafe hash equals
URLCONNECTION_SSRF_FDURLConnection Server-Side Request Forgery and File Disclosure
WEAK_TRUST_MANAGERTrustManager that accept any certificates (SECWTM, CWE-295)
XPATH_INJECTIONPotential XPath Injection
XSS_JSP_PRINTXSS bug patterns
XSS_SERVLETXSS bug patterns
XXE_DOCUMENTXML parsing vulnerable to XXE (DocumentBuilder)

.NET code analysis

18 rules on cards for C#

.NET code analysis rules and the fix cards that record them
RuleFix cards and what it found
CA2100Review SQL queries for security vulnerabilities
CA2326Do not use TypeNameHandling values other than None
CA2327Do not use insecure JsonSerializerSettings
CA3003Review code for file path injection vulnerabilities
CA3006Review code for process command injection vulnerabilities
CA3007Review code for open redirect vulnerabilities
CA3075Insecure DTD processing in XML
CA3147Mark verb handlers with ValidateAntiForgeryToken
CA5350Do not use weak / broken cryptographic algorithms
CA5351Do not use weak / broken cryptographic algorithms
CA5359Do not disable certificate validation
CA5382Use secure cookies in ASP.NET Core
CA5387Do not use weak key derivation function with insufficient iteration count
CA5388Do not use weak key derivation function with insufficient iteration count
CA5390Do not hard-code encryption key
CA5394
CA5404Do not disable token validation checks
  • Fix JWT validation in C# and ASP.NET Core5 warnings: ValidateIssuer, ValidateAudience and ValidateLifetime set to false in VulnerableTokenValidation.cs, and ValidateIssuer and ValidateAudience set to false in WrongTokenValidation.cs; none in…
CA5405Do not always skip token validation in delegates

SonarQube

3 rules on cards for Node.js, Java, C#

SonarQube rules and the fix cards that record them
RuleFix cards and what it found
S2631Regular expressions should not be vulnerable to Denial of Service attacks
  • Fix ReDoS in C# and ASP.NET CoreS2631 is Sonar's C# rule for regular expressions vulnerable to denial of service, classed as a vulnerability; Sonar's C# rules have no S5852.
S5122Cross-Origin Resource Sharing (CORS) policy should be restricted to trusted origins
S5852Regular expressions should not cause catastrophic backtracking

ESLint (security plugin)

1 rule on cards for Node.js

ESLint (security plugin) rules and the fix cards that record them
RuleFix cards and what it found
security/detect-child-processdetect-child-process

detect-secrets

1 rule on cards for Node.js, Python, Java, C#

detect-secrets rules and the fix cards that record them
RuleFix cards and what it found
KeywordDetectorSecret Keyword