Repository navigation
Conversation
The library hands raw input to a constructor it does not own, so that frame cannot carry #[\SensitiveParameter]. A TypeError for a wrong input type, or an exception thrown by the constructor's own validation, kept the arguments (e.g. a card number) in its trace, where error trackers that collect frame arguments would pick them up. from(), fromLazy() and with() now wrap that frame's arguments in SensitiveParameterValue, in place, the way PHP does for a sensitive parameter. The exception type, message, line and previous chain are unchanged.
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.
Problem
Every library entry point, compiled hydrator, cast and pipe marks its input
#[\SensitiveParameter]. The one frame it cannot mark is the data class constructor: that is application code. When the constructor rejects its arguments, the exception keeps the raw arguments (e.g. a card number) in that frame of its trace. This happens with aTypeErrorfor a wrong input type, and with an exception from the constructor's own validation. Error trackers that collect frame arguments (Sentry, Flare, Bugsnag) pick them up whenzend.exception_ignore_args=Off. This holds even for#[Sensitive]fields.PCI DSS v4.0.1 3.3.1 / 3.5.1 / 10.3.
Change
Redactor::scrubConstructorArguments()wraps the arguments of the data class's__constructframe inSensitiveParameterValue(as PHP does for a sensitive parameter). It edits the trace in place, through the wholegetPrevious()chain. Exception type, message, file, line and previous chain are unchanged.from()and everything built on it),fromLazy()andwith()route constructor exceptions through it. The collecting path (fromResult()) already swallows the exception and keeps only its message.Tests
StackTraceRedactionTestgets 5 new paths:TypeErrorfromLazywithTypeErrorstays aTypeError.Upgrade note
File-cached hydrators are not regenerated automatically: run
sdo:clearorsdo:warmafter upgrading (noted in the CHANGELOG).