Skip to content

Security rules

Finds exploitable flaws in application code, such as injection, broken access control, leaked secrets and weak cryptography.

  • Agent id: security
  • Rules: 28 (source: security.yaml)
  • Deterministic checks: secret_scan, security_patterns

SEC-001: SQL injection

  • Severity: critical
  • Languages: all
  • References: CWE-89, OWASP A03:2021, OWASP A05:2025

Look for SQL text built by concatenation, f-strings, .format(), % formatting or template literals that include a value coming from a request, file, environment or function argument, then passed to execute, query, raw or an ORM raw-SQL escape hatch. Parameterized queries (?, %s, $1, :name placeholders with a separate parameter list) and query builders are not violations, and neither is interpolating a constant or a value checked against a fixed allowlist of identifiers.

SEC-002: OS command injection

  • Severity: critical
  • Languages: all
  • References: CWE-78, OWASP A03:2021, OWASP A05:2025

Look for shell commands assembled from variables and run through os.system, subprocess with shell=True, child_process.exec, Runtime.exec with a single string (no shell, but arguments split on spaces: argument injection), backticks, system() or popen. A command passed as an argument list without a shell (subprocess.run([...]), execFile, spawn without shell: true) is not a violation, and a fully constant command string is not one either.

SEC-003: Cross-site scripting

  • Severity: high
  • Languages: all
  • References: CWE-79, OWASP A03:2021, OWASP A05:2025

Look for untrusted data written into HTML without escaping, such as assignments to innerHTML or outerHTML, document.write, dangerouslySetInnerHTML, v-html, Jinja |safe or Markup(), and server templates with autoescape turned off. Raise it to critical when the value is stored user content shown to other users. Text set through textContent, framework bindings that escape by default, and HTML passed through a sanitizer such as DOMPurify are not violations.

SEC-004: Dynamic code evaluation

  • Severity: critical
  • Languages: all
  • References: CWE-94, CWE-95, CWE-1336, OWASP A03:2021, OWASP A05:2025

Look for eval, exec, new Function, setTimeout or setInterval with a string argument, compile() or template engines rendering a template string that contains input from outside the process. Evaluation of a literal written in the source, or of code loaded only from the project's own files, is not a violation.

SEC-005: Hardcoded secret

  • Severity: critical
  • Languages: all
  • References: CWE-798, OWASP A07:2021, OWASP A07:2025

Look for passwords, API keys, tokens, private keys, connection strings with credentials or signing secrets written as literals in source, config committed to the repository, or test fixtures that hold a real-looking key. Report the location with the value masked. Placeholders (changeme, xxx, <your-key>, empty strings), values read from the environment or a secret manager, and public identifiers such as publishable Stripe keys or OAuth client ids are not violations.

SEC-006: Weak cryptographic algorithm

  • Severity: high
  • Languages: all
  • References: CWE-327, CWE-328, CWE-326, OWASP A02:2021, OWASP A04:2025

Look for MD5, SHA-1, DES, 3DES, RC4, ECB mode, RSA keys under 2048 bits or a fixed or zero IV used to protect data, sign messages, or verify integrity against an attacker. MD5 or SHA-1 used only as a non-security checksum, cache key or content hash for deduplication is not a violation. HMAC-SHA1 and HMAC-MD5 are not broken; report them as low.

SEC-007: Password stored with a fast hash

  • Severity: high
  • Languages: all
  • References: CWE-916, OWASP A02:2021, OWASP A04:2025

Look for user passwords hashed with a general-purpose hash (MD5, SHA-1, SHA-256, with or without a salt) or stored reversibly encrypted. bcrypt, scrypt, Argon2 and PBKDF2 with a high iteration count are not violations.

SEC-008: Insecure randomness for security values

  • Severity: high
  • Languages: all
  • References: CWE-330, CWE-338, OWASP A02:2021, OWASP A04:2025

Look for Math.random, Python random, java.util.Random, rand() or mt_rand generating tokens, session ids, password reset codes, nonces, salts or API keys. The same generators used for jitter, sampling, shuffling test data or UI effects are not violations; secrets, crypto.randomBytes, crypto.getRandomValues and SecureRandom are the expected choices.

SEC-009: Missing authentication or authorization

  • Severity: critical
  • Languages: all
  • References: CWE-306, CWE-862, CWE-639, OWASP A01:2021, OWASP A01:2025, OWASP API1:2023, OWASP API2:2023

