Skip to Content
Code ScanningRules

Analysis Mode

Use xgrep's built-in native analyzers via mode: analysis rules.

Some checks are too context-dependent to express as a pattern. "Is this imported name ever used?", "does this self.x read refer to an attribute the class never defines?", "is this regex vulnerable to ReDoS?" — answering these accurately needs whole-file or semantic analysis, not text/AST shape matching. xgrep ships these as native analyzers, dispatched with mode: analysis.

A pattern rule that tries to approximate one of these checks is almost always a false-positive factory; the native analyzer is the precise implementation.

Writing an analysis-mode rule

Set mode: analysis and name an analyzer with analyzer:. The rule carries no pattern — the analyzer produces all findings:

rules:
  - id: my-undefined-attribute-rule
    languages: [python]
    severity: ERROR
    message: Attribute is never defined on the class; this raises AttributeError.
    mode: analysis
    analyzer: undefined-attribute
    metadata:
      category: correctness

Rules of the mode (enforced at load time, mirroring how mode: taint forbids pattern):

  • analyzer: is required and must name a known analyzer — an unknown name is a load error, not a silent no-op.
  • A pattern clause (pattern, pattern-regex, pattern-either, …) is not allowed alongside mode: analysis. Writing analyzer: alone implies mode: analysis.
  • languages: still scopes which files the rule runs on; each analyzer is also internally gated to the language(s) it supports.

Built-in analyzers

