You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ty...@apache.org on 2020/09/23 17:02:11 UTC

[openwhisk] branch master updated: Add defensive code to the controller for when it gets bad query parameters (#4952)

This is an automated email from the ASF dual-hosted git repository.

tysonnorris pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new af16122  Add defensive code to the controller for when it gets bad query parameters (#4952)
af16122 is described below

commit af161221244399e801b0217af554abd00e96c2b2
Author: dan mcweeney <mc...@adobe.com>
AuthorDate: Wed Sep 23 13:01:39 2020 -0400

    Add defensive code to the controller for when it gets bad query parameters (#4952)
    
    * Add defensive code to the controller for when it gets bad query parameters
---
 .../scala/org/apache/openwhisk/http/BasicHttpService.scala     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala b/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala
index 27f1be9..a168df7 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala
@@ -120,7 +120,15 @@ trait BasicHttpService extends Directives {
   protected def logRequestInfo(req: HttpRequest)(implicit tid: TransactionId): LogEntry = {
     val m = req.method.name
     val p = req.uri.path.toString
-    val q = req.uri.query().toString
+
+    val q: String = {
+      try {
+        req.uri.query().toString
+      } catch {
+        case _: IllegalUriException => s"Bad query parameters:${req.uri.toString()}"
+        case e: Exception           => s"Query parsing error: ${e.getMessage}"
+      }
+    }
     val l = loglevelForRoute(p)
     LogEntry(s"[$tid] $m $p $q", l)
   }