Page MenuHomePhorge

TypeError: idx(): Argument #1 ($array) must be of type array, string given in PhabricatorSearchHovercardController.php
Open, Needs TriagePublic

Description

Recently someone was fuzzing our instance passing random URI parameters.

http://phorge.localhost/search/hovercard/?__path__=%2fsearch%2fhovercard%2f&cards={"layout":"foo"} triggers:

EXCEPTION: (TypeError) idx(): Argument #1 ($array) must be of type array, string given, called in /var/www/html/phorge/phorge/src/applications/search/controller/PhabricatorSearchHovercardController.php on line 37 at [<arcanist>/src/utils/utils.php:37]
arcanist(head=master, ref.master=29575b4f9187), phorge(head=idx, ref.master=2ce25747851f, ref.calFormatNull=2ce25747851f)
  #0 <#2> idx(string, string) called at [<phorge>/src/applications/search/controller/PhabricatorSearchHovercardController.php:37]
  #1 <#2> PhabricatorSearchHovercardController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #2 phlog(TypeError) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #3 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, TypeError) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:753]
  #4 AphrontApplicationConfiguration::handleThrowable(TypeError) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #5 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #6 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

I'd suggest boldly ignoring values which are not arrays.
Maybe there is a cleaner/better solution but I'm merely after less noise in our logs and I do not consider a hovercard failure critical at all.

Event Timeline

aklapper renamed this task from TypeError) idx(): Argument #1 ($array) must be of type array, string given in PhabricatorSearchHovercardController.php to TypeError: idx(): Argument #1 ($array) must be of type array, string given in PhabricatorSearchHovercardController.php.Sun, May 18, 20:34