Toolvito

Works on this device

Log Secret Redactor

Paste a log before you share it in a ticket, a chat or a bug report. The redactor replaces keys, tokens, JSON Web Tokens, passwords in links, private key blocks and the values of names you list, and marks every change. It works in this browser.

Enter your values

Your values

Use a copy of the log. It is read in this browser, is never saved and is not put into the CSV file. Use test values when you try the tool.

One prefix on each line, as the token starts (capital letters count), such as ghp_ or sk_live_. Change the list to fit your logs.

One name on each line. A value after the name and = or : is hidden, such as password=... or "api_key": "...". Capital letters do not matter.

This finds keys that have no known prefix, but it can also hide ordinary IDs and hashes.

More options

They are shown in a box that is not printed, copied or put in a file. Anyone beside you can see it.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Redact.

How to use this redactor

  1. Paste a copy of the log into Log text, or open a log file. Use test values when you try the tool.
  2. Check the patterns. Change the list of token prefixes and the list of names to fit your logs. Tick the entropy test to find keys with no known prefix.
  3. Choose Redact. Read the marked log and the table of what was replaced (the line, the kind and the length, never the secret).
  4. To check what was hidden, tick Show the hidden parts on this screen only under More options. Then copy or download the redacted log.

The patterns, in order

  1. Private key blocks: from -----BEGIN ... PRIVATE KEY----- (also the PGP PRIVATE KEY BLOCK) to its END line, or to the end of the text when the END line is missing.
  2. JSON Web Tokens: three base64url parts joined by dots, the first two starting with eyJ, when the first part reads as a JSON object.
  3. Tokens with a known prefix: a prefix from your list at the start of a word, then at least 8 letters, digits, _ - or . (a dot at the end is left out). The starting list: ghp_, gho_, ghu_, ghs_, ghr_ and github_pat_ (GitHub), glpat- (GitLab), xoxb-, xoxp-, xoxa-, xoxr- and xapp- (Slack), sk_live_, sk_test_, rk_live_ and rk_test_ (Stripe), AKIA and ASIA (AWS access key IDs), AIza (Google API keys), npm_ (npm) and SG. (SendGrid).
  4. Passwords in links: the password in scheme://user:password@host, such as a database address.
  5. Bearer and Basic credentials: at least 8 characters after the word Bearer, or the value after Authorization: Basic.
  6. Values of listed names: the value after a name from your list and = or :, such as password=..., "api_key": "..." or token: .... A value in quotes ends at its closing quote; other values end at a space or , ; & ) ] }. With "names that end with it", db_password counts as password.
  7. Entropy (optional): a run of at least 24 characters of letters, digits and + / _ - (with up to two = at its end) whose Shannon entropy H = −Σ p × log2 p is at least 4.5 bits per character. Random keys reach about 5 to 6 bits; words and hexadecimal hashes stay lower.

A part that one pattern has replaced is not looked at again by a later one. Each secret becomes [REDACTED:kind], [REDACTED] or eight stars, as you choose.

Worked example

In the example log the redactor replaces 6 secrets on 5 lines: the password in the postgres:// link, the Bearer token, the AWS key ID and the password in the JSON line, the GitHub token and the JSON Web Token. The last line has no secret and stays as it is.

Limits you should know

  • Patterns find secrets in the forms they know. A secret in another form (a password in a sentence, a key split over two lines) can stay. Ordinary text can be hidden by mistake, such as bypass=1 with "names that end with it". Read the result before you share it.
  • The log is read in this browser, is never saved and is not put into the CSV file. The redacted log is what you copy or download.
  • Hidden parts shown on the screen only can still be seen by anyone beside you.

Related tools