Skip to content

Commit cd7eeb3

Browse files
author
Yevhen Miroshnychenko
committed
MAGETWO-64556: Configuration management - Hide sensitive values from config:show command
1 parent 0328a45 commit cd7eeb3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/code/Magento/Config/Console/Command/ConfigShow/ValueProcessor.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212
use Magento\Config\Model\Config\Structure\Element\Field;
1313
use Magento\Framework\Config\ScopeInterface;
1414
use Magento\Framework\App\Area;
15+
use Magento\Config\Model\Config\Backend\Encrypted;
1516

1617
/**
1718
* Class processes values using backend model which declared in system.xml.
1819
*/
1920
class ValueProcessor
2021
{
22+
/**
23+
* Placeholder for the output of sensitive data.
24+
*
25+
* @const
26+
*/
27+
const SAFE_PLACEHOLDER = '******';
28+
2129
/**
2230
* System configuration structure factory.
2331
*
@@ -84,6 +92,8 @@ public function process($scope, $scopeCode, $value, $path)
8492
$backendModel->setValue($value);
8593
$backendModel->afterLoad();
8694

87-
return $backendModel->getValue();
95+
return ($backendModel instanceof Encrypted)
96+
? self::SAFE_PLACEHOLDER
97+
: $backendModel->getValue();
8898
}
89-
}
99+
}

0 commit comments

Comments
 (0)