What cx protects against, and how.
| Threat | Protection |
| A corrupted or tampered archive | its sha256: checksum in the index, checked on every unpack |
| A compromised network path | TLS with certificate verification, always |
| A compromised index | signed index files, when the registry signs them |
| Dependency confusion | one name, one registry |
| Known vulnerabilities | `cx audit` |
| A registry or tag that changed after locking | `cx verify`, and cx.lock itself |
| A tampered cx release | checksums, signatures and a test run before cx self update replaces anything |
Signed indexes
A registry can sign each of its index files with an Ed25519 key. The signature is a sibling file, <file>.sig, holding a line ed25519:<base64 signature>. Clients that list the registry's public key check every index file before reading it, including copies from the cache:
# .cx/config.toml
[registries.default]
index = "https://registry.example.com/index"
keys = ["ed25519:…"] # printed by `cx index keygen`
- With keys configured, a missing or invalid signature is an error, never a warning.
- Without keys, signatures are ignored, as before.
- Archives don't need signatures of their own: the signed index holds their checksums.
- Key rotation: the index's config.toml may list more keys, keys = ["ed25519:…"]. They're trusted once config.toml itself verifies with a configured key. Index files can carry several signatures (one per line) while keys change.
Signatures use Ed25519 (RFC 8032), through Monocypher.
Signing a static registry
$ cx index keygen --out index.key # prints the public key for `keys`
ed25519:3d4017c3e843895a…
$ cx index sign --key index.key ./my-index
Signed 42 index files in `./my-index`
$ cx publish --index ./my-index --sign-key index.key
$ cx yank mylib@1.0.0 --index ./my-index --sign-key index.key
$ cx index pubkey --key index.key # print the public key again
index.key holds the secret key (mode 0600); keep it out of the index's repository. cx index sign signs config.toml and every package file, and can be run again at any time. --sign-key re-signs only the file that publish or yank changed. An API registry signs on the server.
Dependency confusion
With several registries, a public package must never stand in for a private one with the same name. cx guarantees that:
- One name, one registry: a dependency is looked up only in the registry its declaration names (registry = "internal", or the default one), never in another registry as a fallback.
- One name, one source: all declarations of a name must agree on the source, unless the root's cx.toml overrides it with a git or path dependency.
- The lockfile records it: each cx.lock entry has its full source (registry+<url>). When a package's source changes, the change is shown when cx.lock is updated, and with --locked it's an error:
error: `mathx` is locked from `registry+https://cx.corp.example/index`, but `app` now takes it
from `registry+https://registry.example.com/index`; with --locked, cx won't switch a package's
source. If the change is intended, run without --locked to update cx.lock
Auditing
cx audit checks every package in cx.lock against an advisory database:
$ cx audit
vulnerability: mathx v1.1.0: CX-2026-0001: Integer overflow in mathx::add
affected: >=1.0.0, <1.2.0; patched: >=1.2.0
https://example.com/advisories/CX-2026-0001
Scanned 14 locked packages against 87 advisories
error: cx.lock has 1 vulnerability and 0 warnings
$ cx audit --deny warnings # for CI: unmaintained packages fail too
- The database: a git repository (fetched and cached like a git dependency, and usable with --offline once fetched) or a directory of TOML files. Set it with --db, audit.database in the configuration, or CX_AUDIT_DB.
- Exit status: non-zero for any vulnerability, and for warnings with --deny warnings.
- Resolution isn't changed: cx reports advisories but never avoids versions because of them.
Each advisory is one TOML file anywhere in the database:
[advisory]
id = "CX-2026-0001"
package = "mathx"
title = "Integer overflow in mathx::add"
url = "https://example.com/advisories/CX-2026-0001" # optional
informational = "unmaintained" # optional: a warning, not a vulnerability
withdrawn = "2026-03-01" # optional: the advisory no longer applies
[versions]
affected = [">=1.0.0, <1.2.0"] # requirements, as in cx.toml; any of them matches
patched = [">=1.2.0"] # optional, shown in the report
There is no public advisory database for cx packages yet; the format is ready for one.
Verifying the lockfile
cx verify checks that what cx.lock pins is still what the sources serve:
- Registry packages: the index still lists the locked version with the locked checksum, and the archive, downloaded again without using the cache, matches it.
- Git packages: the locked commit still exists in the repository, and a locked tag still points at it.
It reports every mismatch and exits non-zero if there are any. Path packages are skipped.
cx releases
cx self update and the install scripts read a release's cx-release.toml, which lists each platform's archive with its SHA-256.
- Checksums: an archive that doesn't match is never unpacked.
- Signatures: the release workflow signs cx-release.toml with the project's release key (cx-release.toml.sig, the same format as signed indexes). A cx built with release keys (self_update::kReleaseKeys) refuses releases without a valid signature. CX_SELF_UPDATE_KEYS replaces the built-in keys, for organizations that mirror and re-sign releases. The install scripts check the checksum but not the signature, because a shell has no Ed25519 tool.
- A test run: the new cx must run and report the version the release claims before it replaces the old one. Until then, nothing is changed.
- Provenance: every archive has a GitHub build attestation: gh attestation verify cx-<version>-<platform>.tar.gz --repo AKJ7/cortex.