Skip to content

security: enforce envelope limits before JSON parsing - #48

Merged
seonghobae merged 11 commits into
mainfrom
security/preparse-envelope-limits
Aug 4, 2026
Merged

seonghobae merged 11 commits into
mainfrom
security/preparse-envelope-limits

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • extend the iterative duplicate-name scanner to count JSON values and track scalar/container depth before native parsing
  • reject pathological wide or deep raw JSON before JSON.parse() materializes the complete object graph
  • reserve the fixed three-value and one-depth envelope wrapper allowance so public limits remain scoped to documentJson
  • retain post-parse limits during detached cloning as defense in depth
  • distinguish duplicate names, malformed syntax, value-count exhaustion, and nesting exhaustion without recursive scanning
  • add parser-integration and exact-boundary tests
  • update documentation, CHANGELOG, and prepare version 0.5.19

Buyer-visible impact

Large versioned envelopes can arrive through object stores, database BLOBs, queues, and network gateways. Previous byte/text ceilings bounded total input and post-parse cloning bounded accepted documents, but a syntactically valid wide or deep payload could still make the native JSON parser allocate a complete over-budget graph before rejection. This slice closes that allocation window.

Security and architecture

The scanner is iterative, transport-neutral, and keeps malformed syntax delegated to the canonical parser when resource ceilings are not exceeded. No database, credential, environment-variable, provider, or naruon-specific dependency is added. CWL and naruon hosts still enforce compressed-body, transport, timeout, concurrency, rate, tenant, authorization, schema-migration, and product-tier limits.

Standards basis

  • RFC 8259 sections 9–10: implementations may set limits on JSON text size, nesting, number range/precision, and string length
  • OWASP Denial of Service guidance: bound input-driven allocation and resource consumption
  • OWASP REST Security guidance: validate length, range, format, type, and request size

Verification required

  • TypeScript typecheck
  • repository-wide 100% statement/branch/function/line coverage
  • library, collaboration, converter, packed-package consumer, and demo builds
  • Office Python 3.11/3.14 dependency, docstring, branch-coverage, wheel, schema, and license gates
  • SAST, dependency, and security scans
  • no unresolved actionable human or automated review findings on the exact current head

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 30230c8f-5dd5-4ffa-8870-829f4e32d713

📥 Commits

Reviewing files that changed from the base of the PR and between 5c06870 and c26a19a.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • docs/document-envelope.md
  • package.json
  • src/documentEnvelope.ts
  • src/documentEnvelopeLimits.test.ts
  • src/jsonObjectNameScanner.test.ts
  • src/jsonObjectNameScanner.ts
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/preparse-envelope-limits

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae merged commit 23b66de into main Aug 4, 2026
28 checks passed
@seonghobae
seonghobae deleted the security/preparse-envelope-limits branch August 4, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant