Skip to content

Report a value after a literal URL start again in the characters of the string - #15486

Open
danog wants to merge 3 commits into
vimeo:masterfrom
danog:url-start-string-offsets
Open

danog wants to merge 3 commits into
vimeo:masterfrom
danog:url-start-string-offsets

Conversation

@danog

@danog danog commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #15205: review and merge that one first. Independent of #15485.

Psalm misses a redirect or SSRF target made of the characters of a string after its literal URL start.

Before

<?php
/** @psalm-taint-sink redirect $url */
function redirectTo(string $url): void {}

$url = "https://example.com/?" . (string) $_GET["value"];
$cut = "";
for ($i = 21; $i < strlen($url); $i++) {
    $cut .= $url[$i];
}
redirectTo($cut); // no issue

After

redirectTo($cut); // TaintedRedirect

Unchanged, before and after

$urls = ["https://example.com/" . (string) $_GET["value"]];
redirectTo($urls[0]); // no issue

@danog

danog commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

bugbot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a8d1328. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Performance: unchanged · Types: unchanged · Taint: +8 −0

Project Memory (MB) Wall (s) Issues Weighted (types) Taint Dead code
✅ laravel 1 801.0 $\color{gray}{\textsf{+0.3\%}}$ 73.8 $\color{gray}{\textsf{+0.9\%}}$ 25 836 $\color{red}{\textsf{+8}}$ $\color{gray}{\textsf{-0}}$ 52 365 841 $\color{orange}{\textsf{+8}}$ $\color{gray}{\textsf{-0}}$ 0
✅ symfony 3 606.0 $\color{gray}{\textsf{+0.3\%}}$ 202.4 $\color{gray}{\textsf{+0.1\%}}$ 52 447 100 811 1 891 0
✅ doctrine-orm 338.5 18.4 $\color{gray}{\textsf{+0.7\%}}$ 3 352 5 800 0 0
✅ psl 623.6 23.6 $\color{gray}{\textsf{+2.3\%}}$ 1 296 5 125 2 0
✅ phpunit 433.8 16.4 $\color{gray}{\textsf{-1.9\%}}$ 1 575 2 363 18 0
✅ php-parser 228.8 10.8 $\color{gray}{\textsf{-2.0\%}}$ 17 032 21 091 0 0
✅ tempest 915.7 $\color{gray}{\textsf{+0.1\%}}$ 30.9 $\color{gray}{\textsf{+1.3\%}}$ 5 511 11 032 288 0
✅ amphp-amp 48.7 1.7 $\color{gray}{\textsf{+1.2\%}}$ 30 57 0 0
✅ webmozarts-assert 282.6 $\color{gray}{\textsf{+0.1\%}}$ 5.5 $\color{gray}{\textsf{+1.5\%}}$ 576 2 740 0 0
✅ guzzle-promises 47.3 1.9 $\color{gray}{\textsf{-4.4\%}}$ 148 403 2 0
✅ monolog 140.5 $\color{gray}{\textsf{+0.1\%}}$ 7.1 $\color{gray}{\textsf{+3.3\%}}$ 937 2 483 31 0
✅ drupal 5 104.0 $\color{gray}{\textsf{+0.2\%}}$ 274.7 $\color{gray}{\textsf{+0.6\%}}$ 97 865 168 986 684 0
✅ wordpress 2 035.6 $\color{gray}{\textsf{+0.3\%}}$ 153.0 $\color{gray}{\textsf{-0.3\%}}$ 143 503 678 445 479 1
Total 15 606.2 $\color{gray}{\textsf{+0.2\%}}$ 820.4 $\color{gray}{\textsf{+0.3\%}}$ 350 108 $\color{red}{\textsf{+8}}$ $\color{gray}{\textsf{-0}}$ 1 051 701 4 236 $\color{orange}{\textsf{+8}}$ $\color{gray}{\textsf{-0}}$ 1
How to read this table
  • Memory: Psalm's own peak figure, threads=1. More than +5 % fails, unless the PR changes composer.json.
  • Wall: base and head run side by side on the same runner; ±10 % is noise. Above +10 % warns, never fails. re-run: a second round was taken and the faster run of each side kept.
  • Issues: head count over all categories, then $\color{red}{\textsf{+added}}$ $\color{green}{\textsf{-removed}}$ against base.
  • Weighted (types): type issues weighted by error level (levels 1–8 as is, always-errors 10, strictness checks 1). Taint and dead-code issues are not weighed. The projects' own code is pinned and their dependencies resolve identically for base and head, so a change means Psalm reports more, fewer or differently serious issues. A rise is not necessarily a regression.
  • Taint: head count of Tainted* issues, then $\color{orange}{\textsf{+added}}$ $\color{orange}{\textsf{-removed}}$ against base. Both are orange as either direction needs review: more can be new detection or false positives, fewer can be fixed false positives or lost detection.
  • Dead code: head count of unused-code issues, shown only when a run reported some (findUnusedCode). More is red, fewer is green.
  • Total: sum over the projects compared on both sides. Its wall time warns above +5 % (±5 % is noise); the other thresholds apply per project.
  • Profiling: when both sides support it, the measured runs use --debug-performance=PATH for the hot-files block, which adds the same small CPU and memory cost to both sides.
  • Colors: $\color{red}{\textsf{red}}$ past a fail or warn threshold (or more issues), $\color{green}{\textsf{green}}$ an improvement past noise (or fewer issues), $\color{orange}{\textsf{orange}}$ needs review, $\color{gray}{\textsf{gray}}$ noise.
  • Performance: regressed if a head run crashed or timed out or a memory or wall delta is red, else improved if one is green, else unchanged. Its icon is the check result: ❌ fail · ⚠️ warn · ✅ pass; the icon next to each project is that project's result, 💥 = not comparable: base crashed or timed out (counts as ⚠️).
  • Types (heading): direction of the total weighted change, increased · decreased · unchanged. Taint and Dead code (heading): added and removed counts, present only when non-zero. Informational, never fails the check.
✅ laravel: issues +8 −0

Memory 1 795.7 → 1 801.0 MB (+0.3 %) · Wall 73.2 → 73.8 s (+0.9 %)

Taint 833 → 841 (+8 −0)

Issue type added removed
TaintedSSRF 8 0

Added (8)

head a8d1328 · base ce88a9a (merge-base) · workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant