# Security scan

Scan your project for vulnerabilities, read what each check found, and fix it before you publish.

The **Security** scanner checks your project for exposed secrets, injection, weak access control and other common vulnerabilities. It runs inside your project's sandbox, lists what it found, and can hand the findings to the AI to fix. Serious findings stop a publish until you deal with them.

The Security tab in DevTools with the last score, Run again and Deep scan, and the coverage list of every check the scan runs.

## What you can do

- Run a **Quick scan**, or a **Deep scan** for a fuller review.
- See 20 checks, each marked passed, failed or not run.
- Go through a 29-point security checklist for your site, in plain words.
- Check which security headers your live site really sends.
- Look back at the scans saved with each publish, and download a report.
- Read each finding with its severity, file, line, why it matters and how to fix it.
- Send one finding, or all of them, to the AI to fix.
- Ignore a finding that is not a risk in your project, with a reason.
- Write project notes that help the deep scan.
- See every package your project uses and the known advisories against it.

## Run a scan

1. ### Open Security

   Open **DevTools** from the bottom bar of the editor and choose the **Security** tab.
2. ### Pick a depth

   Choose **Run scan** in the header, or **Run again** after a first scan: it runs a quick scan. **More actions** holds both depths:

   - **Quick scan** looks at the code, the secrets, the packages, the configuration and, if your project has a database, its row level security.
   - **Deep scan** does all that, then asks the AI to review your routes and data access. It takes longer. Some checks can only be settled by a deep scan.
3. ### Read the result

   The header shows the score (**Secure**, **Needs review** or **At risk**), how many issues the scan found in how many files, the change since the last scan, and which scan ran. The status bar at the bottom says whether the result is **Up to date** or **Out of date**. Checks that did not run are folded into one row, **Checks that did not run**, with **Run deep scan** when a deep scan can settle them.

You can also ask the AI in the chat to check your project for security issues. It runs the same scan.

## The 20 checks

| Checks                                                                                                       | What they look for                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Cross-site scripting**, **SQL injection**, **Command injection**, **Code injection**, **Input validation** | Untrusted input that reaches HTML, a query, a shell or `eval` without checks, and SVG pictures in your `public` folder that hold a script.                  |
| **Secrets**                                                                                                  | API keys, tokens and passwords written in the code or in files the app serves.                                                                              |
| **Access control**, **Authentication**                                                                       | Routes and data that anyone can reach without signing in or without the right role.                                                                         |
| **Row level security**                                                                                       | Database tables that are open to every visitor.                                                                                                             |
| **Information disclosure**                                                                                   | Error details, source maps or data that should stay private, and logs, dumps, backups or keys left in your `public` folder, where anyone can download them. |
| **Server-side request forgery**, **Path traversal**, **Open redirect**                                       | Requests, file paths and redirects that a visitor can steer.                                                                                                |
| **CORS**, **Security headers**                                                                               | Server and browser settings that make attacks easier.                                                                                                       |
| **Cryptography**                                                                                             | Weak or misused hashing and encryption.                                                                                                                     |
| **Dependencies**                                                                                             | Packages with known vulnerabilities.                                                                                                                        |
| **Cross-site request forgery**, **File upload**, **Rate limiting**                                           | Forms, uploads and endpoints that can be abused.                                                                                                            |

## The checklist

The **Checklist** tab, next to **Problems** and **Dependencies**, answers a 29-point security checklist for your site. Points are in two groups: **Essentials** (HTTPS, secrets, sign-in, data access, injection, backups and more) and **Attack classes** (the kinds of attack sites meet most). The top line says how many points pass and how many need attention.

Each point has one status:

| Status                           | What it means                                                                                                                        |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **Passed**                       | The scan checked it and found nothing.                                                                                               |
| **1 finding**, **2 findings**... | The scan found a problem. Choose **Show findings** to see only the findings behind this point in **Problems**.                       |
| **Not checked**                  | The scan could not check it yet. The row says why, and offers **Run a deep scan** or **Open Lyna Cloud** when that is what it needs. |
| **Provided by Lyna**             | Lyna's hosting answers it for every published site, such as HTTPS and protection against floods of traffic.                          |
| **Not used by this site**        | It does not apply, for example database points on a site with no database. The row says why.                                         |
| **Yours to check**               | No scan can answer it, such as backups and a recovery plan. Check it yourself.                                                       |

A point is never shown as passed because the scan could not read something: when part of the scan did not run, the point reads **Not checked**.

### Live site

