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 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. Return to handing over evidence.