Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-20128

Fix front-end bugs detected by SonarQube

    XMLWordPrintable

Details

    • Team C
    • Sprint 82 (Nov 2021)
    • 2

    Description

      SonarQube detected following bugs and vulernabilities
      master branch (3c6581c2367bf4a36f4239bbe9d74d4bf1a1cabb commit)
      they need to be investigated and fixed if confirmed

      app

      File Line Code Bug
      CControllerActionOperationValidate.php 65 return $this->setResponse(new CControllerResponseData(['main_block' => json_encode([])])); Remove this use of the output from "CControllerActionOperationValidate::setResponse"; "CControllerActionOperationValidate::setResponse" doesn't return anything
      CControllerImageCreate.php 103 return $this->setResponse($response); Remove this use of the output from "CControllerImageCreate::setResponse"; "CControllerImageCreate::setResponse" doesn't return anything
      CControllerImageUpdate.php 113 return $this->setResponse($response); Remove this use of the output from "CControllerImageUpdate::setResponse"; "CControllerImageUpdate::setResponse" doesn't return anything
      CControllerPopupAcknowledgeEdit.php 167 $data['problem_severity_can_be_changed'] = !!$editable_triggers; Use the "!" operator just once or not at all. If a type cast is intended, use "(bool)" instead.
      CControllerPopupConditionCommon.php 60 return $this->setResponse( Remove this use of the output from "CControllerPopupConditionCommon::setResponse"; "CControllerPopupConditionCommon::setResponse" doesn't return anything.
      CControllerPopupConditionCommon.php 67 return $this->setResponse(new CControllerResponseData($this->getControllerResponseData())); Remove this use of the output from "CControllerPopupConditionCommon::setResponse"; "CControllerPopupConditionCommon::setResponse" doesn't return anything.
      CControllerPopupDiscoveryCheck.php 103 return $this->setResponse( Remove this use of the output from "CControllerPopupDiscoveryCheck::setResponse"; "CControllerPopupDiscoveryCheck::setResponse" doesn't return anything.
      CControllerProfileUpdate.php 89 case !!preg_match('/web.dashboard.widget.navtree.item-\d+.toggle/', $this->getInput('idx')): Use the "!" operator just once or not at all. If a type cast is intended, use "(bool)" instead.
      CControllerProfileUpdate.php 116 case !!preg_match('/web.dashboard.widget.navtree.item-\d+.toggle/', $this->getInput('idx')): Use the "!" operator just once or not at all. If a type cast is intended, use "(bool)" instead.

      include

      File Line Code Bug
      CLocalApiClient.php 168 return $this->tokenAuthentication($auth); Remove this use of the output from "CLocalApiClient::tokenAuthentication"; "CLocalApiClient::tokenAuthentication" doesn't return anything.
      CDiscoveryRule.php 1369 && $lld_macro_path['path'] !== $lld_macro_path['path']) Identical sub-expressions on both sides of operator "!=="
      CHost.php 1784 if ($tls_psk_identity === '') Review the data-flow - use of uninitialized value.
      CHost.php 1824 if ($tls_issuer !== '') Review the data-flow - use of uninitialized value.
      CHost.php 1830 if ($tls_subject !== '') Review the data-flow - use of uninitialized value.
      CItem.php 338 $sqlParts['where']['h'] = dbConditionString('h.host', $options['filter']['host'], false, true); "dbConditionString" expects 3 arguments, but 4 were provided. Reduce provided arguments or add more parameters.
      CUser.php 1636 return self::exception(ZBX_API_ERROR_PARAMETERS, Remove this use of the output from "self::exception"; "self::exception" doesn't return anything.
      PostgresqlDbBackend.php 242 $schema_set = DBexecute('SET search_path='.zbx_dbstr($this->schema), true); "DBexecute" expects 1 argument, but 2 were provided. Reduce provided arguments or add more parameters.
      CLineGraphDraw.php 2124 if ($this->type == GRAPH_TYPE_STACKED) Remove this conditional structure or edit its code blocks so that they're not all the same.
      CLdap.php 200 return false; Delete this unreachable code or refactor the code to make it reachable.
      CHistFunctionValidator.php 377 return false; Delete this unreachable code or refactor the code to make it reachable.
      general.browserwarning.php 27 <html> Add "lang" and/or "xml:lang" attributes to this "<html>" element
      db.inc.php 43 $DB['DB'] = null; Verify this is the array key that was intended to be written to; a value has already been saved for it and not used.
      forms.inc.php 487 $tags_output = prepareTagsSubfilterOutput($item_params['tags'], $filter_data['subfilter_tags'], "prepareTagsSubfilterOutput" expects 2 arguments, but 3 were provided. Reduce provided arguments or add more parameters.
      forms.inc.php 882 $data['templates'] = makeItemTemplatesHtml($item['itemid'], getItemParentTemplates([$item], $flag), $flag, "makeItemTemplatesHtml" expects 4 arguments, but 5 were provided. Reduce provided arguments or add more parameters.
      forms.inc.php 1679 $data['templates'] = makeTriggerTemplatesHtml($trigger['triggerid'], "makeTriggerTemplatesHtml" expects 4 arguments, but 5 were provided. Reduce provided arguments or add more parameters.

      js

      File Line Code Bug
      class.calendar.js 290 break; Unreachable code.
      class.cmap.js 845 new CTagFilterItem(rows[rows.length - 1]); Either remove this useless object instantiation of "CTagFilterItem" or use it.
      class.cmap.js 1149 break; Unreachable code.
      class.cmap.js 2820 new CTagFilterItem(row[0]); Either remove this useless object instantiation of "CTagFilterItem" or use it.
      class.csuggest.js 118 new RPC.Call(rpcRequest); Either remove this useless object instantiation of "RPC.Call" or use it.
      class.csuggest.js 309 case (key == 37 || key == 39 || key == 9): Explicitly specify 3 separate cases that fall through; currently this case clause only works for "key == 37".
      class.rpc.js 96 new jQuery.ajax(RPC.rpcurl(), request); Expected an assignment or function call and instead saw an expression.
      class.rpc.js 110 }, Duplicate param '_'.
      hostinterfacemanager.js 116 return this; Setter cannot return a value.
      hostinterfacemanager.js 163 new CViewSwitcher(`interfaces_${iface.interfaceid}_details_version`, 'change', Either remove this useless object instantiation of "CViewSwitcher" or use it.
      hostinterfacemanager.js 196 new CViewSwitcher(`interfaces_${iface.interfaceid}_details_securitylevel`, 'change', Either remove this useless object instantiation of "CViewSwitcher" or use it.
      hostinterfacemanager.js 416   Consider using "forEach" instead of "map" as its return value is not being used here.
      hostinterfacemanager.js 518 [...document.querySelectorAll('.' + HostInterfaceManager.ZBX_STYLE_HOST_INTERFACE_ROW)].map((row) => {|Add a "return" statement to this callback.| | hostinterfacemanager.js|525| }

      );

      Consider using "forEach" instead of "map" as its return value is not being used here.
      menupopup.js 641 if ('urls' in options) { TypeError can be thrown as this operand might have primitive type.
      servercheck.js 62 new RPC.Call({ Either remove this useless object instantiation of "RPC.Call" or use it.

      tests

      File Line Code Bug
      COverlayDialogElement.php 103 return $this->ensureNotPresent(); Remove this use of the output from "COverlayDialogElement::ensureNotPresent"; "COverlayDialogElement::ensureNotPresent" doesn't return anything.
      CTest.php 228 return; Delete this unreachable code or refactor the code to make it reachable.
      testFormUserProfile.php 545 if (array_key_exists('send_to', $data) & !array_key_exists('type', $data)) Remove this conditional structure or edit its code blocks so that they're not all the same.
      CRegistryFactoryTest.php 52 $this->assertTrue($this->factory->getObject('string') === $this->factory->getObject('string')); Identical sub-expressions on both sides of operator "==="

      others

      File Line Code Bug
      graphs.php 559 $data['templates'] = makeGraphTemplatesHtml($graph['graphid'], getGraphParentTemplates([$graph], $flag), "makeGraphTemplatesHtml" expects 4 arguments, but 5 were provided. Reduce provided arguments or add more parameters.
      graphs.php 598 $data['visible'] = getRequest('visible'); Verify this is the array key that was intended to be written to; a value has already been saved for it and not used.
      host_prototypes.php 483 $data['templates'] = makeHostPrototypeTemplatesHtml($data['host_prototype']['hostid'], "makeHostPrototypeTemplatesHtml" expects 3 arguments, but 4 were provided. Reduce provided arguments or add more parameters.
      httpconf.php 503 $data['templates'] = makeHttpTestTemplatesHtml($db_httptest['httptestid'], "makeHttpTestTemplatesHtml" expects 3 arguments, but 4 were provided. Reduce provided arguments or add more parameters.

      vulnerabilities

      File Line Code Bug
      CLdap.php 157 if ([email protected]_bind($this->ds)) Provide username and password to authenticate the connection.
      main.js 1059 window.addEventListener('load', e => Verify the message's origin in this cross-origin communication.
      CPage.php 213 $data['sign'] = openssl_encrypt(json_encode($data), 'aes-256-ecb', $config['session_key']); Use secure mode and padding scheme.

      Attachments

        Activity

          People

            sasha Alexander Vladishev
            arimdjonoks Artjoms Rimdjonoks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: