---
title: "Remove the environment from a Node.js report before you share it | Proofline"
description: "A Node.js diagnostic report includes every environment variable by default, so generate it with --report-exclude-env or delete that section first."
url: https://proofline.sh/learn/node-diagnostic-report-secrets/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Remove the environment from a Node.js report before you share it

A Node.js diagnostic report includes every environment variable by default, so generate it with --report-exclude-env or delete that section first. A report attached to an issue can otherwise carry database passwords and tokens.

Data leaks The Proofline team November 24, 2026 2 min read

## Verify it on your version

```
mkdir rep rep2
DB_PASSWORD=hunter2 node --report-directory=rep -e 'process.report.writeReport()'
DB_PASSWORD=hunter2 node --report-exclude-env --report-directory=rep2 -e 'process.report.writeReport()'
grep -c hunter2 rep/*.json rep2/*.json
```

Writing the report from the script avoids racing a signal against startup. With Node 24.22 the counts are 1 and 0. The first report's `environmentVariables.DB_PASSWORD` is `hunter2`, and with `--report-exclude-env` the key `environmentVariables` is absent. A report triggered by a signal behaved the same. The [CLI reference](https://nodejs.org/api/cli.html) lists the option from versions 23.3.0 and 22.13.0. On older versions, remove the section afterwards:

```
jq 'del(.environmentVariables)' report.json > report-share.json
```

## Other fields to read

Excluding the environment is one field of several. The same report had these top-level keys: `header`, `javascriptStack`, `javascriptHeap`, `nativeStack`, `resourceUsage`, `uvthreadResourceUsage`, `libuv`, `workers`, `environmentVariables`, `userLimits` and `sharedObjects`.

| Field | May hold |
| --- | --- |
| `header.commandLine` | A token passed as an argument |
| `header.cwd`, `header.host` | Usernames, internal host names |
| `header.networkInterfaces` | Internal addresses. `--report-exclude-network` drops them |
| `libuv` | Addresses of connected peers, file paths |
| `javascriptStack` | An error message, which can contain a value from the failing request |
| `sharedObjects` | Library paths and versions |

Search for the values you know, and remember that a search only finds those:

```
jq -r '[paths(scalars) as $p | {p: ($p|map(tostring)|join(".")), v: (getpath($p)|tostring)}]
       | .[] | select(.v | test("token|secret|password|://[^/]*@"; "i")) | .p' report-share.json
```

It prints the paths of suspicious values and not the values. A random token that has none of those words in it passes unnoticed, so read `commandLine` and the stack's message yourself.

## Decide what the receiver needs

| Question | Keep | Drop |
| --- | --- | --- |
| Where is it stuck? | Stacks, `libuv` handle types | Environment, network, addresses |
| Why did the heap grow? | `javascriptHeap`, `resourceUsage` | Environment, `libuv` |
| Which native module crashed? | `nativeStack`, `sharedObjects`, versions | Environment |

If a variable's presence matters, hand over its name and whether it was set. Do not send a hash of a secret in place of the value: a short or guessable one can be found by trying candidates. In a small test, every seven-digit number up to the target was hashed with SHA-256 and the right one found in 4 seconds, in one Python process.

## If a report was already shared

Treat every secret in it as exposed, and rotate it. Deleting an attachment does not recall the copies in notifications and backups. List the variable names from the original with `jq -r '.environmentVariables | keys[]'`, so that the owners know which ones.

## Worked example

This example is fictional. Ana attaches a report to a public issue in a native module's repository. Ben notices `environmentVariables` in the file. The module's maintainers needed the native stack and the shared objects. The team rotates four credentials, attaches a version without the environment, the command line and the addresses, and adds `--report-exclude-env` to the service's start command.

To get the report in the first place, see [capturing a hung process](/learn/hung-process-evidence-before-restart/). Return to [handing over evidence](/learn/engineering-handoff-evidence/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Replace user IDs in a log without breaking the trail](/learn/pseudonymize-logs-for-handoff/)
    
    Data leaks The Proofline team November 24, 2026 3 min read
    
-   ### [Capture a hung process before you restart it](/learn/hung-process-evidence-before-restart/)
    
    Capacity overruns The Proofline team November 24, 2026 3 min read
