HOR-722 "(Code Scanner) Se debe poder configurar..." SOLVED
Issue:
(Code Scanner) Se debe poder configurar enable_blacklist = 1 en el env.ini de cada workspace
Cause:
Nuevo requerimiento de funciones
Solution:
Se a implementado el "Code Scanner" por workspace esto con el file "/path/to/processmaker/shared/sites/myWorkspace/env.ini",
estableciendo la directiva "enable_blacklist = 1". Caso contrario se hara uso del file "/path/to/processmaker/workflow/engine/config/env.ini"
Note:
Se deberan revisar los siguientes modulos:
- Escaneo de codigo al importar un plugin (no se aplica a plugins enterprise)
- Escaneo de codigo al habilitar un plugin (si el plugin ya se encuentra fisicamente en el directorio de los plugins)
- Escaneo de codigo al importar un proceso
- Escaneo de codigo al crear/modificar codigo de un trigger
- Escaneo de codigo al ejecutar un caso que tenga seteados triggers en sus steps (si el trigger tiene codigo
no deseado, no se ejecuta el trigger)
- Se ha agregado la opcion "check-plugin-disabled-code" al comando "./gulliver", el mismo muestra
informacion sobre los plugins con codigo no deseado.
Ej: $ ./gulliver check-plugin-disabled-code [enterprise-plugin|custom-plugin|all|<plugin-name>]
- Se ha agregado la opcion "check-workspace-disabled-code" al comando "./processmaker", el mismo muestra
informacion sobre los workspaces con codigo no deseado en sus triggers.
Ej: $ ./processmaker check-workspace-disabled-code <myWorkspace>
This commit is contained in:
@@ -14,15 +14,33 @@ class CodeScanner
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* return void
|
||||
* @param mixed $option Option
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($option)
|
||||
public function __construct($option = null)
|
||||
{
|
||||
try {
|
||||
switch ($option) {
|
||||
case "DISABLED_CODE":
|
||||
$this->setArrayDisabledCode();
|
||||
break;
|
||||
$flag = false;
|
||||
|
||||
if (!is_null($option)) {
|
||||
switch (gettype($option)) {
|
||||
case 'string':
|
||||
$workspace = new workspaceTools($option);
|
||||
|
||||
if ($workspace->workspaceExists()) {
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace->name);
|
||||
$flag = (int)($arraySystemConfiguration['enable_blacklist']) == 1;
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
$flag = $option;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($flag) {
|
||||
$this->setArrayDisabledCode();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
@@ -32,9 +50,9 @@ class CodeScanner
|
||||
/**
|
||||
* Set disabled code
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
*/
|
||||
public function setArrayDisabledCode()
|
||||
private function setArrayDisabledCode()
|
||||
{
|
||||
try {
|
||||
//Disabled functions (PHP)
|
||||
@@ -61,9 +79,9 @@ class CodeScanner
|
||||
/**
|
||||
* Get disabled code
|
||||
*
|
||||
* return array Return array with disabled code
|
||||
* @return array Returns an array with disabled code
|
||||
*/
|
||||
public function getArrayDisabledCode()
|
||||
private function getArrayDisabledCode()
|
||||
{
|
||||
try {
|
||||
return $this->arrayDisabledCode;
|
||||
@@ -75,9 +93,9 @@ class CodeScanner
|
||||
/**
|
||||
* Verify if exists disabled code
|
||||
*
|
||||
* return bool Return true if exists disabled code, false otherwise
|
||||
* @return bool Returns true if exists disabled code, false otherwise
|
||||
*/
|
||||
public function existsDisabledCode()
|
||||
private function existsDisabledCode()
|
||||
{
|
||||
try {
|
||||
return !empty($this->arrayDisabledCode);
|
||||
@@ -91,9 +109,9 @@ class CodeScanner
|
||||
*
|
||||
* @param string $source Source
|
||||
*
|
||||
* return array Return array with disabled code found, array empty otherwise
|
||||
* @return array Returns an array with disabled code found, array empty otherwise
|
||||
*/
|
||||
public function checkDisabledCodeInSource($source)
|
||||
private function checkDisabledCodeInSource($source)
|
||||
{
|
||||
try {
|
||||
if (!$this->existsDisabledCode()) {
|
||||
@@ -155,7 +173,7 @@ class CodeScanner
|
||||
* @param string $option Option (SOURCE, PATH, FILE)
|
||||
* @param string $data Data
|
||||
*
|
||||
* return array Return array with disabled code found, array empty otherwise
|
||||
* return array Returns an array with disabled code found, array empty otherwise
|
||||
*/
|
||||
public function checkDisabledCode($option, $data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user