fix(v3-client): Guard trace summary timestamp params against out-of-range Date - #4302
Open
okxint wants to merge 4 commits into
Open
fix(v3-client): Guard trace summary timestamp params against out-of-range Date#4302okxint wants to merge 4 commits into
okxint wants to merge 4 commits into
Conversation
Signed-off-by: okxint <cashmein.eth@gmail.com>
Signed-off-by: okxint <cashmein.eth@gmail.com>
The pad_start formatter logs an error when desiredLength is NaN but then falls through to call value.padStart(NaN, padCharacter) instead of returning early. The add formatter in the same file correctly returns early in the equivalent NaN branch. This produces the correct output by accident today — padStart(NaN, ...) coerces NaN to 0 and returns the original string — but the error message claims formatting is being ignored while the code keeps executing, making the two formatters inconsistent and fragile under future changes. Add the missing return value; to match the documented and logged behavior. Fixes jaegertracing#4284 Signed-off-by: okxint <cashmein.eth@gmail.com>
…ange Date Number.isFinite(startUs) passes values like 1e20 (beyond Date's max of 8.64e15 ms). new Date(1e20 / 1000).toISOString() throws RangeError: Invalid time value, crashing fetchTraceSummaries before fetch() is called. Introduce an intermediate Date and guard with Number.isFinite(date.getTime()) before serialising. new Date() with an out-of-range argument produces an Invalid Date whose getTime() returns NaN, so Number.isFinite(NaN) === false drops the parameter gracefully, matching the existing comment. Fixes jaegertracing#4284 Signed-off-by: okxint <cashmein.eth@gmail.com>
|
Hi @okxint, thanks for your contribution! To ensure quality reviews, we limit how many concurrent PRs new contributors can open:
This PR is currently on hold. We will automatically move this into the review queue once your existing PRs are merged or closed. Please see our Contributing Guidelines for details on our tiered quota policy. |
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
fetchTraceSummariesguards startUs/endUs withNumber.isFinite, butNumber.isFinite(1e20)istrue. Values that large (beyond Date's maximum of 8.64×10¹⁵ ms) causenew Date(startUs / 1000).toISOString()to throwRangeError: Invalid time value, crashing the function beforefetch()is ever called.Fix
Introduce an intermediate
Dateobject and guard withNumber.isFinite(date.getTime())before serialising.new Date()with an out-of-range argument produces an Invalid Date whosegetTime()returnsNaN, soNumber.isFinite(NaN) === falsesilently drops the parameter — matching the existing comment "drop malformed URL params gracefully" and consistent with how theNumber.isFinite(startUs)check above it works for non-finite inputs.Fixes #4284