Referring to the example code below, in the case of Mage_Core_Exception why is the error message from the exception being used directly $e->getMessage() rather than a custom message like $result['error_msg'] = $this->__('There was an error processing ...')
Doesn't this represent a security risk where the error message from the exception might be something like "unknown table user_password in the database" and this gets sent to the frontend via AJAX or other means?
Path: app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
public function responseAction()
{
$data = $this->getRequest()->getPost();
/* @var $paymentMethod Mage_Authorizenet_Model_DirectPost */
$paymentMethod = Mage::getModel('authorizenet/directpost');
$result = array();
if (!empty($data['x_invoice_num'])) {
$result['x_invoice_num'] = $data['x_invoice_num'];
}
try {
if (!empty($data['store_id'])) {
$paymentMethod->setStore($data['store_id']);
}
$paymentMethod->process($data);
$result['success'] = 1;
}
catch (Mage_Core_Exception $e) {
Mage::logException($e);
$result['success'] = 0;
$result['error_msg'] = $e->getMessage();
}
catch (Exception $e) {
Mage::logException($e);
$result['success'] = 0;
$result['error_msg'] = $this->__('There was an error processing your order. Please contact us or try again later.');
}
if (!empty($data['controller_action_name'])) {
if (!empty($data['key'])) {
$result['key'] = $data['key'];
}
$result['controller_action_name'] = $data['controller_action_name'];
$result['is_secure'] = isset($data['is_secure']) ? $data['is_secure'] : false;
$params['redirect'] = Mage::helper('authorizenet')->getRedirectIframeUrl($result);
}
$block = $this->_getIframeBlock()->setParams($params);
$this->getResponse()->setBody($block->toHtml());
}