feat(browser): add redaction support#2406
Open
mahmoodhamdi wants to merge 1 commit intopinojs:mainfrom
Open
Conversation
Add support for the redact option in the browser version of pino, using the existing @pinojs/redact package which is already browser-compatible (no VM or Node.js-specific dependencies). In asObject/write mode, redaction is applied to the final log object. In default console mode, redaction is applied to each object argument. Supports all redact option formats: array of paths, object with paths, custom censor (string or function), and remove option. Updated docs/redaction.md to remove the outdated "not supported in browser" note and the fast-redact safety section (pino now uses @pinojs/redact). Closes pinojs#2355
Fdawgs
requested changes
Mar 16, 2026
Member
Fdawgs
left a comment
There was a problem hiding this comment.
Blocking for now. Surge of pull requests across multiple repos from same user appears to be largely AI-generated. User shouldn't recieve contribution credit for deploying a bot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Added redaction support to the browser version of pino using the existing
@pinojs/redactpackage.Why
The
redactoption was not supported in the browser version (#670, #2355). Since@pinojs/redactno longer relies on thevmmodule (unlike the oldfast-redact), there's no blocker for browser support anymore.I was using pino in a browser project where I needed to redact sensitive user data before sending logs to a remote service via
transmit.send. Having to manually strip fields was error-prone — native redaction support solves this cleanly.How
@pinojs/redactinbrowser.js(already a dependency, browser-compatible)redactoption (supports both array shorthand and object config withpaths,censor,remove)serialize: false(returns objects, not JSON strings)asObject/writemode: redact the final log object before passing to write@pinojs/redactperforms selective cloning — original objects are never modifiedAll redact option formats are supported:
Tests
Added 12 tests in new
test/browser-redact.test.js:Docs
Updated
docs/redaction.md:fast-redactVM context in Safety sectionChecklist
npm test)npm run lint)npm run test-types)@pinojs/redactdependency (no new dependencies)Closes #2355