Above the checklist, **Live site** shows which security headers your published site really sends: **Stays on HTTPS**, **Content security policy**, **File types enforced** and **Referrer policy**, each **Sent** or **Missing**. Choose **Check live site** to read them again. Before you publish, it says **Publish your site to check it live**.

### Scan history and report

In **More actions**, **Scan history** lists the scans saved with each publish, with their score and findings. **Download report** saves the result on screen as a file you can share.

## Not run is never clean

A check only passes when the scan could really check it. When it could not, the check is listed under **Checks that did not run** with the reason, for example:

- **Connect a database to check this**, for row level security when the project has no database.
- **Run a deep scan to verify this**, for checks such as access control and authentication after a quick scan.
- **The code scanner did not run**, when part of the scan failed.

If some parts of the scan did not run, the panel says so: the result is not a clean bill of health. Run the scan again, or run a deep scan.

## Findings

The **Problems** tab lists the findings. **Group by** **Check**, **File** or **Severity**, filter by severity (**Critical**, **High**, **Medium**, **Low** and **Info**) in **All severities**, or type in **Filter problems**. Select a finding to see its category and check, **What was found**, the **Code** that triggered it, **Why it matters** and **How to fix**.

- **Fix with agent** asks the AI to fix that finding.
- **Reference in chat** adds it to your message so you can ask about it.
- In **More actions**, **Fix all** or **Send all to AI** hands every finding to the AI at once.

When your code changes after a scan, the result is **Out of date** and the fix actions are turned off, so the AI never works from old line numbers. Run the scan again first.

## Ignore a finding

If a finding is not a risk in your project, open the finding and choose **Ignore this finding** in its actions. Explain **Why is this not a risk?**, then choose **Ignore finding**.

An ignored finding stays in the project with your reason; turn on **Show waived findings** in **More actions** to list it, in its own group. It no longer counts in the score and does not block publishing. Choose **Restore** to count it again.

Ignored findings are saved in your project, in `.lyna_ai/security/ignored.json`, so they are part of your Git history and your team can see them.

## Project notes

Some facts cannot be read from the code: who signs in, which data is private, which risks your team accepts. Write them in **Project notes**, in **More actions**. The deep scan reads them as context. They are saved in `.lyna_ai/security/memory.md`.

> [!NOTE]
>
> **Notes add context, they never hide findings**
>
> Project notes can help the deep scan find more. They cannot turn a finding from the quick scan into a pass.

## Dependencies

The **Dependencies** tab shows every package your project uses, its version, its advisories and the version that fixes each one. Search it or turn on **Vulnerable only**; **Fix** on a package asks the AI to update it. **Scan dependencies** and **Download list** are in **More actions**. Packages only used in development are marked **Dev**.

## Publishing and security

When you publish, Lyna checks the latest scan. The review step also shows how many security points pass, with **See the checklist**. Once your site is live, Lyna checks its security headers and tells you if any is missing. Neither line blocks a publish.

| Finding                                    | Effect on publish |
| ------------------------------------------ | ----------------- |
| Critical or high, in your code or database | Blocks publishing |
| Critical or high, in a package             | Advisory          |
| Medium, low or info                        | Advisory          |
| Ignored                                    | Advisory          |

A blocked publish shows **Resolve security issues before publishing**. Fix the findings, ignore the ones that are not a risk, or choose **Publish anyway**.

> [!WARNING]
>
> **Publish anyway keeps the risk live**
>
> **Publish anyway** puts your site online with the vulnerabilities still in it. The deployment is marked **Published with override**.

## FAQ

### Does my code leave the sandbox?

The scanners run inside your sandbox. For row level security, Lyna reads the definitions of your tables and policies, not the data in them. Only a deep scan sends code to the AI, and it replaces secret values before it does.

### Is Doctor the same as the security scan?

No. [Doctor](/features/test-and-debug/doctor) checks the health of your React code. Its Security category flags common mistakes in each file, such as a link that opens a new tab without protection or raw HTML on a page. The security scan checks the whole project: secrets, packages, your database, your live site and the checklist. A clean Doctor run is not a security result, so run both.

### I fixed a finding and it is still there

Run the scan again. If the same finding comes back, it may be a false positive or a package advisory with no fix yet. You can ignore it with a reason.

## Related

- [Doctor](/features/test-and-debug/doctor): Check the health of your React code.
- [Publishing](/features/publish/publishing): Where the scan gates your deployment.
- [Secrets](/features/cloud/secrets): Keep private keys out of your code.
