Conversation
A request body parsed on the Edge runtime is an object from another realm. Unit tests build one with vm, the end-to-end test posts a secret to two new example routes, one per runtime. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
redact only recursed into objects whose prototype was the library's own Object.prototype. A body parsed by the Edge runtime comes from another realm, so it went out unfiltered. A plain object is now one whose prototype is null or a root prototype. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.
In
0.5.0theredactoption does not filter the request body in route handlers that run on the Edge runtime. WithwithBetterStack(handler, { logRequestDetails: true, redact: ['password'] })the password in a JSON body is sent to Better Stack as is. Headers, cookies and log fields are filtered, and the Node.js runtime is not affected.The body parsed by the Edge runtime is an object from another realm, so its prototype is not the
Object.prototypethe library compares against, andredacttreated it as an opaque value instead of walking into it.redactnow treats an object as plain when its prototype isnullor a root prototype, whatever realm it comes from. Dates, class instances and other non-plain values are still left alone.vm./api/redactand/api/redact-edge, and asserts that no secret reaches the receiver on either runtime.Found by running the end-to-end checks against
@logtail/next@0.5.0installed from npm. This deserves a0.5.1.The first commit adds the tests and the example routes, and is expected to fail CI in the unit tests and in every E2E leg; the second commit holds the change to
redact.🤖 Generated with Claude Code