> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Static analysis

> Detect hardcoded secrets and insecure code patterns in AI-generated code before they reach production

**Static analysis** is a Superblocks-managed [Code Security](https://docs.superblocks.com/admin/code-security/index.md) policy that inspects your application source and built artifacts before publish. It runs Semgrep against the snapshot being published.

It is deterministic: the same code always produces the same findings. There is no configuration beyond enabling it and choosing a [scan mode](https://docs.superblocks.com/admin/code-security/how-findings-work.md#scan-modes). Superblocks maintains the rules and normalizes results into findings.

## What it scans

Findings fall into these categories. Superblocks maintains the Semgrep rule packs behind them and adds to them over time.

| Category | What it checks | Example findings |
| - | - | - |
| **Leaked secrets** | Source and built artifacts for hardcoded credentials of any kind | API key hardcoded in a backend query, private key committed to source, database connection string in a config file |
| **Injection** | Untrusted input reaching an interpreter, query, or shell | SQL injection from an unsanitized parameter, command injection in a shell call, unsafe deserialization |
| **Frontend** | Client-side and React code that renders or handles untrusted data | Cross-site scripting through `dangerouslySetInnerHTML`, an unsafe `href` built from user input, a token written to `localStorage` |
| **Backend** | Server-side handlers and integration code | Path traversal on a file read, server-side request forgery from a user-supplied URL, disabled TLS certificate verification |
| **API surface** | How endpoints are exposed and configured | Wildcard CORS on a credentialed endpoint, credentials embedded in an outbound request URL, error responses that return stack traces |
| **Crypto and configuration** | Algorithms, key handling, and framework settings | MD5 or SHA-1 used for password hashing, a hardcoded salt or initialization vector, cookies set without `Secure` or `HttpOnly` |

Built-asset scanning is the authoritative gate for secrets. It checks the final bundle that would ship to production, not just the source, so a secret is caught regardless of how it reached the build output. It is also what decides blocking: a finding in the built assets can block a publish, while a finding in source alone is reported without blocking.

Static analysis reports what it can see in the code itself. Issues that depend on application logic, such as an endpoint that skips an authorization check or returns another user's data, are the [Security Agent](https://docs.superblocks.com/admin/code-security/security-agent.md)'s job.

## When it runs

Static analysis runs at **publish time**, after the application is built and before it deploys. It evaluates the exact artifact that would ship, so there is no gap between what was checked and what was deployed.

Builders do not trigger scans manually. The scan runs in the background and results appear under **Pre-Publish Policies** on the publish detail.

## How it compares

| | Static analysis | [Security Agent](https://docs.superblocks.com/admin/code-security/security-agent.md) |
| - | - | - |
| **Method** | Pattern matching with Semgrep | AI reasoning over application logic |
| **Result** | Deterministic and repeatable | Varies with context and evidence |
| **Catches** | Known-bad patterns and exposed secrets | Exploitable issues that span pages, APIs, and integrations |

The two are complementary and run in parallel. For dependency and package advisories, see [CVE detection](https://docs.superblocks.com/admin/code-security/supply-chain/cve-detection.md).

## Findings and enforcement

Severity, scan modes, remediation with **Fix with Clark**, run errors, and the audit trail are the same for every publish-time policy. See [How findings work](https://docs.superblocks.com/admin/code-security/how-findings-work.md).

## Related

* [How findings work](https://docs.superblocks.com/admin/code-security/how-findings-work.md)
* [Security Agent](https://docs.superblocks.com/admin/code-security/security-agent.md)
* [CVE detection](https://docs.superblocks.com/admin/code-security/supply-chain/cve-detection.md)
* [Private registries](https://docs.superblocks.com/admin/code-security/supply-chain/private-registries.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.