---
title: "Scrub logs before sharing · airgap"
description: "Redact API keys, bearer tokens and private key blocks from logs, diffs and environment dumps with airgap_redact_secrets before you share them."
url: https://www.useairgap.dev/guides/scrub
---

[All guides](https://www.useairgap.dev/guides)

# Scrub logs before sharing

Redact API keys, bearer tokens and private key blocks from logs, diffs and environment dumps with airgap_redact_secrets before you share them.

## Scrub logs before sharing

**Short answer:** Call `airgap_redact_secrets` before pasting terminal logs, stack traces, git diffs, or environment dumps into an issue, chat message, or LLM prompt. It runs completely locally with zero credentials, replaces detected credentials with `[REDACTED]`, and returns the scrubbed text along with a merged match count.

> `redact secrets from this CI log so I can post it`

> `scrub my .env diff with airgap before showing it`

### What gets redacted

`airgap_redact_secrets` combines provider-specific regex rules with high-entropy token detection so both well-known key formats and custom random secrets are caught locally before leaving your machine:

| Category | Examples detected | Replacement |
| --- | --- | --- |
| Cloud & AI keys | AWS access key IDs, OpenAI / Anthropic / GMI style API keys | `[REDACTED]` |
| Developer & SaaS tokens | GitHub personal/fine-grained tokens (ghp_, github_pat_), Slack tokens & webhooks | `[REDACTED]` |
| Auth headers & JWTs | Authorization: Bearer tokens, three-segment JWT payloads | `[REDACTED]` |
| Private key blocks | PEM-encoded RSA, EC, and OpenSSH private key blocks | `[REDACTED]` |
| Assignments & entropy | PASSWORD=, SECRET=, TOKEN= assignments and high-entropy random strings | `[REDACTED]` |

### Direct MCP tool call

```
{
  "tool": "airgap_redact_secrets",
  "arguments": {
    "raw_text": "GITHUB_TOKEN=ghp_example_placeholder\nBuild passed in 4.2s"
  }
}
```

### Automatic scrubbing vs. manual scrubbing

Every sandbox tool (`airgap_sandbox_run`, `airgap_verify_patch`, `airgap_verify_pr`) already scrubs stdout, stderr, and configured provider keys automatically before returning output. Use `airgap_redact_secrets` directly whenever you are working with local logs, crash dumps, or commit messages that never went through a sandbox.

**Caveat:** Regex and entropy detectors can miss unusual secret formats and can occasionally redact harmless high-entropy hashes (like long SHA digests). Always glance over scrubbed output before posting publicly. See [Zero credential leakage](https://www.useairgap.dev/guides/secret-scrubbing) for how entropy scoring works under the hood.

## Keep reading

[All 12 guides](https://www.useairgap.dev/guides)

### [Run a security review](https://www.useairgap.dev/guides/audit)

A defensive, static review of a repository in six phases.

### [Docker vs. remote microVMs](https://www.useairgap.dev/guides/docker-vs-microvm)

Why a local container is not a security boundary for agents.
