packagist psalm/plugin-laravel v4.23.0

latest release: v4.23.1
3 hours ago

This release targets Psalm 7.13. It reports open redirects and cookies without the secure flag, reads the session and raw database queries back from what the application stored, and trusts values Validator::make() checked against a regex.

Requirements

  • Require vimeo/psalm ^7.13.1 (#2373). Projects on Psalm 7.12 keep v4.22.7.

Features

  • Report a user-controlled redirect target as TaintedRedirect, and the URL syntax injected after a fixed server as TaintedUrlComponent/TaintedUrlPath, on redirect(), Redirector, ResponseFactory and its contract (#2357)
redirect('https://example.com/' . (string) $request->input('page'));
// TaintedUrlComponent
  • Report a cookie made with the secure flag explicitly off as InsecureCookie (#2357)
response()->json(['ok' => 1])->cookie('session', $token, 0, '/', null, false, true, false, 'Strict');
// InsecureCookie
  • Track what raw DB/Connection queries store in each column, and report it where a query reads that column back (#2359)
DB::insert('INSERT INTO comments (author, body) VALUES (?, ?)', ['admin', $request->input('body')]);

$comment = DB::selectOne('SELECT author, body FROM comments');
echo (string) $comment->body;
// TaintedHtml
echo (string) $comment->author;
// no issue
  • Trust a value that Validator::make() or validator() checked against a regex rule once the validator passes (#2358)
 $validator = Validator::make(['agent' => $agent], ['agent' => ['required', 'regex:#^[a-zA-Z0-9 _.\-]+$#']]);
 if ($validator->fails()) {
     return;
 }
 echo $agent;
-// TaintedHtml
+// no issue

Fixes

  • Read a session value back from what the application stored under its key instead of treating every session read as user input (#2357). getOldInput() and previousUrl() stay user input.
 $session->flash('status', 'saved');
 $session->put('name', $request->input('name'));

 echo (string) $session->get('status');
-// TaintedHtml
+// no issue
 echo (string) $session->get('name');
 // TaintedHtml
  • Keep the values of a where([...]) array, which Laravel binds as parameters, free of TaintedSql on Psalm 7.13 (#2373)

Full Changelog: v4.22.7...v4.23.0

Don't miss a new plugin-laravel release

NewReleases is sending notifications on new releases.