← Back to Pull requests

[5.4] [AI] Prevent arrays from poisoning scalar user state #48170

Closed
unknown closed this pull request without merging on Sep 09, 2026 17:16 UTC
View on GitHub
unknown unknown commented on Jul 31, 2026 01:01 UTC
Author

Pull Request resolves #48158.

Credit to @CyrusXxXxX for reporting and documenting the original issue.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.
  • Summary of Changes

    CMSApplication::getUserStateFromRequest() now infers whether arrays are
    expected from the caller's default and explicit filter.

  • An array returned by a scalar filter no longer replaces scalar user state.

  • Previously stored array state is repaired to the scalar default.

  • Intentional array defaults and explicit array, raw, or none filters

  • keep their existing array behavior.
  • Unit coverage exercises rejected array input, repaired stored state, normal

  • scalar input, and intentional recursively filtered arrays.

    Testing Instructions

    1. Run:
    libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Application/CMSApplicationTest.php
    2. Confirm all four tests and eight assertions pass.
    3. Optionally request a core list view with an array parameter such as
    limit[]=5, then confirm scalar global.list.limit state is not replaced
    by an array.

    Validation performed locally:

  • Focused test file: 4 tests, 8 assertions

  • Application unit-test directory: 5 tests, 10 assertions

  • Full unit suite: 1,133 tests, 1,640 assertions

  • Focused PHPStan: no errors

  • Joomla PHPCS on both changed files: pass

  • git diff --check: pass
  • Actual result BEFORE applying this Pull Request

    An array request filtered as uint remains an array because Joomla Framework's
    input filter recursively filters array values. The application persists that
    array into scalar session state such as global.list.limit.

    Expected result AFTER applying this Pull Request

    Scalar user state remains scalar. Array input is ignored for scalar state, and
    already poisoned state is repaired to the caller's scalar default. Callers that
    intentionally expect arrays retain their existing behavior.

    Link to documentations


    Please select:
  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
  • Diff: 282 lines (+211 / -71) across 3 files Reviewer: carrerasdarren-cell Review duration: 58575m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 282 lines diff across 3 files
    0.40
    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%
    56%
    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.338
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #48170"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    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: 39.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 17.2% · Safe to merge
    17.2%