diff --git a/CHANGELOG.md b/CHANGELOG.md index 069e70560..d06da7373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Dropped deprecated $smarty->getVariable() method. Use $smarty->getTemplateVars() instead. - $smarty->registerResource() no longer accepts an array of callback functions +## [3.1.40] - 2021-10-13 + +### Changed +- modifier escape now triggers a E_USER_NOTICE when an unsupported escape type is used https://github.com/smarty-php/smarty/pull/649 + +### Security +- More advanced javascript escaping to handle https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements thanks to m-haritonov + +## [3.1.39] - 2021-02-17 + +### Security +- Prevent access to `$smarty.template_object` in sandbox mode. This addresses CVE-2021-26119. +- Fixed code injection vulnerability by using illegal function names in `{function name='blah'}{/function}`. This addresses CVE-2021-26120. + ## [3.1.38] - 2021-01-08 ### Fixed @@ -336,7 +350,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 20.09.2016 - bugfix some $smarty special template variables are no longer accessed as real variable. using them on calls like {if isset($smarty.foo)} or {if empty($smarty.foo)} will fail - https://www.smarty.net/forums/viewtopic.php?t=26222 + http://www.smarty.net/forums/viewtopic.php?t=26222 - temporary fix for https://github.com/smarty-php/smarty/issues/293 main reason still under investigation - improvement new tags {block_parent} {block_child} in template inheritance @@ -348,7 +362,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291 - bugfix function plugins called with assign attribute like {foo assign='bar'} did not output returned content because because assumption was made that it was assigned to a variable https://github.com/smarty-php/smarty/issues/292 - - bugfix calling $smarty->isCached() on a not existing cache file with $smarty->cache_locking = true; could cause a 10 second delay https://www.smarty.net/forums/viewtopic.php?t=26282 + - bugfix calling $smarty->isCached() on a not existing cache file with $smarty->cache_locking = true; could cause a 10 second delay http://www.smarty.net/forums/viewtopic.php?t=26282 - improvement make Smarty::clearCompiledTemplate() on custom resource independent from changes of templateId computation 11.09.2016 diff --git a/README.md b/README.md index 8d2bc0fa4..112b8f63c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Smarty can be run with PHP 7.1 to PHP 8.0. > Read the NEW_FEATURES and INHERITANCE_RELEASE_NOTES file for recent extensions to Smarty 3.1 functionality -Smarty versions 3.1.11 or later are now on github and can be installed with Composer. +Smarty versions 3.1.11 or later are now on GitHub and can be installed with Composer. The "smarty/smarty" package will start at libs/.... subfolder. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..d98ea0189 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,19 @@ +# Security Policy + +## Supported Versions + +Smarty currently supports the latest minor version of Smarty 3 and Smarty 4. (Smarty 4 has not been released yet.) + +| Version | Supported | +| ------- | ------------------ | +| 4.0.x | :white_check_mark: | +| 3.1.x | :white_check_mark: | +| < 3.1 | :x: | + +## Reporting a Vulnerability + + If you have discovered a security issue with Smarty, please contact us at mail [at] simonwisselink.nl. Do not + disclose your findings publicly and PLEASE PLEASE do not file an Issue. + +We will try to confirm the vulnerability and develop a fix if appropriate. When we release the fix, we will publish +a security release. Please let us know if you want to be credited. diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 59dd3bcac..294c1245d 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -98,7 +98,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.38'; + const SMARTY_VERSION = '3.1.40'; /** * define variable scopes */ diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php index 0c0f74da7..47489aa98 100644 --- a/libs/plugins/modifier.escape.php +++ b/libs/plugins/modifier.escape.php @@ -181,7 +181,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ '"' => '\\"', "\r" => '\\r', "\n" => '\\n', - ' '<\/' + ' '<\/', + // see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements + '