Skip to content

Commit

Permalink
Patch SUPEE-10570 / Upgrade 1.9.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
spinsch authored and colinmollenhour committed Mar 9, 2018
1 parent 0e7f77e commit fd5b947
Show file tree
Hide file tree
Showing 65 changed files with 363 additions and 84 deletions.
10 changes: 10 additions & 0 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
==== 1.9.3.8 ====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
] NOTE: Current Release Notes are maintained at: [
] [
] http://devdocs.magento.com/guides/m1x/ce19-ee114/ce1.9_release-notes.html [
] [
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

==== 1.9.3.7 ====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static function getVersionInfo()
'major' => '1',
'minor' => '9',
'revision' => '3',
'patch' => '7',
'patch' => '8',
'stability' => '',
'number' => '',
);
Expand Down Expand Up @@ -844,6 +844,7 @@ public static function log($message, $level = null, $file = '', $forceLog = fals
$message = print_r($message, true);
}

$message = addcslashes($message, '<?');
$loggers[$file]->log($message, $level);
}
catch (Exception $e) {
Expand Down
10 changes: 10 additions & 0 deletions app/code/core/Mage/Admin/Helper/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ public function isTypeAllowed($type)
{
return isset($this->_allowedTypes[$type]);
}

/**
* Get disallowed names for block
*
* @return bool
*/
public function getDisallowedBlockNames()
{
return Mage::getResourceModel('admin/block')->getDisallowedBlockNames();
}
}
4 changes: 4 additions & 0 deletions app/code/core/Mage/Admin/Model/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public function validate()
if (!Zend_Validate::is($this->getBlockName(), 'NotEmpty')) {
$errors[] = Mage::helper('adminhtml')->__('Block Name is required field.');
}
$disallowedBlockNames = Mage::helper('admin/block')->getDisallowedBlockNames();
if (in_array($this->getBlockName(), $disallowedBlockNames)) {
$errors[] = Mage::helper('adminhtml')->__('Block Name is disallowed.');
}
if (!Zend_Validate::is($this->getBlockName(), 'Regex', array('/^[-_a-zA-Z0-9\/]*$/'))) {
$errors[] = Mage::helper('adminhtml')->__('Block Name is incorrect.');
}
Expand Down
21 changes: 21 additions & 0 deletions app/code/core/Mage/Admin/Model/Resource/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class Mage_Admin_Model_Resource_Block extends Mage_Core_Model_Resource_Db_Abstra
*/
const CACHE_ID = 'permission_block';

/**
* Disallowed names for block
*
* @var array
*/
protected $disallowedBlockNames = array('install/end');

/**
* Define main table
*
Expand Down Expand Up @@ -70,6 +77,10 @@ protected function _generateCache()
/** @var Mage_Admin_Model_Resource_Block_Collection $collection */
$collection = Mage::getResourceModel('admin/block_collection');
$collection->addFieldToFilter('is_allowed', array('eq' => 1));
$disallowedBlockNames = $this->getDisallowedBlockNames();
if (is_array($disallowedBlockNames) && count($disallowedBlockNames) > 0) {
$collection->addFieldToFilter('block_name', array('nin' => $disallowedBlockNames));
}
$data = $collection->getColumnValues('block_name');
$data = array_flip($data);
Mage::app()->saveCache(
Expand Down Expand Up @@ -98,4 +109,14 @@ protected function _afterDelete(Mage_Core_Model_Abstract $object)
$this->_generateCache();
return parent::_afterDelete($object);
}

