Skip to content

Commit efa71d7

Browse files
committed
Upgrade dependencies
jQuery 3.5.1 htmLawed 1.2.5 PHPMailer 5.2.28
1 parent 8642876 commit efa71d7

6 files changed

Lines changed: 40 additions & 20 deletions

File tree

qa-content/jquery-3.3.1.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

qa-content/jquery-3.5.1.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

qa-include/app/page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ function qa_content_prepare($voting = false, $categoryids = array())
798798
}
799799
}
800800

801-
$qa_content['script_rel'] = array('qa-content/jquery-3.3.1.min.js');
801+
$qa_content['script_rel'] = array('qa-content/jquery-3.5.1.min.js');
802802
$qa_content['script_rel'][] = 'qa-content/qa-global.js?' . QA_VERSION;
803803

804804
if ($voting)

qa-include/vendor/PHPMailer/class.phpmailer.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PHPMailer
3131
* The PHPMailer Version number.
3232
* @var string
3333
*/
34-
public $Version = '5.2.26';
34+
public $Version = '5.2.28';
3535

3636
/**
3737
* Email priority.
@@ -1296,9 +1296,12 @@ public function preSend()
12961296

12971297
// Sign with DKIM if enabled
12981298
if (!empty($this->DKIM_domain)
1299-
&& !empty($this->DKIM_selector)
1300-
&& (!empty($this->DKIM_private_string)
1301-
|| (!empty($this->DKIM_private) && file_exists($this->DKIM_private))
1299+
and !empty($this->DKIM_selector)
1300+
and (!empty($this->DKIM_private_string)
1301+
or (!empty($this->DKIM_private)
1302+
and self::isPermittedPath($this->DKIM_private)
1303+
and file_exists($this->DKIM_private)
1304+
)
13021305
)
13031306
) {
13041307
$header_dkim = $this->DKIM_Add(
@@ -1463,6 +1466,18 @@ protected static function isShellSafe($string)
14631466
return true;
14641467
}
14651468

1469+
/**
1470+
* Check whether a file path is of a permitted type.
1471+
* Used to reject URLs and phar files from functions that access local file paths,
1472+
* such as addAttachment.
1473+
* @param string $path A relative or absolute path to a file.
1474+
* @return bool
1475+
*/
1476+
protected static function isPermittedPath($path)
1477+
{
1478+
return !preg_match('#^[a-z]+://#i', $path);
1479+
}
1480+
14661481
/**
14671482
* Send mail using the PHP mail() function.
14681483
* @param string $header The message headers
@@ -1791,7 +1806,7 @@ public function setLanguage($langcode = 'en', $lang_path = '')
17911806
// There is no English translation file
17921807
if ($langcode != 'en') {
17931808
// Make sure language file path is readable
1794-
if (!is_readable($lang_file)) {
1809+
if (!self::isPermittedPath($lang_file) or !is_readable($lang_file)) {
17951810
$foundlang = false;
17961811
} else {
17971812
// Overwrite language-specific strings.
@@ -2499,6 +2514,8 @@ public function textLine($value)
24992514
* Add an attachment from a path on the filesystem.
25002515
* Never use a user-supplied path to a file!
25012516
* Returns false if the file could not be found or read.
2517+
* Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client.
2518+
* If you need to do that, fetch the resource yourself and pass it in via a local file or string.
25022519
* @param string $path Path to the attachment.
25032520
* @param string $name Overrides the attachment name.
25042521
* @param string $encoding File encoding (see $Encoding).
@@ -2510,7 +2527,7 @@ public function textLine($value)
25102527
public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
25112528
{
25122529
try {
2513-
if (!@is_file($path)) {
2530+
if (!self::isPermittedPath($path) or !@is_file($path)) {
25142531
throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
25152532
}
25162533

@@ -2691,10 +2708,13 @@ protected function attachAll($disposition_type, $boundary)
26912708
protected function encodeFile($path, $encoding = 'base64')
26922709
{
26932710
try {
2694-
if (!is_readable($path)) {
2711+
if (!self::isPermittedPath($path) or !file_exists($path)) {
26952712
throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
26962713
}
2697-
$magic_quotes = get_magic_quotes_runtime();
2714+
$magic_quotes = false;
2715+
if( version_compare(PHP_VERSION, '7.4.0', '<') ) {
2716+
$magic_quotes = get_magic_quotes_runtime();
2717+
}
26982718
if ($magic_quotes) {
26992719
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
27002720
set_magic_quotes_runtime(false);
@@ -3035,7 +3055,7 @@ public function addStringAttachment(
30353055
*/
30363056
public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
30373057
{
3038-
if (!@is_file($path)) {
3058+
if (!self::isPermittedPath($path) or !@is_file($path)) {
30393059
$this->setError($this->lang('file_access') . $path);
30403060
return false;
30413061
}

qa-include/vendor/PHPMailer/class.smtp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SMTP
3030
* The PHPMailer SMTP version number.
3131
* @var string
3232
*/
33-
const VERSION = '5.2.26';
33+
const VERSION = '5.2.28';
3434

3535
/**
3636
* SMTP line break constant.
@@ -81,7 +81,7 @@ class SMTP
8181
* @deprecated Use the `VERSION` constant instead
8282
* @see SMTP::VERSION
8383
*/
84-
public $Version = '5.2.26';
84+
public $Version = '5.2.28';
8585

8686
/**
8787
* SMTP server port number.

qa-include/vendor/htmLawed.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
htmLawed 1.2.4.1, 12 September 2017
4+
htmLawed 1.2.5, 24 September 2019
55
Copyright Santosh Patnaik
66
Dual licensed with LGPL 3 and GPL 2+
77
A PHP Labware internal utility - www.bioinformatics.org/phplabware/internal_utilities/htmLawed
@@ -43,7 +43,7 @@ function htmLawed($t, $C=1, $S=array()){
4343
// config URLs
4444
$x = (isset($C['schemes'][2]) && strpos($C['schemes'], ':')) ? strtolower($C['schemes']) : 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, tel, telnet'. (empty($C['safe']) ? ', app, javascript; *: data, javascript, ' : '; *:'). 'file, http, https';
4545
$C['schemes'] = array();
46-
foreach(explode(';', str_replace(array(' ', "\t", "\r", "\n"), '', $x)) as $v){
46+
foreach(explode(';', trim(str_replace(array(' ', "\t", "\r", "\n"), '', $x), ';')) as $v){
4747
$x = $x2 = null; list($x, $x2) = explode(':', $v, 2);
4848
if($x2){$C['schemes'][$x] = array_flip(explode(',', $x2));}
4949
}
@@ -390,7 +390,7 @@ function hl_spec($t){
390390
if(!function_exists('hl_aux1')){function hl_aux1($m){
391391
return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", '`"'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", '"'), $m[0]), 1, -1);
392392
}}
393-
$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', 'hl_aux1', trim($t)));
393+
$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', 'hl_aux1', trim($t)));
394394
for($i = count(($t = explode(';', $t))); --$i>=0;){
395395
$w = $t[$i];
396396
if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))){continue;}
@@ -652,11 +652,11 @@ function hl_tag2(&$e, &$a, $t=1){
652652
$a2 = '';
653653
while(preg_match('`(^|\s)(color|size)\s*=\s*(\'|")?(.+?)(\\3|\s|$)`i', $a, $m)){
654654
$a = str_replace($m[0], ' ', $a);
655-
$a2 .= strtolower($m[2]) == 'color' ? (' color: '. str_replace('"', '\'', trim($m[4])). ';') : (isset($fs[($m = trim($m[4]))]) ? ($a2 .= ' font-size: '. str_replace('"', '\'', $fs[$m]). ';') : '');
655+
$a2 .= strtolower($m[2]) == 'color' ? (' color: '. str_replace(array('"', ';', ':'), '\'', trim($m[4])). ';') : (isset($fs[($m = trim($m[4]))]) ? (' font-size: '. $fs[$m]. ';') : '');
656656
}
657657
while(preg_match('`(^|\s)face\s*=\s*(\'|")?([^=]+?)\\2`i', $a, $m) or preg_match('`(^|\s)face\s*=(\s*)(\S+)`i', $a, $m)){
658658
$a = str_replace($m[0], ' ', $a);
659-
$a2 .= ' font-family: '. str_replace('"', '\'', trim($m[3])). ';';
659+
$a2 .= ' font-family: '. str_replace(array('"', ';', ':'), '\'', trim($m[3])). ';';
660660
}
661661
$e = 'span'; return ltrim(str_replace('<', '', $a2));
662662
}
@@ -725,5 +725,5 @@ function hl_tidy($t, $w, $p){
725725

726726
function hl_version(){
727727
// version
728-
return '1.2.4.1';
728+
return '1.2.5';
729729
}

0 commit comments

Comments
 (0)