Look for route handlers, RPC methods or admin actions that read or change data without an authentication check, and for handlers that load an object by an id from the request without checking that the caller owns it or has the role for it. Endpoints that are public by design (health checks, login, public content) are not violations; confirm the check is not applied by middleware or a decorator before reporting.

SEC-010: Path traversal

  • Severity: high
  • Languages: all
  • References: CWE-22, OWASP A01:2021, OWASP A01:2025

Look for file paths built from request parameters, archive entry names or other outside input and passed to open, read, write, delete or send-file functions without resolving the path and checking it stays inside an allowed directory. Raise it to critical when the path is used to write or delete files or can read secrets. A path joined from constants, or one validated with realpath/resolve plus a prefix check, is not a violation; os.path.join alone does not protect against ../ or absolute paths.

SEC-011: Server-side request forgery

  • Severity: high
  • Languages: all
  • References: CWE-918, OWASP A10:2021

Look for HTTP clients fetching a URL, host or port taken from user input (webhooks, image fetchers, URL previews, import-from-URL features) without an allowlist of hosts and a block on private, loopback and link-local addresses. The check must apply to the resolved IP address and to every redirect. Raise it to critical when the response is returned to the caller or cloud metadata is reachable. A request to a fixed base URL where the user only controls a path segment or query value is not a violation.

SEC-012: Unsafe deserialization

  • Severity: critical
  • Languages: all
  • References: CWE-502, OWASP A08:2021, OWASP A08:2025

Look for pickle.loads, yaml.load without SafeLoader, marshal, Java ObjectInputStream, .NET BinaryFormatter, PHP unserialize or Ruby Marshal.load on data from a request, cookie, queue or file a user can supply. json parsing, yaml.safe_load and deserialization of files the application wrote itself to a private location are not violations.

SEC-013: XML external entities

  • Severity: high
  • Languages: all
  • References: CWE-611, CWE-776, OWASP A05:2021, OWASP A02:2025

Look for XML parsers that process untrusted documents with DTD or external entity resolution left on (default DocumentBuilderFactory, XMLInputFactory, lxml before 5.0 with default settings, or resolve_entities=True, libxml with LIBXML_NOENT). defusedxml, parsers configured to disallow DOCTYPE, and XML produced only by the application itself are not violations.

SEC-014: Permissive CORS

  • Severity: high
  • Languages: all
  • References: CWE-942, OWASP A05:2021, OWASP A02:2025

Look for CORS settings that reflect any request Origin or accept null while allowing credentials, and for origin checks done with startsWith, endsWith or a substring match. A literal * with credentials is rejected by browsers; report it as medium. A wildcard origin on a public, unauthenticated, read-only API that sends no cookies is not a violation.

SEC-015: TLS verification disabled

  • Severity: high
  • Languages: all
  • References: CWE-295, OWASP A07:2021, OWASP A07:2025

Look for verify=False, rejectUnauthorized: false, InsecureSkipVerify: true, NODE_TLS_REJECT_UNAUTHORIZED=0, trust-all TrustManager or HostnameVerifier implementations, or CURLOPT_SSL_VERIFYPEER set to false in code that reaches the network. The same setting confined to a test that talks to a local mock server is not a violation.

SEC-016: Sensitive data in error responses

  • Severity: medium
  • Languages: all
  • References: CWE-209, CWE-489, OWASP A05:2021, OWASP A02:2025

Look for stack traces, SQL errors, file paths, internal hostnames or exception messages returned to the client, and for debug modes (DEBUG = True, app.run(debug=True), detailed error pages) enabled in production configuration. Raise it to high for an interactive debugger or debug console reachable in production. Logging the full error on the server while returning a generic message is the expected pattern, not a violation.

  • Severity: medium
  • Languages: all
  • References: CWE-1004, CWE-614, OWASP A05:2021, OWASP A02:2025

Look for session or authentication cookies set without HttpOnly, without Secure, or with SameSite=None and no CSRF protection, and for session settings such as SESSION_COOKIE_SECURE = False. Cookies that hold only non-sensitive UI preferences are not violations.

SEC-018: Missing CSRF protection

  • Severity: high
  • Languages: all
  • References: CWE-352, OWASP A01:2021, OWASP A01:2025

