Title: [233276] trunk/Tools
Revision
233276
Author
[email protected]
Date
2018-06-27 14:10:20 -0700 (Wed, 27 Jun 2018)

Log Message

webkit-patch should ignore non-ASCII characters in the status server API key
https://bugs.webkit.org/show_bug.cgi?id=187107

Reviewed by Lucas Forschler.

The API key should only consists of ASCII characters. If it contains any
non-ASCII characters then log a warning and ignore them.

* Scripts/webkitpy/common/net/statusserver.py:
(StatusServer.set_api_key): Force conversion to ASCII.
* Scripts/webkitpy/tool/main.py:
(WebKitPatch._status_server_api_key): Convert to ASCII, ignoring non-ASCII
characters and logging a warning.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (233275 => 233276)


--- trunk/Tools/ChangeLog	2018-06-27 20:10:24 UTC (rev 233275)
+++ trunk/Tools/ChangeLog	2018-06-27 21:10:20 UTC (rev 233276)
@@ -1,3 +1,19 @@
+2018-06-27  Daniel Bates  <[email protected]>
+
+        webkit-patch should ignore non-ASCII characters in the status server API key
+        https://bugs.webkit.org/show_bug.cgi?id=187107
+
+        Reviewed by Lucas Forschler.
+
+        The API key should only consists of ASCII characters. If it contains any
+        non-ASCII characters then log a warning and ignore them.
+
+        * Scripts/webkitpy/common/net/statusserver.py:
+        (StatusServer.set_api_key): Force conversion to ASCII.
+        * Scripts/webkitpy/tool/main.py:
+        (WebKitPatch._status_server_api_key): Convert to ASCII, ignoring non-ASCII
+        characters and logging a warning.
+
 2018-06-27  Jonathan Bedard  <[email protected]>
 
         Enable WebKit iOS 12 build

Modified: trunk/Tools/Scripts/webkitpy/common/net/statusserver.py (233275 => 233276)


--- trunk/Tools/Scripts/webkitpy/common/net/statusserver.py	2018-06-27 20:10:24 UTC (rev 233275)
+++ trunk/Tools/Scripts/webkitpy/common/net/statusserver.py	2018-06-27 21:10:20 UTC (rev 233276)
@@ -63,7 +63,7 @@
         self.bot_id = bot_id
 
     def set_api_key(self, api_key):
-        self._api_key = api_key
+        self._api_key = str(api_key)
         new_headers = filter(lambda header: header[0] != self._AUTHORIZATION_HEADER_NAME, self._browser.addheaders)
         if api_key:
             new_headers.append(self._authorization_header_name_and_value_pair())

Modified: trunk/Tools/Scripts/webkitpy/tool/main.py (233275 => 233276)


--- trunk/Tools/Scripts/webkitpy/tool/main.py	2018-06-27 20:10:24 UTC (rev 233275)
+++ trunk/Tools/Scripts/webkitpy/tool/main.py	2018-06-27 21:10:20 UTC (rev 233276)
@@ -111,6 +111,11 @@
         api_key = os.environ.get('WEBKIT_STATUS_API_KEY')
         if not api_key:
             api_key = WebKitPatch._status_server_api_key_from_git()
+        try:
+            api_key = str(api_key)
+        except UnicodeEncodeError:
+            _log.warning('Ignoring non-ASCII characters in API key.')
+            api_key = api_key.encode('ascii', 'ignore')
         return api_key
 
     # FIXME: This may be unnecessary since we pass global options to all commands during execute() as well.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to