Skip to content

Commit

Permalink
Improve escaping.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Dec 1, 2023
1 parent 3258839 commit b0ee11f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
### 3.2.1

[2022.11.22; Maikuolan]: Maintenance release.

### v3.3.0

[2023.12.01; Maikuolan]: Improved escaping.
6 changes: 3 additions & 3 deletions src/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* License: GNU/GPLv2
* @see LICENSE.txt
*
* This file: CLI handler (last modified: 2023.09.26).
* This file: CLI handler (last modified: 2023.12.01).
*/

namespace phpMussel\CLI;
Expand Down Expand Up @@ -148,8 +148,8 @@ public function __construct(\phpMussel\Core\Loader &$Loader, \phpMussel\Core\Sca
$Clean = $this->Scanner->normalise(substr($Clean, strlen($Command) + 1));
$URL = ['AvoidMe' => '', 'ForThis' => ''];
if (
!preg_match_all('/(data|file|https?|ftps?|sftp|ss[hl])\:\/\/(www\d{0,3}\.)?([\da-z.-]{1,512})/i', $Clean, $URL['domain']) ||
!preg_match_all('/(data|file|https?|ftps?|sftp|ss[hl])\:\/\/(www\d{0,3}\.)?([\!\#\$\&-;\=\?\@-\[\]_a-z~]{1,4000})/i', $Clean, $URL['url'])
!preg_match_all('/(data|file|https?|ftps?|sftp|ss[hl]):\/\/(www\d{0,3}\.)?([\da-z.-]{1,512})/i', $Clean, $URL['domain']) ||
!preg_match_all('/(data|file|https?|ftps?|sftp|ss[hl]):\/\/(www\d{0,3}\.)?([\!\#\$\&-;\=\?\@-\[\]_a-z~]{1,4000})/i', $Clean, $URL['url'])
) {
echo $this->Loader->L10N->getString('invalid_url') . "\n";
continue;
Expand Down

0 comments on commit b0ee11f

Please sign in to comment.