Look for state-changing endpoints (POST, PUT, PATCH, DELETE) authenticated by cookies where CSRF protection is disabled (csrf_exempt, csrf: false, middleware removed) and no SameSite=Lax or Strict cookie or token check replaces it. SameSite=Lax counts only when no GET handler changes state. APIs authenticated only by a bearer token in a header are not violations.

SEC-019: Open redirect

  • Severity: medium
  • Languages: all
  • References: CWE-601, OWASP A01:2021, OWASP A01:2025

Look for redirects whose target comes from a query parameter or form field (next, returnUrl, redirect) without checking it is a relative path (reject //host and /\host, which browsers treat as absolute) or a host on an allowlist. A redirect to a fixed route, or to a value looked up from a server-side map, is not a violation.

SEC-020: NoSQL or LDAP injection

  • Severity: high
  • Languages: all
  • References: CWE-943, CWE-90, OWASP A03:2021, OWASP A05:2025

Look for MongoDB filters built from raw request objects (so a client can send $ne, $gt or $where), JavaScript passed to $where, and LDAP filters concatenated with user input. Filters built from typed, validated scalar values and LDAP values escaped with the library's filter-escape function are not violations.

SEC-021: Signature or token verification skipped

  • Severity: critical
  • Languages: all
  • References: CWE-347, OWASP A02:2021, OWASP A04:2025

Look for JWTs decoded without verifying the signature (verify=False, verify_signature: False, jwt.decode used where jwt.verify is needed), tokens accepted with alg: none, verification calls that do not pin the expected algorithm, and webhook handlers that skip the provider's HMAC signature check. Reading a claim from a token that was already verified earlier in the same request, or decoding one in a test, is not a violation.

SEC-022: Unrestricted file upload

  • Severity: high
  • Languages: all
  • References: CWE-434

Look for upload handlers that accept a file without checking its type, size or name, then store it under the name the client sent or serve it from a directory the web server executes or renders. Uploads checked against an allowlist of types and a size limit, renamed on the server, and stored outside the web root or served as attachments are not violations.

SEC-023: Memory-unsafe operation

  • Severity: critical
  • Languages: c, cpp, rust
  • References: CWE-787, CWE-125, CWE-416

Look for strcpy, strcat, sprintf, gets, and memcpy or memmove with a length taken from input, array writes or reads without a bounds check, and memory used after free. In Rust, look for unsafe blocks that dereference raw pointers or call such functions on input-controlled sizes. Bounded calls given the real buffer size (snprintf, strlcpy) and unsafe blocks whose invariant the surrounding code checks are not violations.

SEC-024: Prototype pollution

  • Severity: high
  • Languages: javascript, typescript
  • References: CWE-1321

Look for recursive merge, deep clone or path assignment helpers (merge, extend, set(obj, path, value)) that copy keys from request bodies or parsed JSON without rejecting __proto__, constructor and prototype. Targets created with Object.create(null), Map objects, and helpers that skip those keys are not violations.

SEC-025: No rate limit on authentication endpoints

  • Severity: medium
  • Languages: all
  • References: CWE-307, OWASP API2:2023

Look for login, password reset and one-time code endpoints with no attempt limit, lockout, backoff or CAPTCHA, so an attacker can guess passwords or codes. A limit applied by middleware, an API gateway or the identity provider counts when the repository shows it.

SEC-026: Secret compared in non-constant time

  • Severity: medium
  • Languages: all
  • References: CWE-208

Look for tokens, API keys, HMAC signatures or reset codes compared with ==, ===, equals or strcmp against a value the caller sends. hmac.compare_digest, crypto.timingSafeEqual, MessageDigest.isEqual and the password library's own verify function are not violations.

SEC-027: Header or log injection

  • Severity: medium
  • Languages: all
  • References: CWE-113, CWE-117

Look for request values written into HTTP response headers (Location, Set-Cookie, custom headers) or log lines without removing carriage returns and line feeds, so an attacker can add headers or forge log entries. Frameworks that reject newlines in header values, and structured loggers that encode each field, are not violations.

SEC-028: Untrusted input driving an LLM with tools

  • Severity: high
  • Languages: all
  • References: OWASP LLM01:2025, OWASP LLM05:2025

Look for external text (user messages, web pages, emails, files, tool results) placed in the prompt of a model that can call tools, run code or change data, without limiting those tools or asking for confirmation before side effects. Look also for model output passed to eval, a shell, SQL or HTML without the handling any untrusted input gets. A model with no tools whose output is shown as escaped text is not a violation.