Security telemetry without sending source code

By the CapyShield team · · 5 min read

In short

The CapyShield CLI analyses code locally and syncs only results: vulnerability ids, package URLs, statuses, reachability facts and, for blocked egress, host, port, rule id and count. Path redaction replaces file paths and the project name with deterministic SHA-256 hashes on your machine, which hides names but still lets someone confirm a guessable path. The --dry-run flag prints the exact payload without sending it.

A team dashboard for security results needs data from every project, but the people most careful about security are the least willing to ship their source code to another vendor. The way out is to analyse locally and send only conclusions. This post describes how the CapyShield CLI does that: what its sync payload contains, what path redaction hashes and what it doesn't protect against, and how you can check every byte before it leaves.

Can you send security results to the cloud without sending source code?

Yes, if the analysis runs where the code is and only its results travel. capyshield vex reads your lockfiles, manifests and import statements on your machine and derives a handful of facts per package: in_lockfile, dependency_scope, imported_in_prod and matched_files_count. Import analysis keeps only package names and file counts. The source files themselves are read and discarded.

The cloud never needs the code to do its job. Team rules match on a vulnerability id and a package. A dashboard needs statuses and severities. An auditor needs the OpenVEX document and the reasoning behind each statement, which is already recorded as facts.

Why not collect everything and filter on the server?

Because anything you collect becomes something you have to protect, and something an attacker can steal. Security tooling sits close to the most sensitive data a company has: credentials in CI, the full dependency graph, the code itself. A vendor that receives all of it is a high-value target. In the Salesloft Drift incident, OAuth tokens stolen from one integration were used to pull data, including cloud keys, from the Salesforce instances of many of its customers.

Deciding locally and sending conclusions has practical benefits on top of the security argument:

  • Smaller blast radius. If the service is breached, the attacker gets vulnerability ids, package URLs and hashes, not source code or secrets.
  • Easier approval. A payload you can print and read in a minute is much easier to clear with a security or legal review than an agent that uploads a repository.
  • Works offline. The analysis never depended on the service, so the CLI produces the same OpenVEX file with or without --sync, and with no account at all.

What exactly leaves your machine on a sync?

Nothing, unless you ask. The CLI makes no network calls of its own unless you run vex --sync or guard --sync with CAPYSHIELD_TOKEN set. With vex --sync, the payload contains:

  • the scanner name and CLI version;
  • per finding: vulnerability id, package URL (purl, such as pkg:npm/[email protected]), severity, status, which source decided it, and the four reachability facts;
  • the list of production files that import the package, as paths or as hashes;
  • the OpenVEX document the run produced;
  • the project name, which is the scanned folder's name, or its hash.

It never contains source code, git history, secrets, egress payloads or your repository URL. Payloads are capped at 500 KB.

With guard --sync, the report is smaller still: for each blocked connection, the host, port, rule_id and count. Never request bodies, headers or environment values. The rule id names a variable, as in secret_leak:env:AWS_SECRET_ACCESS_KEY, never its value. guard also reads the token itself and removes CAPYSHIELD_TOKEN and CAPYSHIELD_API_KEY from the wrapped command's environment, so install scripts and agents never see it.

How does path redaction work?

With --redact-paths, or vex.redact_paths: true in capyshield.yaml (which capyshield init sets), every matched file path and the project name are replaced on your machine by their SHA-256 digest, written as sha256: plus 64 hex characters. A redacted finding looks like this:

json
{
  "vulnerability": "CVE-2020-28500",
  "purl": "pkg:npm/[email protected]",
  "severity": "medium",
  "status": "affected",
  "decided_by": "reachability",
  "reachability": {
    "facts": {
      "dependency_scope": "direct",
      "imported_in_prod": true,
      "in_lockfile": true,
      "matched_files_count": 1
    },
    "matched_files": [
      "sha256:bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556"
    ]
  }
}

The hash is deterministic: the same path always produces the same digest. That is the point. A project keeps the same identity across laptop and CI runs, and a file that imports a vulnerable package is recognizable across runs, all without the cloud ever learning the name.

What does hashing paths not protect against?

Hashing is pseudonymization, not encryption, and it is worth being precise about the limits:

  • Guessable names can be confirmed. The digest is a plain, unsalted SHA-256, so anyone holding it can hash a guess such as src/index.js and compare. Redaction hides unusual paths and project names well; it does not hide that a common path is present.
  • Package data stays readable. Vulnerability ids, purls and versions are sent in clear, because they are what team rules and dashboards work on. Your dependency list and its reachability are visible to the service, by design.
  • Redacted and unredacted runs don't match. The project name is hashed too, so a run with redaction and one without show up as two different projects, and on CapyShield Cloud they are counted as two.

Those trade-offs are why the payload carries so little to begin with. The best protection for source code is not to read it into the payload at all; redaction then covers the only identifying strings that remain.

How can you verify what a security tool sends?

Ask it before it sends anything. --dry-run prints the exact payload to stdout and sends nothing:

terminal
capyshield vex --input trivy-report.json --repo . --redact-paths --dry-run > payload.json

Read it, diff it between runs, or keep it as a CI artifact. A real redacted dry-run payload is published in the CLI's examples/sample-output folder so you can see the format without installing anything. And because the CLI is open source, the code that builds the payload is the same code you can read.

The transport matters too. Syncs use TLS that offers and prefers the hybrid post-quantum key exchange X25519MLKEM768, so payloads recorded in transit today stay protected against a future quantum computer. If the cloud can't be reached, pulling team rules and guard --sync reports only warn; vex --sync exits 1 after your OpenVEX file and summary are written locally.

The docs cover setting up sync in CI, and the source on GitHub shows exactly how each field is produced.

Frequently asked questions

Does CapyShield send source code to the cloud?
No. Sync payloads contain vulnerability ids, package URLs, statuses and reachability facts, never source code, git history, secrets, egress payloads or your repository URL. Nothing is sent at all without --sync.
What does --redact-paths do?
It replaces every matched file path and the project name with its SHA-256 hash, written as sha256: plus 64 hex characters, before anything leaves your machine. The same path always gives the same hash, so projects keep a stable identity.
Can a hashed file path be reversed?
Not directly, but the hash is unsalted, so someone holding it can confirm a guess such as src/index.js by hashing it. Path redaction is pseudonymization, not encryption.
How can I see exactly what CapyShield would upload?
Run capyshield vex with --dry-run: it prints the exact sync payload to stdout and sends nothing. A real redacted example is in the CLI repository's examples/sample-output folder.

Sources