analyzer:LanguagesDetects
unused-importpythonImported names never referenced in the file.
unreachable-codepythonStatements after a return/raise/break/continue in the same suite.
go-unreachable-codegoStatements after a return/break/continue/goto/panic in the same statement list. A terminator inside an if/for/switch branch does not make the code after that branch dead, and a labelled statement stays reachable because a goto can jump to it.
go-no-effectgoA call statement whose result is discarded and whose callee, declared in the same file, does nothing else — the value-receiver mistake, where t.addDays(7) should be t = t.addDays(7). A callee that returns nothing, can panic, or is not declared in this file is never flagged.
go-dead-field-storegoA store to a field of a struct value — a value receiver, a by-value parameter, or a local struct — whose copy is never read again, so nothing can observe the write; the func (c counter) reset() { c.val = 0 } that silently does nothing. A pointer base, a base whose address is taken or that a closure/defer/go names, a named result, a field promoted through an embedded type, a compound assignment, an indexed base (xs[0].F), a loop that carries the base across its back edge, and any type the file does not declare as a struct are all silent.
go-unhandled-closegoA discarded Close() error on a handle the same function opened for writing — os.Create, os.CreateTemp, ioutil.TempFile, or os.OpenFile whose flags name O_WRONLY, O_RDWR or O_APPEND. Close is where a buffered write is finally flushed, so a failure there means the data never reached disk and nothing reported it. A result that is returned, assigned or checked is not discarded; a receiver that is not a plain local name (resp.Body.Close(), g.file.Close()) names no handle this function opened; os.Open and O_RDONLY are read-only, and O_CREATE alone says the file may be made, not written; a Sync() whose own error is checked or returned has already reported the flush; and a close inside a closure is left to that closure's own scope. Each of those is silent.
go-redundant-recovergoA call to the builtin recover() that can never stop a panic, because recover only returns a value when a deferred function calls it directly. Two placements guarantee it returns nil: defer recover(), where recover is the deferred call rather than something a deferred function calls, and a recover() inside a function that this file declares, calls at least once, and never defers — the defer func() { handlePanic() }() mistake, which should be defer handlePanic(). A recover that may not be the builtin (shadowed, aliased, or a package of that name), a function with no call site in this file or whose name is taken as a value, a method (whose call sites need the receiver's type), and a func literal that is deferred or merely stored are all silent.
non-callablepythonA call whose callee is provably not callable.
no-effectpythonA bare comparison/arithmetic statement whose result is discarded.
inconsistent-returnpythonA function that returns a value on some paths and None/implicitly on others.
conflicting-signaturepythonA method overriding a local base method with an incompatible arity.
equality-typespython==/!= between operands of known incompatible types (b"x" == "x").
wrong-arg-constructorpythonA constructor / self-method call with an argument count __init__ cannot accept.
wrong-arg-callpythonA module-function call with an incompatible positional-argument count.
first-param-not-selfpythonAn instance method whose first parameter is not self.
invalid-escapepythonA non-raw string/bytes literal with an unrecognized backslash escape ("\d").
undefined-attributepythonA self.x read where x is never defined on the class or a local base.
use-before-defpythonA local variable read on a path where it is never bound first (UnboundLocalError).
empty-exceptpythonA try whose except handler body is a single pass, silently swallowing the error (CWE-390).
redundant-comparisonpythonA comparison made constant by a preceding elif/guard over the same operands (CWE-570).
redos-staticpythonA re.* call whose string-literal pattern has catastrophic-backtracking (ReDoS) shape (CWE-1333).
python-should-be-context-managerpythonA class that releases what it holds in __del__ while declaring no context-manager protocol, so its instances cannot be scoped with a with statement and release waits on the garbage collector (CWE-404). A class is treated as a context manager — and is silent — when it declares __enter__ and __exit__, or __aenter__ and __aexit__, when a base class defined in the same file declares either pair, or when a base is a stdlib context-manager helper (contextlib.AbstractContextManager, ExitStack, ContextDecorator, …). A __del__ whose body is only pass, ... or a docstring releases nothing, so it is silent as well, and a @contextlib.contextmanager generator is not a class and is never considered.
python-format-string-mixed-fieldspythonA str.format format string that mixes automatic ({}) and manual ({0}) field numbering, which raises ValueError: cannot switch from automatic field numbering to manual field specification the moment it is formatted. The literal must reach a .format(...) call — directly, or through a name the file binds exactly once — so a string nothing formats is not reported. The format mini-language is parsed as CPython parses it: {{ and }} are escaped braces and not fields ("<td class={}>{{}}></td>" is legal), a keyword field ({name}) is neither automatic nor manual, {0.attr} and {0[1]} are manual while {.__name__} and {[0]} are automatic, and a nested format spec counts toward the numbering ("{:{w}}" is legal, "{0:{}}" is not). An f-string, a bytes literal, .format_map(), %-formatting, a format string the file cannot see (a parameter, a concatenation, a name assigned twice), and a string CPython cannot parse at all — a lone {, which raises a different ValueError and is a separate defect — are all silent.
duplicate-bindingjavascript, typescriptA name bound twice in one parameter list or destructuring pattern.
duplicate-propertyjavascriptAn object literal that declares the same data-property key more than once.
duplicate-var-decljavascriptA var name declared more than once in the same function scope.
javascript-unused-variablejavascript, typescript, tsxA variable declared with an initializer and never referenced in its scope.
use-of-returnless-functionjavascriptThe result of a function that never returns a value is used (always undefined).
prototype-pollutionjavascript, typescriptA for…in / Object.keys() copy into an object without prototype-key guards.
incomplete-url-schemejavascript, typescriptA scheme allowlist recognizing some but not all of javascript:/data:/vbscript:.
incomplete-url-substringjavascript, typescriptA substring hostname check not anchored to the URL's host.
incomplete-html-sanitizationjavascript, typescriptA .replace() chain missing some attribute-breaking characters.
unsafe-cert-trustjavaTLS endpoint identification disabled or never enabled.
expose-representationjavaA public method returns a private array/Map field by reference, or stores a parameter straight into one (CWE-495). A field whose every write is an unmodifiable view or an immutable value already carries the fix the message recommends — a caller's put throws — so it is silent; one unguarded write, such as a setter storing its parameter, keeps it reported. Anything in a test source root is silent: the "external caller" there is the test beside it.
java-calls-to-runnable-runjavaA direct run() call on a receiver whose type inherits java.lang.Thread, which runs the body on the current thread instead of starting a new one (CWE-572). Only the extends chain counts: a class that merely implements Runnable has a run() that is meant to be called. super.run() inside an override, this.run(), a call with arguments, and a receiver whose type the scan cannot resolve are all silent.
java-compare-identicaljavaA comparison whose two operands are the identical value (x == x), always constant — a likely copy-paste bug.
java-confusing-method-namejavaA class declaring public boolean equals(SameType) — a confusing overload of equals(Object), never invoked by standard callers.
java-control-charsjavaA string/char literal containing a literal control or zero-width character instead of an explicit escape.
java-equals-arrayjavaequals()/hashCode() called on an ARRAY receiver, which compares/hashes identity rather than contents — use java.util.Arrays (CWE-595).
java-hashed-but-no-hashjavaAn object whose type overrides equals() but inherits hashCode(), inserted into a hash-based collection (HashMap, HashSet, Hashtable, ConcurrentHashMap, …), where equal instances hash differently and the lookup silently misses. IdentityHashMap compares by reference and TreeMap/TreeSet order by comparator, so neither is flagged; a key type the scan cannot resolve is silent.
java-inner-class-could-be-staticjavaA non-static nested class whose body never uses the enclosing instance, so the implicit outer reference is pure overhead (CWE-1070).
java-non-serializable-fieldjavaA non-transient, non-static field of a Serializable type whose own type provably does not implement Serializable (CWE-594).
java-number-format-exceptionjavaA wrapper-class parse entry point — Integer.parseInt, Integer.valueOf(String) including the radix form, Integer.decode, new Integer(String) — whose NumberFormatException no enclosing try/catch handles and no enclosing method declares. A numeric or character literal argument, and a primitive cast, bind an overload that cannot throw. A compile-time-constant STRING argument that provably parses for that type and radix is also silent, because no exception can occur — but only when it is in range and decidable: Byte.parseByte("200") and Integer.valueOf("7f", 10) still fire, and a constant that never parses is the stronger finding.
java-pointless-forwardingjavaA one-parameter method whose whole body forwards that parameter (plus one more argument) to another method — removable indirection.
java-self-assignmentjavaA plain assignment whose two sides are the identical expression (x = x) — a no-op, likely a missing this. qualifier.
java-unread-localjavaA write to a local that the immediately following statement overwrites without reading it, so the value computed is discarded (CWE-563). Strict adjacency is what makes it provable without a control-flow graph: no code can run between the two writes. A second assignment that reads the variable (result = replace(result, …) is a transform chain, not a dead store), a compound-assignment or ++ overwrite (both read), an array-element or field target, and a name the enclosing callable does not declare as a local are all silent.
java-missing-space-typojavaTwo concatenated string literals whose seam runs two words together, producing textis (CWE-1078). Silent when a separator is already present on either side, when the first ends with a %n platform newline or a list/markup/path delimiter, when a dot continues a qualified name ("java.util." + "ArrayList"), and whenever one operand is not a literal — "<doc>" + output has no literal seam. An ellipsis, ? or ! before a capital is sentence punctuation and does count.
java-empty-methodjavaA public or default method whose body is empty and nothing says that is deliberate (CWE-1071). A comment inside the braces is the explanation the message asks for and is a named child of the block, so it counts; a preceding // line does not, since that is where a marker comment usually sits. Any annotation (@Override, @Pointcut, a framework callback), a preceding javadoc, an abstract/native declaration with no body at all, a non-public method, and anything in a test-named type or a test source root are all silent.
java-avoid-deprecated-callablejavaA call to a method or constructor declared @Deprecated in the same file, from a context that is not itself deprecated (CWE-477). The pattern form it replaces matched the deprecated declaration, so every finding was an announced deprecation rather than a use of one. The callee is resolved by declaring type, name and arity: a live overload accepting the same argument count is silent, and a receiver whose type the file does not name is not resolved at all. A caller annotated @Deprecated or @SuppressWarnings("deprecation") is silent.
java-iterator-remove-may-failjavaA zero-argument Iterator.remove() whose iterator came from a collection that does not support removal — Arrays.asList (a fixed-size view of the array), Collections.singleton*/unmodifiable*/empty*/nCopies, or List.of/Set.of/Map.of — so the call throws on every input. The three chained patterns it replaces (Arrays.asList(...).iterator().remove() and a $LIST = Arrays.asList(...); ... $LIST.iterator().remove(); gap) described a shape real code does not write and matched nothing, including on their own fixture. The collection is followed file-locally instead: through initializers and = assignments, into fields, into the parameters of callables declared in the same file, and back out through their return values. A copy into a JDK collection (new ArrayList<>(Arrays.asList(…))) propagates nothing, because that constructor is not declared here — which is also why it is the recommended fix. A remove(x) taking an argument is Collection.remove rather than the iterator's, and a collection whose origin is in another file is silent.
java-label-in-switchjavaA statement label written among a switch's case labels, which reads like a case that lost its keyword (CWE-484). The container pattern it replaces (switch ($EXPR) { ... $LABEL: ; ... }) is not a parse unit, so its ... compiled to a whole-file regex and it matched every switch statement in the codebase. Only the colon form can carry one, since a switch rule's body is an expression, block or throw (JLS 14.11.1); a label nested inside a braced block within a case is ordinary labelled-loop code and is silent.
java-constant-loop-conditionjavaA loop whose condition reads only values the loop cannot change, so it never runs or never stops on its own (CWE-835). The patterns it replaces checked for no modification at all, and one of them was literally while(true) { ... } — the standard idiom for a loop whose exit is computed mid-body, and a shape the fixture itself marks OK. Every name in the condition must be a local/parameter or a final field in this file, and the condition must be free of calls, field accesses and array indexes; a non-final field abstains, since while (!stopped) is written from another method or thread. while (true)/for (;;) have no variable to be unmodified, and a body that exits unconditionally is a loop used as an if-statement.
java-inconsistent-equals-hashcodejavaA type declaring exactly one of equals()/hashCode(), breaking the contract that equal objects hash equally (CWE-581). Compared by name and arity with the parameter's annotations ignored, so equals(@Nullable Object) counts as an override — the pattern form could not see it, and reported classes that override both. A refining equals that delegates to super.equals narrows the equivalence classes rather than redefining them, so the inherited hashCode still agrees and it is silent.
java-useless-comparisonjavaAn integer comparison against a literal that the enclosing condition has already settled, so the branch it guards always runs or never does (CWE-570/571). Facts are carried from an if into the branch it controls, and past an if whose every path throws or returns. A write to the variable — including anywhere in an enclosing loop — abandons the fact, and arithmetic is not tracked through, so a value derived by computation is silent.
kotlin-calls-to-thread-runkotlinA no-argument run() call on a receiver this file types as a Thread, which runs the body on the current thread instead of starting a new one (CWE-572). The decisive work is telling that call from Kotlin's run scope function, which is idiomatic on any receiver at all: t.run { … }, a bare run { … } and t.run() { … } each carry a trailing lambda and are silent, so only an explicit receiver with an empty argument list and no lambda is considered. The receiver's type is then resolved from the file itself — a declared type, a constructor call, an object : Thread(), an as cast, or a local class whose superclass chain reaches Thread. A receiver the file does not type is silent, because x.run() on an unknown x is far more likely to be some other object's own run. A Runnable, an implemented interface (class Job : Runnable), super.run() inside an override, and this.run() are all silent too.
implicit-pending-intentjavaA mutable implicit PendingIntent reaching a broadcast/activity sink (CWE-927).
sensitive-broadcastjavaSensitive data broadcast in Intent extras without a permission (CWE-927).
insecure-basic-authjavaA Basic auth header sent after a plaintext http:// URL (CWE-522).
lock-orderjavaInconsistent lock acquisition order across methods (deadlock, CWE-833).
type-narrowingjavaA compound assignment narrowing a wider type (int += long, CWE-190).
kotlin-close-resourcekotlinA local val/var initialized with a constructor that acquires an OS handle — FileInputStream, FileOutputStream, FileReader, FileWriter, RandomAccessFile, ZipFile, JarFile, Socket, ServerSocket, a Buffered*/InputStreamReader/PrintWriter wrapper around one of those, or a Files.new* factory — whose lifetime is never handed to use { } and which is never closed (CWE-404/-772). Kotlin's answer to try-with-resources is use { }, an ordinary sibling expression rather than a syntactic container, so what decides the question is not the declaration's shape but whether EVERY later mention of the name is a plain read. A resource constructed straight into use { }, closed anywhere in the function (including in a finally or catch, and through ?., !! or closeQuietly), returned, assigned to a field or another name, passed as an argument, or mentioned inside a lambda is silent — in each of those the value may outlive the function, and guessing there is how a rule like this becomes noise on an I/O-heavy codebase. A property of a class, object or file is silent too: its lifetime is the owner's. Kotlin's stdlib factory extensions (inputStream(), bufferedReader(), reader(), source()) are deliberately not seeded, because the same method names are used on in-memory receivers such as Buffer() or a ByteArray, and telling those apart needs the receiver's type.
ruby-incomplete-sanitizationrubyA .sub/.sub! that removes only the first occurrence of a metacharacter.
javascript-asi-hazardjavascriptA line break where automatic semicolon insertion changes what the code means (CWE-670). Either the parser joins two lines rather than separating them — a following ( becomes a call or new arguments, [ an index, a template a tagged-template call, and a regex opening with / a division — or a bare return ends its statement at the line break, so the value on the next line is never returned. A missing semicolon that ASI resolves as written (before a } or a keyword), ordinary multi-line code whose continuation begins on the line the left part ends, continuations with only one possible reading (a leading ., ?., ,, + or -), an early return in a brace-less if, and a bare yield are all silent.
javascript-misleading-indentationjavascriptA statement indented to the body column of a preceding brace-less if/else/while/for, so it reads as a second body statement but always runs (CWE-483). A braced body, a follower at the control statement's own column, a body not indented past its control statement, and do … while are all silent.
javascript-missing-this-qualifierjavascript, typescriptA bare identifier inside a class method that names one of that class's own members — a field, a method, or a this.X = … target — so the reference reaches a global or an outer binding instead of the member (CWE-682). A name bound anywhere in the file, a standard global, a call to the enclosing method itself, and constructor are all silent.
javascript-arguments-redefinedjavascript, typescript, tsxAn occurrence of the name arguments, inside a function, in a position that rebinds it rather than reads it: a parameter (including a rest or destructured one), a var/let/const declarator, a plain or compound assignment, a for … in/of loop variable, a catch parameter, or a nested function/class declaration (CWE-710). A read, a write through the object (arguments[0] = 1, arguments.length = 0), a property or key that merely spells the name, and any occurrence outside a function are all silent.
javascript-bad-typeofjavascript, typescript, tsxA typeof result compared against a string typeof can never return — 'array', 'null', 'Object', or a typo — so the test has a constant result and the branch behind it is dead (CWE-570/571). Covers all four equality operators, either operand order, a parenthesised operand, and switch (typeof x) { case … }. A non-constant string, a template with a substitution, a string carrying an escape sequence, typeof on both sides, and the host extensions 'unknown'/'date' are all silent.
javascript-property-write-on-primitivejavascriptA property or index WRITE whose receiver is provably a primitive: a literal ((0).foo = 42), or a local the file binds only to primitive literals. The write is silently discarded (CWE-704). A null/undefined receiver throws rather than no-opping and belongs to a different rule; parameters, uninitialised locals, and any name assigned more than once are silent.
nodejs-cyclic-importjavascript, typescript, tsxA require/import whose resolved target can reach back to the importing file through the project's resolved module edges — a circular dependency — rather than every require indiscriminately. Only edges that survive compilation count: TypeScript erases a type-only import (import type { T } from './m', export type { T } from './m', or a clause whose every specifier is inline-typed), so a loop built from those is not reported, and neither is one closed by the type operator import('./m').T. A clause that still pulls a value (import { type T, v } from './m') and a real await import('./m') both keep their edge and still fire.
nodejs-unresolvable-importjavascript, typescript, tsxA relative import that names no file on disk, or a bare import that is neither a Node builtin nor a declared dependency — a module that will not resolve at runtime. Both need evidence of what the project should contain: a relative import is only judged when the tree carries a package.json, tsconfig.json or jsconfig.json, and a bare import only when there is a package.json declaring dependencies. Scanning a loose directory of files, or a partial checkout with no project marker, reports nothing — the same missing sibling is what an incomplete checkout produces. An import whose target exists but was not part of the scan (a single-file or subdirectory scan, or a vendored/generated target) is not reported either.
nodejs-dubious-importjavascript, typescript, tsxA subpath import that reaches past a dependency's declared public interface (its package.json exports) into an internal file Node would refuse to resolve.
nodejs-missing-exportsjavascript, typescript, tsxA named import (import { x } / const { x } = require) of a binding the target module — statically enumerable — does not export. TypeScript's own export forms count as exports, including the erased ones: importing an export type, export interface, export enum, export declare …, export abstract class or export namespace is never reported. A module that publishes its whole object with export = expr has no enumerable named surface, so nothing is reported against it.
javascript-unused-parameterjavascript, typescript, tsxA function parameter never referenced in the function it belongs to (CWE-561). Only the trailing run of unused parameters is reported — an earlier one is positionally pinned by a later used one — plus individually unused names inside a destructuring parameter. A bodyless signature (a TypeScript overload, declare, abstract, an interface method, a function type), an overload implementation, a setter, a method of a class that extends or implements, a TypeScript parameter property, an _-prefixed name, an empty body, and any body mentioning arguments or eval are all silent.
javascript-redeclared-variablejavascript, typescript, tsxA name bound more than once in one lexical scope where at least one binding is let, const, class, an import or a catch parameter — the collisions the language rejects with a SyntaxError (CWE-710). Two sibling blocks, two branches of an if, two functions, a for head and its own body, duplicate vars, duplicate function declarations, duplicate parameters, TypeScript overload signatures and ambient declare merging are all silent.
javascript-unused-index-variablejavascript, typescript, tsxA counted loop that ranges an index over ARR.length while every subscript of ARR in its body uses a constant index instead of that variable — for (var i = 0; i < xs.length; ++i) res += xs[0];, the copy-paste defect where xs[i] was meant (CWE-563). The loop runs xs.length times and reads the same element every time. A body with no ARR[…] at all is silent: an index nobody reads is a far weaker observation and not this rule. So is any body where some ARR[…] has a computed index, or where any subscript on any base is indexed by the loop variable — including through a shadowing inner binding. A reverse loop (whose greater operand is 0, not ARR.length), a member base (this.items.length), and a compound lesser operand (i + 1 < xs.length) are all silent too.
javascript-assignment-to-constjavascript, typescript, tsxAn assignment whose target resolves to a const binding (CWE-563): a plain or augmented assignment, an update expression, a destructuring target, a for … of head with no declaration keyword, or a var initialiser or class declaration over the same name. A target that resolves to a let, var, parameter, import or function, an unresolved name, and a property write on a const object are all silent.
ruby-dead-store-of-localrubyA local variable assigned a value that the immediately following statement overwrites without reading it (CWE-563). Both statements must be plain name = expr assignments to the same local and the overwriting right-hand side must never mention the name, so an accumulator (x = x + 1, s = s.upcase), a conditional overwrite (x = 2 if c), an x += 1 operator assignment, a non-local target (@ivar, CONST, h[:k], obj.attr =), a multiple assignment, and any variable an enclosing rescue/ensure mentions all stay silent.
kotlin-self-assignmentkotlinA plain = assignment whose two sides are the identical side-effect-free path (x = x, this.x = this.x, cfg.a.b = cfg.a.b) — a no-op, usually a this.x = x that lost its right-hand side. Kotlin parameters are always val, so the Java form of this bug (param = param shadowing a field) does not compile and the reachable surface is a mutable property or a local var; the idiomatic this.name = name differs by the this. and stays silent. A compound +=, an indexed write (a[i] = a[i] is the get/set operator pair, which on a map inserts the key), a receiver holding a call (make().x = make().x evaluates it twice) and any property declared with a get()/set() accessor or a by delegate are all silent; a named argument (copy(name = name)) is not an assignment at all.
kotlin-static-arraykotlinA shared, publicly visible array whose elements any caller can overwrite (CWE-607): a companion-object property, a top-level property, or an object singleton's property holding a non-empty array. val freezes the reference exactly as Java's final does, never the elements, so Owner.CODES[0] = 99 compiles and changes the value for the whole process; a var is worse still, since the reference is writable too. Kotlin declarations are public by default, so visibility is read as the absence of private/internal/protected on the property and on every enclosing declaration. An array that is provably empty exposes nothing and is silent: intArrayOf() and the other factories called with no arguments, arrayOf(), emptyArray(), arrayOfNulls(0), and a sized constructor with a literal zero (IntArray(0), Array(0) { … }). Where there is no inline initialiser the value is read from the body's init { } block. A const val cannot hold an array at all, and a property with no readable value — lateinit, a custom getter, a delegate, = null — is silent, as is an ordinary class property, which is per-instance rather than shared.
swift-cleartext-logging-string-writeswiftA sensitive value written into a String (print/debugPrint/dump(SENSITIVE, to: &s), s.write(SENSITIVE), SENSITIVE.write(to: &s)) that is later console-logged bare (print/debugPrint/dump(s) with no to: redirect) — indirect cleartext logging (CWE-312/532). A string that only received harmless data, or a sensitive write into a string that is never bare-logged, stays silent.
go-integer-overflow-conversiongoA strconv parse result narrowed to a smaller fixed-width integer type without a bounds check, where the value is not used as a size or index — a correctness smell (CWE-190/681, audit).
go-integer-overflow-conversion-sinkgoA strconv parse result narrowed without a bounds check whose value reaches a make size, a slice index, or a slice bound — an undersized allocation or out-of-range index from attacker input (CWE-190/681).
go-ssh-auth-bypassgoAn ssh.ServerConfig auth callback whose body always returns a nil error, accepting every client (CWE-287).
go-slice-boundsgoA constant index/slice bound that provably exceeds a slice's known length/capacity, panicking at runtime (CWE-125).
go-dead-storegoAn assignment to a local variable whose value is never read before being overwritten or returned, via backward liveness (CWE-563).
csharp-dead-storecsharpAn assignment to a local variable whose value is never read before being overwritten or the scope exits, via backward liveness (CWE-563).
csharp-useless-null-coalescingcsharpA ?? or ??= whose two operands are the same plain name, so the operator does nothing (CWE-561). The pattern it replaces was $X ?? $Y — every ?? in the language, one of C#'s most common operators. Both sides must be an identifier or a dotted name (this. normalised away, since Field and this.Field are the same storage); a call or an indexer can differ between evaluations or have an effect when evaluated, so neither is compared.
csharp-static-field-written-by-instancecsharpA non-static member assigning a static field of its own type with a plain = (CWE-362). Replaces a class $C { ... static $T $F; ... } container pattern whose backreference-over-gap regex exhausted the 500 ms match budget — a pattern-inside timeout reads as "no match", so findings were dropped silently. The pattern also required the declaration to end at the name, so a field with an initialiser (static bool _f = false;) never matched at all. A local or parameter shadowing the name, a static member, and a nested type's members are all silent.
csharp-unchecked-return-valuecsharpA call whose result IS the outcome, discarded as a statement (CWE-252). "Discarded" is one AST fact — the invocation's parent is an expression_statement — which subsumes the seven pattern-not clauses it replaces and also covers a link in a fluent chain, which none of them did. The receiver must be a plain variable, and one whose declared type mutates in place and returns itself (StringBuilder.Replace) is silent. The allowlist is carried over unchanged, including the deliberate absence of Add.
csharp-catch-generic-exceptioncsharpA blanket catch that lets nothing out (CWE-396): a bare catch, or one naming exactly Exception/System.Exception, with no when filter and no throw that propagates from the clause. The pattern-not-regex: '\bthrow\b' exclusion it replaces could not tell the word from a throw statement — on a real corpus it was silenced by a clause's own // TODO: Is it correct to not throw here?. A throw nested in a lambda, anonymous method or local function runs when that body is invoked, not when the clause rethrows, so it is still reported.
csharp-pointless-forwarding-methodcsharpA method whose whole body calls another overload of its OWN name, so the target could take a default argument instead (CWE-561). The pattern it replaces bound $PARAMS to the declaration list on the left and the argument list on the right, so int p never equalled p — it matched only parameterless forwards and found nothing on its own fixture. The call must land on an overload the type declares, matched on argument count; an explicit interface implementation is mandatory and silent, a call through another object or a delegate field is a wrapper rather than a forward, and a name with two forwarders is silent because two signatures cannot collapse into one default.
csharp-inconsistent-equals-hashcodecsharpA type overriding exactly one of Equals(object) and GetHashCode() (CWE-581). The container pattern it replaces matched the PRESENCE of one member and never required the other to be absent, so it reported the classes that correctly override both. public new hides the base method rather than overriding it, so a base-typed reference still reaches object's version and the contract is still broken — which is what separates the fixture's two BAD classes from its GOOD one.
csharp-class-missing-equalscsharpA type declaring equality — an ==/!= operator, or an IEquatable<T> base — without overriding Equals(object) (CWE-595). Its pattern and message had been about GetHashCode, which is csharp-inconsistent-equals-hashcode's subject; its own fixture is about operators and IEquatable. An abstract type may leave Equals to its subclasses and is silent, as is a type inheriting IEquatable through a base class that supplies Equals(object).
csharp-recursive-equalscsharpA call inside override bool Equals(object p) that re-enters the same override — Equals(p) or this.Equals(p) with the parameter passed UNCAST, so overload resolution picks this method again and it recurses until the stack is gone (CWE-674). The pattern it replaces required the receiver to be written this., which its own fixture does not write; dropping that alone would have reported the fixture's GOOD case, which is also a bare call but passes a CAST argument and so selects a typed overload. base.Equals(p) terminates and is silent.
csharp-unchecked-cast-in-equalscsharpA cast of the parameter inside override bool Equals(object p) where the method establishes its type nowhere, so a caller passing another type gets an InvalidCastException instead of false. The pattern it replaces required the cast to be assigned to a local as the first statement; its own fixture casts inline inside a return. p is T, p as T and p.GetType() all count as a test — deliberately without asking whether the test dominates the cast, since being wrong there would report correct code.
csharp-public-static-arraycsharpA public static field of array type holding a non-empty array (CWE-607): readonly freezes the reference, never the elements, so any caller can write through it and change the value for the whole process. The pattern it replaces, public static $TYPE[] $FIELD = ...;, has no slot for readonly between static and the type, which is how every labelled field in its own fixture is written. An array that is provably empty — a literal-zero dimension, an empty initialiser list, or Array.Empty<T>() — has nothing to mutate and is silent; where there is no inline initialiser the value is read from the type's static constructor.
csharp-equals-uses-iscsharpAn override bool Equals(object p) on a non-sealed class or record whose whole verdict is p is T (CWE-697). is is true for every subclass of T, so a base instance reports itself equal to a derived one while the derived type's own Equals does not — the symmetry clause of the object.Equals contract, which Dictionary, HashSet and Distinct all assume. Sealed-ness is the entire difference between the two methods in its fixture, and the patterns this replaces could not read a class modifier. A sealed class, a struct or record struct, a GetType() equality anywhere in the body, and a verdict that also compares values (p is T t && t.X == X) are all silent.
csharp-equals-uses-ascsharpAn override bool Equals(object p) on a non-sealed class or record whose whole verdict is whether p as T succeeded (CWE-697) — the same question is asks, with the same asymmetry. Read through a local (var o = p as T; … o != null) or inline ((p as T) != null). A sealed class, a struct or record struct, and a GetType() equality are silent, as is a null test used as a guard in front of a value comparison: that method's answer is the comparison, and an unguarded dereference of the cast result is a NullReferenceException rather than this defect.
csharp-object-comparisoncsharpA ==/!= where EXACTLY ONE operand is cast to object or to an interface declared in the same file. C# resolves operator == statically and neither target declares one, so the cast discards the operand's specific type and the comparison silently becomes reference equality while still reading as a value comparison (CWE-697). The pattern it replaces, (object)$X == (object)$Y, required BOTH operands cast and only to object, so it matched none of the four lines its own fixture labels BAD — and the two-cast shape it did match is not the defect: casting symmetrically is a deliberate, legible reference comparison. A cast to a CLASS is silent, because a narrowing cast to a concrete type can ENABLE a typed operator ==, the opposite of the defect. Comparison against null, default, or a field the file proves is always null is a null test and is silent, as is a comparison inside a Moq Mock.…/It.… specification lambda, which is an expression tree Moq reads rather than code that runs. Interfaces are recognised only where the same file declares them; one declared elsewhere is a known miss, taken in preference to an I-prefix naming heuristic that would collect IPAddress and every other class the convention collides with.
csharp-missed-ternary-opportunitycsharpAn if/else whose two branches each reduce to one statement and differ only in one value: both return <expr>;, or both an assignment with the same operator to the same target (CWE-1078, INFO). The pattern it replaces could express neither of its own fixture's BAD lines — one RETURNS rather than assigning, and the other assigns the same field written this.Field on one side and Field on the other, which a metavariable binds as two different texts. Nested blocks are unwrapped and comments ignored; a branch that does anything else as well is not a ternary, and other.Field is a different target.
csharp-useless-is-before-ascsharpAn as expression in the then- or else-branch of an if whose condition bare-type-tests the SAME operand against the SAME type, so the value is tested twice (CWE-561). The pattern it replaces required the as to initialise a declaration ($TYPE $Y = $X as $TYPE;), which its own fixture never writes, so it reported nothing there. An as written inside a method-call ARGUMENT is exempt, because it may be selecting an overload — that is what separates the fixture's M(x as string) (silent) from (x as string) + " " (reported) one line apart. A declaration pattern (x is T t) or a negated pattern is not a bare type test and is silent, as is an as to a different type or on a different expression.
csharp-unused-labelcsharpA labeled statement whose name is never named by a goto in the same method/function scope, dead code (CWE-561).
csharp-null-derefcsharpA dereference of a local flow-sensitively bound to null (T x = null; … x.M) with no intervening null guard or reassignment (CWE-476).
csharp-chained-is-checkcsharpAn if/else-if chain of more than five is tests against types declared in the same file, reported once at the chain head (CWE-710).
csharp-non-overriding-methodcsharpA method that silently hides an overridable base method declared in the same file instead of overriding it (CWE-710).
csharp-non-short-circuit-logiccsharpA boolean-shaped &/| whose right operand dereferences or calls, where &&/|| was meant (CWE-691).
csharp-path-combine-rootedcsharpA Path.Combine call with a provably rooted string literal after the first argument, which discards every earlier argument (CWE-426).
csharp-self-assignmentcsharpA no-op assignment whose left- and right-hand sides are the identical lvalue (x = x, obj.P = obj.P), CWE-480/-561.
csharp-nested-loop-shared-varcsharpA nested for-loop that mutates a loop variable declared by an enclosing for-loop, clobbering the outer counter (CWE-670/-682).
csharp-stringbuilder-char-initcsharpA StringBuilder constructed with a character-literal argument, which binds to the int-capacity overload instead of setting content (CWE-704).
csharp-redundant-tostringcsharpA no-argument .ToString() used as an operand of string concatenation, where + already converts it (CWE-561).
csharp-int-get-hash-codecsharpA GetHashCode() call on a provably small-int receiver (default(int) / (int) cast of int/short/ushort/byte/sbyte), whose hash is the value itself — a useless call (CWE-561).
csharp-hashed-but-no-hashcsharpthis used as a key/element of a hash-based collection (Dictionary/HashSet/Hashtable/ConcurrentDictionary) inside a type that overrides exactly one of Equals/GetHashCode — a silent lookup-failure bug (CWE-697).
csharp-dead-binding-storecsharpA binding that introduces a local never read in its scope: an is/case declaration-pattern variable, or a using-statement resource variable, whose value is discarded (CWE-563).
csharp-empty-catch-blockcsharpA catch clause whose body is literally empty — no statement and no explanatory comment — so the exception is swallowed without a record (CWE-390).
csharp-futile-conditional-empty-ifcsharpAn if with an else clause whose then-branch AND else-branch are both empty (an empty block or ;, with no comment trivia) — the whole conditional is a no-op (CWE-561).
csharp-abstract-to-concrete-collectioncsharpA cast of a value declared as an abstract collection interface (IEnumerable/ICollection/IList/IDictionary and friends) down to a concrete collection class or an array (CWE-710). The declared type promises only the interface, so any other implementation the caller passes throws InvalidCastException. The operand's declared type is resolved from a parameter, an explicitly typed local, a foreach variable or a field/property in the same file, so an ordinary downcast from object or a base class is silent — as are a cast to an interface, an upcast, the null-yielding as form, a guarded is pattern, and a local visibly initialized with new of the cast's own type.
csharp-expose-representationcsharpA public method or property of a type that returns one of that type's private array fields by reference, or stores a parameter straight into one (CWE-495). Replaces a public $TYPE[] $METHOD() { return $FIELD; } pattern that was the getter direction only, had no property form, and matched nothing — not even its own fixture. The exposing MEMBER is the subject, not the call site that passes the array: that is where the fix goes, and it is the same subject the Java sibling settled on for the same CodeQL query family. A defensive copy on either side (return (int[])f.Clone(), f = p.ToArray()), a non-public accessor, a private nested type, a constructor, a field that only ever holds an empty array, and anything in a test project are all silent. readonly is not treated as a defence, because it fixes the reference and not the elements.
csharp-simplify-bool-expressioncsharpA boolean expression carrying a redundant true/false literal (CWE-1078): a comparison (b == true), a short-circuit (b && true), a negated equality (!(x == y)), or a conditional with a literal arm (b ? true : false). Exactly one operand may be the literal — two is a constant condition, an always-true/dead-code defect rather than a simplifiable expression. Ordering comparisons under ! are excluded because every comparison involving NaN is false, so !(d > e) and d <= e disagree on floating point; &, `
csharp-possible-loss-of-precisioncsharpAn integral / or * whose result is widened to a floating-point or decimal type, where the narrowing is not provably harmless (CWE-681/-190). The two patterns it replaces were double $X = $A / $B; and the float twin, both of which require a declaration WITH an initialiser, while every labelled line in the rule's own fixture assigns to an already-declared variable — so the rule reported nothing on the file it ships with. Dropping the declaration would not have been enough: d = 1 / 2; (the fraction is lost), d = 4 / 2; (exact), d = 1 / 2.0; (floating-point division) and i = 5 / 10; (an integer target promised no fraction) are one shape and four different answers, which needs the declared type of each operand and of the target plus constant folding to tell apart. A division that provably divides evenly or divides by 1, a multiplication whose constant product provably fits its own arithmetic type, and an operand or target whose type the file does not state are all silent — as are % (an integer modulo is exact, so nothing is lost), a var target, a method return type, and an argument position, each of which would need information a file-local inference does not have.
kotlin-inconsistent-equals-hashcodekotlinA type overriding exactly one of equals(Any?) and hashCode() (CWE-581). A data class or value class generates only the half its body does NOT supply, and generates it from the primary-constructor properties — so overriding neither is correct and is silent, while overriding exactly one is the Kotlin-specific form of the bug: the compiler quietly supplies a value-based counterpart that disagrees with the hand-written half. The analyzer deliberately models none of the generated members; it is the plain XOR of the explicit overrides, and the correct "overrides neither" case falls out of it. override is required, so fun equals(other: Worker) is read as the overload it is and leaves the inherited override in place. An enum class (both halves are final in java.lang.Enum), an annotation class, and an interface (which may not implement a member of Any) cannot exhibit the bug and are excluded; a type that re-abstracts one half (abstract override fun hashCode(): Int) has deferred it on purpose and is silent, as is a refining equals that delegates to super.equals. A companion object is its own member scope and its overrides are never read as the enclosing type's.
c-buffer-boundsc, cppA copy/write whose constant byte length provably exceeds a fixed-size destination buffer's known capacity, an out-of-bounds write (CWE-787/121/122).
c-oversized-readc, cppA byte-oriented read (read/pread/recv/recvfrom/fgets/fread) whose CONSTANT byte length provably exceeds the known capacity of a fixed-size local destination buffer — a stack/heap array, or a constant-sized malloc/calloc/alloca/new[] pointer not since reassigned — so external input overruns it (CWE-120/CWE-787); the safe sizeof(dst)-bounded idiom (length == capacity) and any non-constant length are not flagged.
c-free-not-on-heapc, cppA free()/delete of a pointer provably bound to non-heap storage — a stack array, alloca, &local, or string literal (CWE-590).
c-mismatched-freec, cppA deallocation whose routine does not match the allocation — free() of a C++ new/new[] pointer, or delete/delete[] mismatching new[]/new/malloc (CWE-762).
c-uninitialized-varc, cppA read of a local scalar/pointer variable declared with no initializer and never written before the read (CWE-457).
c-improper-initc, cppA read of a fixed-size char/wchar_t array whose contents were never initialized — the buffer (or a pointer aliased onto it) reaches a string-read sink (strcat/strncat/strlen/printLine…) with no earlier memset/strcpy/element-write/&escape initializing it (CWE-665); the aggregate companion to c-uninitialized-var.
c-memory-leakc, cppA heap allocation stored in a local pointer that reaches function exit never freed, returned, stored, or handed to an unknown callee (CWE-401).
c-explicit-null-derefc, cppA dereference of a local pointer provably bound to a NULL constant (int *p = NULL; … *p), the explicit-NULL half of CWE-476 that taint cannot source.
c-interproc-uafc, cppA use-after-free where an in-file helper unconditionally frees a pointer parameter — a C++ reference-to-pointer (void f(T *&p){ … free(p); }) or a by-value pointer (void f(T *p){ … free(p); }) — and the caller then dereferences the dangling pointer (CWE-416).
c-unchecked-return-valuec, cppA call to a fallible libc function (scanf/fscanf/sscanf/fread/fgets/rename/remove/system/freopen/fseek…) whose return value is discarded — the call is a bare expression statement — so a failure or short read goes undetected (CWE-252).
c-unchecked-privilege-dropc, cppA privilege-relinquishment call (setuid/setgid/seteuid/setegid/setres*/setgroups…) whose return value is discarded, so a failed drop leaves the process running with its original (often root) privileges — a privilege-escalation exposure (CWE-252→CWE-273).
scala-fail-open-verificationscalaA throwing security verifier (a JWT/signature verify, parseClaimsJws, or a compound verify name; verify/authenticate on a security-typed receiver) inside a try whose catch has a case that returns true, so a failed verification is swallowed and an invalid credential is treated as valid — a fail-open auth bypass (CWE-755/CWE-305). Visits each try_expression once, where Scala's pattern-match catch is unreliable on the regex tier the other fail-open-verification siblings use. A catch that returns false or rethrows, a business-method receiver (addressBook.verify), a bare verify(), and a mock/spy receiver are silent.
c-incorrect-return-value-checkc, cppA return-value check that cannot detect failure: a pointer-returning call (fgets/fopen/strchr…) in an ordered comparison with 0, or a size_t-returning call (fread/fwrite/strlen…) compared < 0 (always false) (CWE-253).
c-sizeof-pointer-typec, cppA sizeof(p) on a local pointer used as an allocation/copy size — malloc(sizeof(p)) / memset(buf, 0, sizeof(p)) — which sizes by the pointer width, not the pointed-to object (CWE-467).
c-assignment-in-conditionc, cppAn if/while/do condition that is directly an assignment (if (x = 5)) rather than a comparison — a likely == typo; the deliberate forms if ((x = 5)) / while ((c = f()) != EOF) are not flagged (CWE-481).
c-comparison-no-effectc, cppA bare ==/!= comparison used as an expression statement (x == 5;) whose result is discarded — a no-effect statement likely meant to be an assignment (CWE-482).
c-empty-return-nonvoidc, cppA return; with no value in a function whose declared return type is not void, so the caller reads an indeterminate value (CWE-758).
c-return-stack-addressc, cppA function returning a local array (which decays to a pointer into the frame) or the address of a non-static local (return &x;) — a dangling pointer once the frame is torn down (CWE-562).
c-switch-missing-defaultc, cppA switch statement with no default: label, so an unhandled value passes silently (CWE-478).
c-switch-fallthroughc, cppA non-empty switch case that does not end in break/return/goto/continue/throw and is followed by another label — an omitted break (CWE-484); empty stacked labels are not flagged.
cpp-catch-genericcppA catch(...) or catch(std::exception&) that swallows every exception where specific handling was intended (CWE-396).
cpp-throw-genericcppA function declared throw(std::exception) or a throw of a bare std::exception object, rather than a specific type (CWE-397).
cpp-xxe-unconfigured-parsercppA locally-constructed Xerces parser that reaches parse() with no hardening call dominating the parse (setDisableDefaultEntityResolution(true) on every path, following reference aliases) and no other interaction — default entity resolution left enabled (CWE-611).
c-fixed-address-pointerc, cppA pointer set to a hard-coded numeric address (char *p = (char *)0x400000;) — not a real object, so a dereference is undefined behavior (CWE-587).
c-empty-error-handlerc, cppAn if that tests errno but whose body is empty — the error is detected and then ignored (CWE-390).
c-suspicious-commentc, cppA comment containing a developer-marker keyword (TODO/FIXME/HACK/BUG/XXX/KLUDGE/LATER) — an in-code admission of unfinished or known-broken work (CWE-546).
c-heap-inspectionc, cppA heap buffer holding a password — read via fgets/fgetws and authenticated via LogonUser* — released by free/realloc/HeapFree without a prior memset/SecureZeroMemory/ZeroMemory clear, leaving the plaintext in freed heap memory (CWE-244).
c-unlock-not-lockedc, cppA lock release/unlock call (stdThreadLockRelease/pthread_mutex_unlock/LeaveCriticalSection/ReleaseSRWLock*) on a lock with no prior acquire of the same lock earlier in the function — released before ever locked (CWE-832).
c-missing-fd-releasec, cppA file descriptor or OS handle opened into a local (fopen/open/CreateFile family, a socket()/accept() descriptor, or an opendir() DIR*) that reaches function exit never closed, returned, stored, or passed to any callee — the descriptor/handle leaks (CWE-775, ref CWE-773).
c-lock-not-releasedc, cppA mutex acquired by a lock-acquire call (pthread_mutex_lock/EnterCriticalSection/AcquireSRWLock*/stdThreadLockAcquire) that reaches function exit still held — no unlock, pthread_cond_wait, or handoff of the same lock appears later in the function (CWE-667). A caller-passed lock parameter (acquired on the caller's behalf) is not flagged.
c-missing-crypto-stepc, cppA Windows CryptoAPI encryption pipeline (gated by CryptAcquireContext) that omits a required step, leaving a consumer using an uninitialized handle: CryptHashData on a hash never CryptCreateHash'd, CryptDeriveKey from a hash never CryptHashData'd, or CryptEncrypt/CryptDecrypt with a key no producer (CryptDeriveKey/CryptGenKey/CryptImportKey) ever created (CWE-325).
cpp-dangling-string-cstrcppA pointer into a temporary std::string's buffer — .c_str()/.data() on a std::string(...)/to_string(...) temporary — stored in a variable, assignment, or return, so it dangles once the temporary is destroyed at the end of the full expression (CWE-416); a call argument or immediate subscript (which do not outlive the statement) is not flagged.
c-strncpy-flipped-argsc, cppA bounded string copy/concat (strncpy/wcsncpy/strncat/wcsncat) whose count argument is derived from the SOURCE operand — sizeof(src), a strlen/wcslen-family call on src, or the source identifier itself (possibly + arithmetic) — instead of the destination's capacity, so a source longer than the destination overflows it (CWE-119/CWE-787); a count that references the destination (sizeof(dst), min(strlen(src), sizeof(dst)-1)) or a constant count is not flagged.
cpp-uniqueptr-uafcppA pointer or address into a std::unique_ptr's object used after the object is destroyed (CWE-416): the receiver is a make_unique(...)/std::unique_ptr<T>(...) temporary — or a call to a same-file function whose by-value return type is unique_ptr — whose .get(), &*, &(->member), or reference-bound *temp escapes into a variable/assignment/return; or a named unique_ptr is unconditionally reset(...)/reassigned between a .get() borrow and a later raw->/*raw/raw[i] dereference. A value copy, a call-argument consumption, a reference-returning receiver, a rebind, a use before the reset, an address-of, and passing the pointer to a call all stay silent.
cpp-iterator-invalidationcppAn iterator, element pointer, or element reference into a std::vector/std::string that outlives the container's storage (CWE-416). Two shapes: (1) a handle into a locally-declared container (v.begin()/v.data()/&v[i]/T& r = v[i]) used after an unconditional invalidating call on it (push_back/emplace_back/insert/erase/resize/reserve/clear/assign, or a string append/+=), with no re-binding in between; (2) a reference/handle into an ELEMENT of a temporary container (temp[i]/temp.at(i), where temp is a by-value container return or constructor) that escapes via a range-for, an auto&&/T& reference binding, or a reference-returning return. A use before the mutation, a re-bind after it, a conditional mutation, a parameter container, a handle passed to a function, iterating a whole temporary, or a by-value copy of an element is not flagged.
cpp-istream-fixed-buffercppAn unbounded C++ istream operator>> extraction into a fixed-size char/wchar_t array (std::cin >> buf; where char buf[N]) — a gets()-class read that writes an arbitrary-length token past the array with no bound (CWE-676/CWE-120). Fires only when the base of the >> chain is a known istream (cin/wcin, or an istream-typed local) and the extraction is unbounded; a std::setw-width-limited chain, a std::string target, a scalar or single-char lvalue, and a bare pointer are all left silent.
solidity-reentrancysolidityA contract state variable written after an external ether-transfer call, with no reentrancy guard, violating checks-effects-interactions (SWC-107).
dataflow-taintjava, python, php, kotlin, scala, lua, go, csharp, rust, swift, c, cpp, javascript, typescriptSource→sink taint via the unified dataflow engine.
regex-hostname-dotanyAn unescaped . in a hostname regex.
regex-unanchored-hostnameanyA hostname regex lacking start/end anchors.
regex-semi-anchoredanyAn anchor (^/$) that binds only one alternation branch (^a|b).
regex-useless-escapeanyUnnecessary backslash escapes in a regex.
regex-unbound-backrefanyA regex backreference to a capturing group that does not exist — \1 with no group 1, or \k<name> naming an undefined group.
regex-backref-before-groupanyA regex backreference that appears before the group it targets is defined — a forward reference that only matches the empty string. A backref inside a lookbehind is excluded.
regex-backref-into-neg-lookaheadanyA regex backreference to a group defined inside a negative lookahead, referenced from outside it — a negative lookahead never captures, so it only matches the empty string.
regex-backspace-escapeanyA \b escape inside a character class, where it means the backspace character (U+0008) rather than a word boundary — almost always a mistake.
regex-malformedjavascript, typescript, tsxA pattern that is invalid in every ECMAScript mode and throws a SyntaxError when compiled: an unclosed group or character class, a quantifier with nothing to repeat, stacked quantifiers, or bounds written in the wrong order ({3,2}). Only RegExp(…) arguments are analyzed, where a bad pattern is a runtime failure; a malformed regex literal is a syntax error the file cannot survive. Patterns that are invalid only under the u flag (\!x, a{1, a]b) are not flagged, because the flag is not visible from the pattern and they are valid literals without it.
regex-duplicate-char-in-classanyA character class that lists the same character twice, by evaluated code point — under any spelling ([??], [\x0a\x0a], [:|\\|]) — which is redundant and has no effect. A character merely inside a range is not a duplicate; classes using u/v-flag syntax (\u{…}, \p{…}, &&, --) are not analyzed.
regex-always-matchesanyA regex used in .test()/.search() that always matches because it can match the empty string on a universally-reachable path (optional/starred content, reachable at ^, $, or anywhere). A both-ends-anchored empty, a \b assertion, a universal wildcard .*, and a $-only optional under .search are not flagged.
regex-bad-tag-filteranyA regex HTML/XML tag filter that can be bypassed.
regex-unmatchable-caretanyA ^ in a position where it can never match.
regex-unmatchable-dollaranyA $ in a position where it can never match.
regex-suspicious-rangeanyA suspicious character range in a […] class (cross-case, digit-to-letter).
regex-suspicious-characteranyA suspicious escape such as \a (bell) or \b (backspace) in a regex.
gha-env-laundered-injectionyamlAn untrusted GitHub Actions context stored in an env: variable and then written to a $GITHUB_ENV/$GITHUB_OUTPUT/$GITHUB_PATH environment file.
gha-run-shell-injectionyamlAn untrusted GitHub Actions context stored in an env: variable and then re-evaluated as shell code (eval, sh -c/bash -c, command position, or command substitution $( … )/backticks) in a run: step.
gha-script-injectionyamlAn untrusted GitHub Actions context laundered through an env: var, read inside an embedded script through the interpreter's environment API (python os.environ, node process.env, Ruby ENV[…], Perl $ENV{…}, PHP getenv/$_ENV) and reaching a code-execution sink there (os.system, eval, subprocess(shell=True), child_process.exec, Ruby/Perl single-string system/exec and backticks/qx, PHP shell_exec/passthru/proc_open). The multi-argument argv form, which runs no shell, stays silent.
gha-github-script-injectionyamlAn untrusted GitHub Actions context interpolated into an actions/github-script script: input, spliced into and executed as JavaScript.
gha-cross-job-injectionyamlAn attacker-controlled job output — set directly, or indirectly from a steps.<id>.outputs.* write of an arbitrary/laundered value — consumed as needs.<job>.outputs.<name> in a downstream run: step.
gha-command-injectionyamlAn untrusted GitHub Actions context interpolated into a run: shell command, a shell-argument action input (subcommand:/args:), or an input a curated third-party action executes as a script (Amadevus/pwsh-script script:, mikefarah/yq cmd:, addnab/docker-run-action run:/options:, …), via the workflow IR (no YAML-sibling scoping bug). Matrix dimensions the job builds from an untrusted value resolve to arbitrary, so ${{ matrix.x }} from a dynamic matrix fires.
gha-composite-action-injectionyamlA caller-controlled inputs.* value (or another attacker-controlled context) interpolated into a run: shell command inside a composite action.yml/action.yaml, across the caller/action boundary.
gha-env-var-injectionyamlAn arbitrary GitHub Actions context written to $GITHUB_ENV (or ::set-env), injecting an environment variable that hijacks a later step.
gha-env-path-injectionyamlAn arbitrary GitHub Actions context written to $GITHUB_PATH, prepending an attacker-controlled directory to PATH.
gha-output-clobberingyamlAn arbitrary GitHub Actions context written to $GITHUB_OUTPUT (or ::set-output), clobbering a step output a later step trusts.
gha-ssrf-request-forgeryyamlAn arbitrary GitHub Actions context reaching the request route/URL input of an HTTP-request action (e.g. octokit/request-action route:), letting an attacker control the request target (SSRF).
gha-cache-poisoningyamlA build cache reachable across the trust boundary: a release/publishing workflow using a cache-aware step (incl. implicit setup-* caching), or a job that both checks out untrusted PR code and caches — so a poisoned cache entry can be shipped or planted.
gha-reusable-workflow-injectionyamlA caller-controlled inputs.* value of a reusable workflow (on: workflow_call) interpolated into a run: shell command. Review-grade MEDIUM on its own; promoted to HIGH (CRITICAL under a privileged external trigger) when a same-repo caller is found passing an attacker-controlled context to that input.
gha-dispatch-input-injectionyamlA workflow_dispatch input (${{ inputs.* }} or ${{ github.event.inputs.* }}) interpolated into a run: shell command. Review-grade LOW: triggering the dispatch needs actions: write, so this is not an anonymous-attacker path, but a credential able to trigger the workflow without being able to push code can inject commands that run with the job's secrets. An input declared boolean, number, choice or environment is coerced by GitHub and stays silent, as does a comparison or a ternary whose arms are literals. A file that also declares on: workflow_call is reported by gha-reusable-workflow-injection instead.
gha-argument-injectionyamlAn untrusted GitHub Actions value reaching the program argument of a text-processing tool — a sed expression or an awk program — where the argument is executed as a program (GNU sed's e command, awk's system()) rather than passed as data. Sources are the laundered lane: an env:-bound arbitrary context, the runner-provided GITHUB_HEAD_REF, or git metadata read back inside the script ($(git log --format=%s)). A tainted file operand, here-string or awk -v assignment is data and stays silent.
gha-secret-in-logyamlA secret (${{ secrets.* }} bound to an env: var) transformed by a masking-defeating operation (base64/jq/cut/tr/rev/xxd/substring/…) and then printed with echo/printf. GitHub masks the raw secret in logs, but the transformed value is not masked, so it leaks into the build log.

The any-language regex analyzers are scoped by the rule's own languages: field and adapt to the language internally (for example, Ruby hostname anchors are \A/\z rather than ^/$).

Configuration

Analysis-mode rules take no parameters in metadata. When an analyzer needs to vary, it does so by analyzer identity (the regex kinds are separate analyzer: names rather than a kind option) or by intrinsic behaviour. A future structured options: block is the planned home for any genuinely rule-configurable value.

See also

Last updated on

On this page