Skip to content

THRIFT-6014: Add recursion depth limit to skip() in JavaScript library#3500

Merged
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6014
May 19, 2026
Merged

THRIFT-6014: Add recursion depth limit to skip() in JavaScript library#3500
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6014

Conversation

@Jens-G
Copy link
Copy Markdown
Member

@Jens-G Jens-G commented May 19, 2026

Summary

  • Adds a depth parameter to Thrift.Protocol.prototype.skip in lib/js/src/thrift.js
  • Throws TProtocolException with DEPTH_LIMIT when depth exceeds 64
  • Aligns the browser library with the Node.js protocols (binary, compact, JSON in lib/nodejs/) which already enforce this limit
  • Adds a QUnit test file (test-skip-depth.js) and corresponding HTML harness covering the limit boundary

Test plan

  • lib/js/test/test-skip-depth.html — new tests: throws DEPTH_LIMIT when called at depth 64 (increments to 65), no throw at depth 63 for a leaf type
  • Existing JavaScript tests continue to pass

🤖 Generated with Claude Code

Client: js

Aligns the browser JavaScript library skip() with the Node.js protocols
(binary, compact, JSON), which already enforce a depth limit of 64.
Adds a depth parameter and throws TProtocolException with DEPTH_LIMIT
when depth exceeds 64. Adds a QUnit test harness covering the boundary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jens-G Jens-G requested a review from emmenlau as a code owner May 19, 2026 23:15
@mergeable mergeable Bot added the javascript Pull requests that update Javascript code label May 19, 2026
@Jens-G Jens-G merged commit c216ba4 into apache:master May 19, 2026
179 of 182 checks passed
@Jens-G Jens-G deleted the THRIFT-6014 branch May 21, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant