> For the complete documentation index, see [llms.txt](https://docs.snyk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snyk.io/scan-fix-and-prevent/scan-with-snyk/snyk-code/snyk-code-security-rules.md).

# Snyk Code security rules

How Snyk Code security rules work and how they are updated

{% hint style="info" %}
Snyk Code rules are updated continuously. The list expands continually, and the rules may change to provide the best protection and security solutions for your code.
{% endhint %}

This page lists all security rules used by Snyk Code when scanning your source code for vulnerabilities.

Each rule includes the following information.

* **Rule Name**: The Snyk name of the rule.
* **Languages**: The programming languages to which this specific rule applies. Note that there might be two rules with the same name that apply to different languages.
* **CWEs**: The [CWE numbers](https://cwe.mitre.org/) the rule covers.
* **Security Categories**: The [OWASP Top 10](https://owasp.org/Top10/2025/) (2025 edition) category the rule maps to, when applicable. This column also notes whether the rule appears in the [CWE Top 25](https://cwe.mitre.org/top25/), and any applicable [OWASP API Security Top 10](https://owasp.org/API-Security/editions/2023/en/0x11-t10/) (2023) or [OWASP Mobile Top 10](https://owasp.org/www-project-mobile-top-10/) (2024) categories.

{% hint style="info" %}
\* XML listed in the language column applies only to NuGet XML files.
{% endhint %}

## How Snyk Code secret detection works

Snyk Code secret detection is part of Snyk Code SAST. It is a separate capability from [Snyk Secrets](/scan-fix-and-prevent/scan-with-snyk/snyk-secrets.md), which is a dedicated secrets scanner with its own engine and findings.

The Snyk Code rules report hardcoded secrets and credentials in these cases:

* A hardcoded user name, password, or key assigned to a variable, field, or argument whose name indicates a credential, for example `username`, `password`, or `key`.
* A secret with a known format, such as an AWS or GitHub key, matched by a regular expression.
* A hardcoded string passed as a credential argument to a method, for example the user name and password arguments of a database connection call.

The rules match on the name and the shape of the code, and they check the value, for example its length.

Snyk Code scans source code files in supported languages. Findings appear as **Hardcoded Secret** or **Use of Hardcoded Credentials** issues, with CWE-259, CWE-321, CWE-547, or CWE-798, depending on the rule. For the rules in each language, see the language pages in this section.

To scan all plain text files for secrets, use [Snyk Secrets](/scan-fix-and-prevent/scan-with-snyk/snyk-secrets.md). To suppress a Snyk Code finding, see [Consistent Ignores for Snyk Code](/scan-fix-and-prevent/fix/prioritize-issues-for-fixing/ignore-issues/consistent-ignores-for-snyk-code.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snyk.io/scan-fix-and-prevent/scan-with-snyk/snyk-code/snyk-code-security-rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
