← Back to Pull requests

fix(security): make tool argument limits configurable #276

Closed
unknown closed this pull request without merging on Oct 15, 2026 06:47 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 11:19 UTC
Author

Problem

sanitizeToolParams applied hard-coded limits to every tool's arguments:

  • the property-count check used Object.keys, so an array with more than 100 items was refused with "Object has too many properties (101 > 100)";

  • any string over 10,000 characters was refused, and nothing could raise the limit.
  • Fix

  • Arrays are no longer counted as object properties. They have their own maxArrayLength limit, unlimited by default.

  • New plugin option toolArgumentLimits: { maxStringLength, maxObjectProperties, maxArrayLength, maxDepth }, passed through to sanitizeToolParams. Infinity disables a limit. The ToolArgumentLimits type is exported.

  • The defaults for string length (10000), object properties (100) and depth (10) are unchanged.

  • Array items are sanitized recursively: strings inside objects or nested arrays within arrays get the same length check and control-character removal as top-level values (previously only direct string items were sanitized).

  • README documents the option in the plugin options list and in the input sanitization section.
  • Tests (test/tool-argument-limits.test.ts): a 101-item array is accepted by default; the default string and property limits still apply; raised maxStringLength accepts 10001 characters; raised maxObjectProperties accepts more keys; lowered string, property, array and depth limits refuse arguments before the handler runs; strings inside objects and nested arrays within arrays are length-checked and stripped of control characters.

    Breaking change

    None. Under the defaults, arrays with more than 100 items are now accepted, and strings nested in objects or arrays inside arrays are now sanitized (an over-long one is refused, as it already was outside arrays).

    Fixes #256

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01UF4S3w7iA83V9DVsasLJzM

    Diff: 236 lines (+177 / -59) across 2 files Reviewer: rozzilla Review duration: 2608m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 236 lines diff across 2 files
    0.60
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.327
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #276"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 60.4% (MEDIUM) · Higher = larger blast radius
    60.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.8% · Safe to merge
    23.8%