Skip to content

Carry the taint of a Stringable through its methods - #2374

Merged
danog merged 1 commit into
psalm:4.xfrom
danog:stringable-this-flow
Nov 21, 2026
Merged

danog merged 1 commit into
psalm:4.xfrom
danog:stringable-this-flow

Conversation

@danog

@danog danog commented Nov 21, 2026

Copy link
Copy Markdown
Member

A tainted Stringable loses its taint through the methods of a chain, such as trim(), upper(), after() and limit().

Before

function showName(\Illuminate\Http\Request $request): void {
    $name = $request->str('name');

    echo $name->trim()->upper(); // no issue
    echo $name->after('@')->limit(20); // no issue
    echo $name->append('!')->toString(); // no issue
}

After

    echo $name->trim()->upper(); // TaintedHtml
    echo $name->after('@')->limit(20); // TaintedHtml
    echo $name->append('!')->toString(); // TaintedHtml

@danog
danog requested a review from alies-dev as a code owner November 21, 2026 00:14
@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpsalm-plugin-laravel
Branchpr-2374
Testbedintel-v1
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
seconds (s)
(Result Δ%)
Upper Boundary
seconds (s)
(Limit %)
Peak MemoryBenchmark Result
megabytes (MB) x 1e3
(Result Δ%)
Upper Boundary
megabytes (MB) x 1e3
(Limit %)
monica📈 view plot
🚷 view threshold
44.74 s
(+3.00%)Baseline: 43.43 s
45.29 s
(98.78%)
📈 view plot
🚷 view threshold
1.17 MB x 1e3
(+0.13%)Baseline: 1.17 MB x 1e3
1.23 MB x 1e3
(95.37%)
🐰 View full continuous benchmarking report in Bencher

@danog
danog merged commit 3349f83 into psalm:4.x Nov 21, 2026
17 checks passed
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