/**
* Get disallowed names for block
*
* @return array
*/
public function getDisallowedBlockNames()
{
return $this->disallowedBlockNames;
}
}
3 changes: 2 additions & 1 deletion app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,15 @@ public function authenticate($username, $password)
/**
* Login user
*
* @param string $login
* @param string $username
* @param string $password
* @return Mage_Admin_Model_User
*/
public function login($username, $password)
{
if ($this->authenticate($username, $password)) {
$this->getResource()->recordLogin($this);
Mage::getSingleton('core/session')->renewFormKey();
}
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function _prepareColumns()
if ($store->getId()) {
$this->addColumn('custom_name',
array(
'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
'header'=> Mage::helper('catalog')->__('Name in %s', $this->escapeHtml($store->getName())),
'index' => 'custom_name',
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public function render(Varien_Object $row)
{
$str = '';
if($row->getTemplateSenderName()) {
$str .= htmlspecialchars($row->getTemplateSenderName()) . ' ';
$str .= $this->escapeHtml($row->getTemplateSenderName()) . ' ';
}
if($row->getTemplateSenderEmail()) {
$str .= '[' . $row->getTemplateSenderEmail() . ']';
$str .= '[' .$this->escapeHtml($row->getTemplateSenderEmail()) . ']';
}
if($str == '') {
$str .= '---';
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ protected function _prepareColumns()
'type' => 'store',
'store_view'=> true,
'display_deleted' => true,
'escape' => true,
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getOrderStoreName()
$store->getGroup()->getName(),
$store->getName()
);
return implode('<br/>', $name);
return implode('<br/>', array_map(array($this, 'escapeHtml'), $name));
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected function _prepareForm()
$values[] = array('label'=>$group->getName(),'value'=>$group->getId());
}
}
$groups[] = array('label'=>$website->getName(),'value'=>$values);
$groups[] = array('label' => $this->escapeHtml($website->getName()), 'value' => $values);
}
$fieldset->addField('store_group_id', 'select', array(
'name' => 'store[group_id]',
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Tag/Assigned/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected function _prepareColumns()
if ($store->getId()) {
$this->addColumn('custom_name',
array(
'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
'header'=> Mage::helper('catalog')->__('Name in %s', $this->escapeHtml($store->getName())),
'index' => 'custom_name',
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ public function render(Varien_Object $row)
$data = $this->_getStoreModel()->getStoresStructure(false, $origStores);

foreach ($data as $website) {
$out .= $website['label'] . '<br/>';
$out .= Mage::helper('core')->escapeHtml($website['label']) . '<br/>';
foreach ($website['children'] as $group) {
$out .= str_repeat('&nbsp;', 3) . $group['label'] . '<br/>';
$out .= str_repeat('&nbsp;', 3) . Mage::helper('core')->escapeHtml($group['label']) . '<br/>';
foreach ($group['children'] as $store) {
$out .= str_repeat('&nbsp;', 6) . $store['label'] . '<br/>';
$out .= str_repeat('&nbsp;', 6) . Mage::helper('core')->escapeHtml($store['label']) . '<br/>';
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ public function getTabClass($tab)
public function getTabLabel($tab)
{
if ($tab instanceof Mage_Adminhtml_Block_Widget_Tab_Interface) {
return $tab->getTabLabel();
return $this->escapeHtml($tab->getTabLabel());
}
return $tab->getLabel();
return $this->escapeHtml($tab->getLabel());
}

public function getTabContent($tab)
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Adminhtml/Model/Config/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function save()
}

foreach ($groupData['fields'] as $field => $fieldData) {
$field = ltrim($field, '/');
$fieldConfig = $sections->descend($section . '/groups/' . $group . '/fields/' . $field);
if (!$fieldConfig && $clonedFields && isset($mappedFields[$field])) {
$fieldConfig = $sections->descend($section . '/groups/' . $group . '/fields/'
Expand Down
8 changes: 5 additions & 3 deletions app/code/core/Mage/Adminhtml/Model/System/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
}
if (!$websiteShow) {
$options[] = array(
'label' => $website->getName(),
'label' => Mage::helper('core')->escapeHtml($website->getName()),
'value' => array()
);
$websiteShow = true;
Expand All @@ -161,13 +161,15 @@ public function getStoreValuesForForm($empty = false, $all = false)
$values = array();
}
$values[] = array(
'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(),
'label' => str_repeat($nonEscapableNbspChar, 4) .
Mage::helper('core')->escapeHtml($store->getName()),
'value' => $store->getId()
);
}
if ($groupShow) {
$options[] = array(
'label' => str_repeat($nonEscapableNbspChar, 4) . $group->getName(),
'label' => str_repeat($nonEscapableNbspChar, 4) .
Mage::helper('core')->escapeHtml($group->getName()),
'value' => $values
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,16 @@ public function saveAction()
$this->_filterStockData($data['product']['stock_data']);

$product = $this->_initProductSave();
// check sku attribute
$productSku = $product->getSku();
if ($productSku && $productSku != Mage::helper('core')->stripTags($productSku)) {
$this->_getSession()->addError($this->__('HTML tags are not allowed in SKU attribute.'));
$this->_redirect('*/*/edit', array(
'id' => $productId,
'_current' => true
));
return;
}

try {
$product->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public function saveAction()
// Force new customer confirmation
if ($isNewCustomer) {
$customer->setPassword($data['account']['password']);
$customer->setPasswordCreatedAt(time());
$customer->setForceConfirmed(true);
if ($customer->getPassword() == 'auto') {
$sendPassToEmail = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
*/
class Mage_Adminhtml_System_BackupController extends Mage_Adminhtml_Controller_Action
{
/**
* Controller predispatch method
*
* @return Mage_Adminhtml_Controller_Action
*/
public function preDispatch()
{
$this->_setForcedFormKeyActions('create');
return parent::preDispatch();
}

/**
* Backup list action
*/
Expand Down
24 changes: 24 additions & 0 deletions app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Mage_Core_Model_Session_Abstract_Varien extends Varien_Object
const VALIDATOR_HTTP_VIA_KEY = 'http_via';
const VALIDATOR_REMOTE_ADDR_KEY = 'remote_addr';
const VALIDATOR_SESSION_EXPIRE_TIMESTAMP = 'session_expire_timestamp';
const VALIDATOR_PASSWORD_CREATE_TIMESTAMP = 'password_create_timestamp';
const SECURE_COOKIE_CHECK_KEY = '_secure_cookie_check';

/** @var bool Flag true if session validator data has already been evaluated */
Expand Down Expand Up @@ -396,6 +397,16 @@ public function useValidateSessionExpire()
return $this->getCookie()->getLifetime() > 0;
}

/**
* Use password creation timestamp in validator key
*
* @return bool
*/
public function useValidateSessionPasswordTimestamp()
{
return true;
}

/**
* Retrieve skip User Agent validation strings (Flash etc)
*
Expand Down Expand Up @@ -477,6 +488,14 @@ protected function _validate()
$this->_data[self::VALIDATOR_KEY][self::VALIDATOR_SESSION_EXPIRE_TIMESTAMP]
= $validatorData[self::VALIDATOR_SESSION_EXPIRE_TIMESTAMP];
}
if ($this->useValidateSessionPasswordTimestamp()
&& isset($validatorData[self::VALIDATOR_PASSWORD_CREATE_TIMESTAMP])
&& isset($sessionData[self::VALIDATOR_SESSION_EXPIRE_TIMESTAMP])
&& $validatorData[self::VALIDATOR_PASSWORD_CREATE_TIMESTAMP]
> $sessionData[self::VALIDATOR_SESSION_EXPIRE_TIMESTAMP] - $this->getCookie()->getLifetime()
) {
return false;
}

return true;
}
Expand Down Expand Up @@ -513,6 +532,11 @@ public function getValidatorData()

$parts[self::VALIDATOR_SESSION_EXPIRE_TIMESTAMP] = time() + $this->getCookie()->getLifetime();

if (isset($this->_data['visitor_data']['customer_id'])) {
$parts[self::VALIDATOR_PASSWORD_CREATE_TIMESTAMP] =
Mage::helper('customer')->getPasswordTimestamp($this->_data['visitor_data']['customer_id']);
}

return $parts;
}

Expand Down
5 changes: 4 additions & 1 deletion app/code/core/Mage/Core/Model/Variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ public function getVariablesOptionArray($withGroup = false)
foreach ($collection->toOptionArray() as $variable) {
$variables[] = array(
'value' => '{{customVar code=' . $variable['value'] . '}}',
'label' => Mage::helper('core')->__('%s', $variable['label'])
'label' => Mage::helper('core')->__(
'%s',
Mage::helper('core')->escapeHtml($variable['label']
))
);
}
if ($withGroup && $variables) {
Expand Down
17 changes: 17 additions & 0 deletions app/code/core/Mage/Customer/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,23 @@ public function getVatValidationUserMessage($customerAddress, $customerGroupAuto
return $validationMessageEnvelope;
}

/**
* Get customer password creation timestamp or customer account creation timestamp
*
* @param $customerId
* @return int
*/
public function getPasswordTimestamp($customerId)
{
/** @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->load((int)$customerId);
$passwordCreatedAt = $customer->getPasswordCreatedAt();

return is_null($passwordCreatedAt) ? $customer->getCreatedAtTimestamp() : $passwordCreatedAt;
}

/**
* Create SOAP client based on VAT validation service WSDL
*
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Customer/Model/Resource/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ public function loadByEmail(Mage_Customer_Model_Customer $customer, $email, $tes
*/
public function changePassword(Mage_Customer_Model_Customer $customer, $newPassword)
{
$customer->setPassword($newPassword);
$customer->setPassword($newPassword)->setPasswordCreatedAt(time());
$this->saveAttribute($customer, 'password_hash');
$this->saveAttribute($customer, 'password_created_at');
return $this;
}

Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Customer/controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public function createPostAction()

if (empty($errors)) {
$customer->cleanPasswordsValidationData();
$customer->setPasswordCreatedAt(time());
$customer->save();
$this->_dispatchRegisterSuccess($customer);
$this->_successProcessRegistration($customer);
Expand Down Expand Up @@ -865,6 +866,7 @@ public function resetPasswordPostAction()
$customer->setRpToken(null);
$customer->setRpTokenCreatedAt(null);
$customer->cleanPasswordsValidationData();
$customer->setPasswordCreatedAt(time());
$customer->save();

$this->_getSession()->unsetData(self::TOKEN_SESSION_NAME);
Expand Down Expand Up @@ -1009,6 +1011,7 @@ public function editPostAction()

try {
$customer->cleanPasswordsValidationData();
$customer->setPasswordCreatedAt(time());

// Reset all password reset tokens if all data was sufficient and correct on email change
if ($customer->getIsChangeEmail()) {
Expand Down
Loading

0 comments on commit fd5b947

Please sign in to comment.