Title: [283061] trunk/Tools
Revision
283061
Author
aakash_j...@apple.com
Date
2021-09-24 15:11:41 -0700 (Fri, 24 Sep 2021)

Log Message

Gracefully handle security bugs in apply-watchlist
https://bugs.webkit.org/show_bug.cgi?id=229961

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla._parse_bug_dictionary_from_xml):
(Bugzilla.fetch_bug):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (283060 => 283061)


--- trunk/Tools/ChangeLog	2021-09-24 21:57:27 UTC (rev 283060)
+++ trunk/Tools/ChangeLog	2021-09-24 22:11:41 UTC (rev 283061)
@@ -1,3 +1,14 @@
+2021-09-24  Aakash Jain  <aakash_j...@apple.com>
+
+        Gracefully handle security bugs in apply-watchlist
+        https://bugs.webkit.org/show_bug.cgi?id=229961
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla._parse_bug_dictionary_from_xml):
+        (Bugzilla.fetch_bug):
+
 2021-09-24  Sam Sneddon  <gsnedd...@apple.com>
 
         LayoutTestFinder should return tests in order

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (283060 => 283061)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2021-09-24 21:57:27 UTC (rev 283060)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2021-09-24 22:11:41 UTC (rev 283061)
@@ -457,6 +457,10 @@
 
     def _parse_bug_dictionary_from_xml(self, page):
         soup = BeautifulStoneSoup(page, convertEntities=BeautifulStoneSoup.XML_ENTITIES)
+        bug_element = soup.find('bug')
+        if bug_element and bug_element.get('error', '') == 'NotPermitted':
+            _log.warning("You don't have permission to view this bug.")
+            return {}
         bug = {}
         bug["id"] = int(soup.find("bug_id").string)
         bug["title"] = self._string_contents(soup.find("short_desc"))
@@ -490,7 +494,10 @@
     # FIXME: A BugzillaCache object should provide all these fetch_ methods.
 
     def fetch_bug(self, bug_id):
-        return Bug(self.fetch_bug_dictionary(bug_id), self)
+        bug_dictionary = self.fetch_bug_dictionary(bug_id)
+        if bug_dictionary:
+            return Bug(bug_dictionary, self)
+        return None
 
     def fetch_attachment_contents(self, attachment_id):
         attachment_url = self.attachment_url_for_id(attachment_id)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to