fix: cap unwrap depth in timeout normalization#528
Open
nev21 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents _normalizeTimeoutValue from looping forever when given a self-referential array timeout by capping nested-array unwrapping to a fixed depth and adding unit tests around normalization behavior.
Changes:
- Added a maximum unwrap depth constant and bounded the array-unwrapping loop in
_normalizeTimeoutValue. - Added a new test suite covering direct numeric timeouts, nested arrays, depth-cap behavior, and self-referential arrays.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/src/internal/timeout_helpers.ts |
Caps nested array unwrapping in _normalizeTimeoutValue to avoid infinite loops on cyclic/self-referential arrays. |
lib/test/src/internal/timeout_helpers.test.ts |
Adds coverage for timeout normalization, including depth-cap and self-referential array scenarios. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #528 +/- ##
==========================================
+ Coverage 97.55% 97.80% +0.24%
==========================================
Files 28 20 -8
Lines 1516 774 -742
Branches 358 195 -163
==========================================
- Hits 1479 757 -722
+ Misses 37 17 -20
🚀 New features to boost your workflow:
|
nevware21-bot
previously approved these changes
Jul 8, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
06316c3 to
7687689
Compare
7687689 to
07c28fe
Compare
07c28fe to
3427701
Compare
nevware21-bot
previously approved these changes
Jul 8, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
3427701 to
46da268
Compare
Bound the array-unwrapping loop in _normalizeTimeoutValue to 5 iterations, falling back to the default timeout if no numeric value is found within that bound. Previously a self-referential array (e.g. a[0] = a) passed as a timeout would loop forever.
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.
Bound the array-unwrapping loop in _normalizeTimeoutValue to 5 iterations, falling back to the default timeout if no numeric value is found within that bound. Previously a self-referential array (e.g. a[0] = a) passed as a timeout would loop forever.