How to Point Cargo at Chainsaw

Beginner 15 minutes Developers / DevOps Engineers Getting Started

Redirect crates.io through your Chainsaw proxy with a Cargo registry replacement, and use the native credential provider on cargo 1.74+.

Overview

Point Cargo at your Chainsaw instance so crates.io resolves through the firewall. This page covers the .cargo/config.toml registry replacement and the recommended OS-keyring credential provider for cargo 1.74+.

Replace chain305.com with your own Chainsaw deployment host and swap CLIENT_ID / CLIENT_SECRET for credentials issued from the Access page in the dashboard. The @default segment is the org slug — confirm yours under Settings → Organization → Slug. Legacy non-org-scoped URLs return HTTP 400 with error CHW-4314.

Prerequisites

  • A running Chainsaw instance (see Tutorial 01)
  • Client credentials (Client ID and Secret)
  • Rust and Cargo installed

Clear Local Caches (First-Time Setup)

rm -rf target
rm -rf ~/.cargo/registry/cache ~/.cargo/registry/src

.cargo/config.toml

[registries.chainsaw]
index = "sparse+https://chain305.com/chainproxy/repository/@default/crates-io/"
token = "CLIENT_ID:CLIENT_SECRET"

[source.crates-io]
replace-with = "chainsaw"

Plaintext tokens in .cargo/config.toml are workable but not great — they end up in shell history, dotfile backups, and screenshots. For cargo 1.74 and newer, Chainsaw ships a native credential provider that sources credentials from the OS keyring instead.

# One-time: store credentials in the keyring
chainsaw cargo-credentials store

# Verify the provider is wired
chainsaw cargo-credentials status

# Remove if you switch hosts
chainsaw cargo-credentials clear

In .cargo/config.toml, drop the token = "..." line and add:

[registry]
global-credential-providers = ["chainsaw-cargo-credentials"]

Cargo will resolve credentials via the provider on every fetch — no plaintext in the config file.

Verify

Run cargo build in a project, then confirm with chainsaw doctor verify-hook and the Traffic page in the dashboard.

Next Steps