Security and your data
Nikasa runs on your machine or your CI runner and sends nothing to us. Everything it captures stays in the output folder you name, and only the reports are meant to leave it.
On this page
This page says what Nikasa does with your data, what it runs, and what your app can reach, so you can decide whether to use it.
For the full file lists, see the security reference.
The short version #
| Question | Short answer | Detail |
|---|---|---|
Does nk contact you? |
No. It has no telemetry, no update check and no licence check. Downloading it is separate. | What downloading involves |
| Does my app run for real? | Yes. It can call the outside hosts its configuration names, so use test keys. | Network |
| What extra privileges does it take? | Three containers get extra privileges. Capture has NET_ADMIN, NET_RAW and the host's network. The eBPF key reader runs privileged with the host's PID namespace, only when Docker allows it, and --no-ebpf turns it off. The relay has NET_ADMIN in its own network namespace only. Several helpers also run as root, with no added privileges. |
What Nikasa runs |
| Does it edit my images? | Your image files are not edited, but the containers get additions: extra settings and small tools, on every service in every run, old build and new build alike. | What Nikasa puts into your services |
| What is safe to share? | The reports, once you have read the first one. The output folder is sensitive: run folders hold the capture, TLS keys and the sandbox's credentials, and stay where they were made. | What leaves your machine |
Reports quote values from your test traffic, with the credentials Nikasa recognises masked. Some secrets have no name Nikasa knows, so read your first report before you share it.
What leaves your machine #
| To | What leaves |
|---|---|
| Us | Nothing. nk sends us no telemetry, makes no update check and makes no licence check. |
| Your CI | The four reports, and a saved baseline where you keep one. Your CI job uploads them. See In CI. |
| Your tracker | It gets nothing from nk itself: nk calls no tracker and holds no token. The link beside each change in report. is text, and the person who follows the link files the ticket. |
| Outside services | What your app itself sends them. See Network. |
What downloading involves #
Getting Nikasa is separate from running it. These are the downloads you or your CI job make:
| What | Where from | Notes |
|---|---|---|
nk and nk-ci. |
The releases of the repository your invite names, on GitHub | nk-ci. runs nothing it downloaded until it matches a checksum. A runner can use a copy you keep instead, through NK_CI_RELEASE_DIR or NK_CI_NK. |
| Nikasa's images | ghcr. |
Docker needs a login that can read them. nk demo pulls its sample builds and the capture image from there. nk setup tries its two images there first, and builds them on your machine when the pull is refused. |
| The Java agent | Downloaded by nk setup |
Checked against a pinned SHA-256. Docker also pulls the images its tools are built in. |
| rclone, for a baseline store | rclone's own release | Checked against a checksum pinned in the script. |
A --pack or a seed with a link or an s3:// path |
What you named | Fetched before the first run. A link is printed without its query, where a presigned signature lives. |
Network #
Your app runs for real, so these are the ways it can reach the outside.
| Run | What your services can reach |
|---|---|
| During a run | Outside hosts by name, and their lookups are recorded. In a compare, the first old run reaches them live and later runs are answered from its recording. A request it has no answer for still goes to the real host. |
With x-nk: outside in the app file |
Only the hosts the list names. |
With --offline |
Nothing outside. |
| A compare from a pack with cassettes (its recorded outside calls), or with tokens Nikasa makes fresh | Nothing: it runs closed. A pack with neither runs like any other compare. |
nk record |
The real outside services, once. It keeps what they answered in the pack, credentials left out. |
Addresses that are always refused #
Whatever the mode or the app file, these are refused:
- the cloud metadata and platform addresses (
169.254.0.0/16,168.63.129.16,100.100.100.200); - the names GCP gives them;
- every IPv6 packet.
Port 53 on 169.254.0.0/16 and 168.63.129.16, where clouds run resolvers, follows the rule in Calls made by address instead.
A sandbox that could read the machine's identity could act as the machine from code under test. Each refusal is in the report, with who asked and in which runs, and there is no switch to allow it.
What is not behind the gateway #
- A service your compose file runs with
network_mode: host. The report says so. - Any container a service starts through the Docker socket.
Calls made by address #
The sandbox's gateway, called the relay, checks addresses. It lets an address out only when a lookup through the sandbox's resolver answered that address earlier in the same run. So a call to a bare IP address is refused unless a lookup gave it out.
| In a run with | An address no lookup answered | An address a lookup answered |
|---|---|---|
No list: a compare's runs, nk try, nk run, nk record |
Refused | Leaves |
An x-nk: outside list |
Refused | Leaves. Only names on the list resolve, so only their addresses can be answered |
--offline |
Refused | Does not arise: no outside name resolves |
| A pack with cassettes or fresh tokens | Refused | Does not arise: every name is answered with the address of a small server inside the sandbox |
What the report says:
| Call | How the report names it |
|---|---|
| A refused call | blocked, asked for by address, not by name |
| A refused call in the last two rows | blocked, nothing may leave this sandbox |
| A call by address that a lookup made possible | In a compare's report, reached by address. With a list it adds x-nk: outside cannot stop it. |
Secrets #
Nikasa replaces each secret it finds with a marker such as <secret 3f9a1c2e>.
A marker is the first 4 bytes of an HMAC-SHA256 of the secret. The HMAC is keyed with the secret key, a random 32-byte key that Nikasa makes on your machine and that you keep as a CI secret in CI.
The marker cannot be turned back into the secret without the key.
Observations and reports carry markers only, while the capture and keys.log carry the traffic as it was. Mask values says how secrets are found and what is not caught.
In CI #
The only files meant to leave the runner are the four reports and, where a CI keeps one, a saved baseline.
GitHub Actions #
The Action:
- uploads the reports as an artifact;
- writes
report.mdto the job summary; - on a pull request, keeps one comment up to date, with the job's
comment-tokeninput, else itstokeninput; - with
secret-key, writes that secret to a file readable only by the job.
Jenkins #
nkCompare:
- archives the reports, and puts the report's first line in the build's description;
- leaves the output folder in the work folder until the next call empties it;
- binds tokens as Secret text credentials only around the steps that need them;
- with
checkson, sends GitHub a check holding the first line and the first 60,000 characters ofreport.md.
GitLab CI and Azure Pipelines #
What leaves the runner is what the job's own steps upload, so a job that uploads more sends more. The jobs in these docs upload only the four reports.
A recording of your tests #
With the Action's record input or NK_CI_RECORD, your own tests run on the old build in a container on the runner, with what x-nk: tests gives them. The tests that run are the ones in the checkout named.
- The pack they leave,
nk-pack/in the work folder, holds what they sent as they sent it, passwords too. - No step uploads or caches it, and each job records again. A saved baseline is not kept with a recording.
- The last lines of the test tool's log go to the job's log, which a CI masks. The reports carry only the counts and Nikasa's own words, as a comment is not masked.
The release script and the baseline store #
nk-ci.shpasses the token to curl on standard input, never on a command line or in a traced log, and it leaves the script's environment beforenkruns.- A baseline store receives one tar per save, encrypted on the runner by default. rclone signs in with the credentials your job's own login step set, and the script handles no cloud credential.
The GitHub Actions cache #
A saved baseline kept there holds Nikasa's masked observations of your old build, which they can read. The recorded outside calls inside it are encrypted, and cannot be read without the secret key.
Keep that key a CI secret, never in the repository or the cache. Anyone who can push a workflow to your repository can read its secrets, so the key guards those calls from forks, not from them.
If that audience is wider than you want, keep baselines in your own storage.
What a coding agent can read #
nk report list, show and check read a report.json and write nothing.
| Command | What it prints |
|---|---|
list |
Each counted change's key, kind, area and place, its detail cut at 200 characters and up to three request labels. |
show |
One change: its detail cut at 8,000 characters, its requests at 50 and the whole output at 24,000, with the lines that accept and mask it. It masks what it prints again. |
--values |
Adds the values at the change's place in the first old and new runs, for three requests, 2,000 characters each, masked the same way. |
Neither list nor show prints the report's provenance or any path on this machine.
The check runs first #
It applies the secret rules to every detail, place and request label. A hit stops list and show with exit 1 until the value is masked and the report made again, or --unchecked is given.
The check names a suspect by its change's key, where it is and its shape, never the value.
An agent's model receives what these commands print and nothing else from Nikasa. What your agent's provider keeps is between you and that provider.
What Nikasa runs #
Each run is a Docker Compose project of its own, on a private bridge network the host takes no address on. The sandbox's gateway container, called the relay, is the only way out.
| Container | Runs as | Privileges | Why |
|---|---|---|---|
| Your app and its dependencies | As your compose file says | As your compose file says | The builds being compared |
| Capture (tshark) | The run folder's owner | NET_ADMIN, NET_RAW, host network |
Records the sandbox's network |
| Resolver (CoreDNS) | Image default | None | Answers the sandbox's lookups, so outside lookups are recorded |
| Relay (Debian, nftables, dnsmasq) | root | NET_ADMIN in its own network namespace only; nothing on the host changes |
The sandbox's gateway: refuses what is listed above and counts every refusal |
Network holder nk-slot-<n> (the relay's image) |
root | No network, no capabilities | Waits for as long as the run lives, so that no other run on this Docker takes its sandbox network. It goes when the run ends, however it ends. nk-golden-hold-<key> does the same while a saved starting database is built |
| Driver (Hurl) | Image default | None | Sends your requests |
| Pack fetch (curl) | The run folder's owner | None | Downloads a --pack link and unpacks it |
| Cassette server (WireMock) | Image default | None; on the sandbox network only | Answers recorded outside calls |
| Cassette certificates (keytool) | The run folder's owner | No network | Makes the run's own certificate authority |
| Key files (the capture image's shell) | root | No network | Holds each service's key log file for the whole run |
| Database copy (tar) | root | No network | With a seed: keeps each database's data and unpacks it before each run |
| eBPF key reader (eCapture) | root | --privileged, host PID namespace, / |
Reads TLS keys of Go and .NET 8 programs; only when Docker allows privileged containers; --no-ebpf turns it off |
| Helpers after the run | root, or the run folder's owner | None | Read the capture, gather key logs, ask gRPC servers for their schemas, ask the app for its API description, read SQLite files |
What Nikasa puts into your services #
Your image files are not edited. Nikasa reads TLS with the session keys the services themselves log. For that it sets these, on every service of every run and only in the containers it starts:
| For | What Nikasa sets |
|---|---|
| Python, curl and others | SSLKEYLOGFILE, which they honour |
| Node | --tls-keylog |
| Java | The extract-tls-secrets agent, checked against a pinned SHA-256 |
| .NET 9 and later | A startup hook that turns on .NET's own key log |
| Programs using a dynamically linked OpenSSL | A preloaded library that logs keys |
TLS from any other program stays encrypted, and the report names the connection. Encrypted calls to hosts outside the sandbox are named, and their content stays unread unless the service logged its keys or a recording answers them.
The only code of Nikasa's own in your containers is the TLS key tools nk setup builds: the preloaded library and the .NET hook.
The security reference has the certificates, test tokens and database settings a run uses, and every file a run folder and a saved baseline hold.
Licence #
Nikasa is proprietary. The tools Nikasa runs as separate containers keep their own licences.
Related pages #
- Security reference: every file a run folder and a saved baseline hold, for a security review.
- Outside services: how your app's outside calls are recorded and answered.
- Mask values: hide what Nikasa does not catch.
- Saved baselines: the secret key, and where baselines are kept.
Written for nk 0.3.14. Something wrong or unclear? Write to hello@nikasa.dev.