# Privacy

What leaves your machine, what does not, and how to control it.

> **Your source code is never uploaded.**
> Lafke may send public dependency names and versions to third parties when it looks up vulnerabilities and package evidence.

## Network modes

```sh
lafke scan --network public-only
```

| Mode | What it does |
| --- | --- |
| `public-only` | The default. Queries only the public sources listed below, and only for artifacts from a known public registry. |
| `offline` | Skips all remote lookups. `--offline` is the same. |
| `allow-all` | Sends every dependency name and version to OSV and, for supported collectors, to registry evidence endpoints. Use it only when that disclosure is acceptable. |

A policy file can set the same mode with `network.mode`.

## What `public-only` sends

- **OSV** (`api.osv.dev`): a batch query by package name and version, and the advisory record of each advisory that matched, for its severity and fixed version.
- **The npm registry** (`registry.npmjs.org`) and Yarn's default registry (`registry.yarnpkg.com`): package metadata and evidence. For npm capability and behavior scanning, Lafke may also download public package tarballs.
- **deps.dev** (`api.deps.dev`): only to date an npm release whose package document is too large to read, and only for packages from the public npm registry.
- **PyPI** (`pypi.org`): the Integrity API for file provenance, and the JSON API for license, release date, and yanked status. Only for public PyPI artifacts.

Other ecosystems use their own public registries, such as crates.io, `proxy.golang.org`, `rubygems.org`, and `api.nuget.org`. The full list is in [`docs/privacy.md`](https://github.com/lafke/lafke/blob/main/docs/privacy.md).

Private registries, `GOPRIVATE` and `GONOPROXY` modules, and sources whose registry cannot be proven public are recorded in `lafke.lock` but are not sent off your machine. Their vulnerability state is `unknown`, not `trusted`.

## Opt-in lookups

Two `audit` flags contact more services, and only when you pass them.

| Flag | What it sends |
| --- | --- |
| `--prioritize` | The CVE identifiers of advisories that OSV matched, never package names or versions, to OSV, CISA, and FIRST. |
| `--scorecard`, `--min-scorecard` | The ecosystem, package name, and version of packages from public registries to `api.deps.dev`, to read OpenSSF Scorecards. |

Nothing from these lookups is written to `lafke.lock`. `--offline` skips them.

## Local cache

Responses from OSV, the registries, and the other lookups are kept for one hour in your user cache directory, readable only by you, so repeated runs do not ask again. They hold the same public data that was already sent, and never credentials: a request that carries `Authorization`, `Proxy-Authorization`, or `Cookie` is not cached.

| Option | What it does |
| --- | --- |
| `--no-cache` | Skips the cache for one run. |
| `--cache-ttl` | Changes how long a cached response is used. |
| `lafke cache clear` | Deletes the cache. |

## Commands that contact services you name

Some commands contact services only when you pass explicit flags, and they require `--network allow-all`. They refuse to run offline.

- `dast` and `security --target`: the application URLs you supply.
- `cspm --aws-region`, and the Azure and GCP collection flags: your cloud provider's APIs, through the installed CLI and its credentials.
- `container`: the image registry and Trivy's vulnerability database, through the installed Trivy.
- `watch --webhook-env`: the HTTPS webhook you configure.
- `fix-pr --publish`: the Git remote you configure.

Each command's behavior, and what it keeps out of reports, is documented in [`docs/privacy.md`](https://github.com/lafke/lafke/blob/main/docs/privacy.md).
