Title: [228217] trunk/Tools
Revision
228217
Author
[email protected]
Date
2018-02-06 19:45:59 -0800 (Tue, 06 Feb 2018)

Log Message

webkit-patch upload should ask for confirmation before creating a new bug
https://bugs.webkit.org/show_bug.cgi?id=182551

Reviewed by Daniel Bates.

It is quite easy to paste unintended text into the bug number prompt. This creates a junk bug with an uneditable
first comment, which could result in embarrassment or potentially even a proprietary information leak.

* Scripts/webkitpy/tool/commands/upload_unittest.py:
(test_prepare):
* Scripts/webkitpy/tool/steps/promptforbugortitle.py:
(PromptForBugOrTitle):
(PromptForBugOrTitle.options):
(PromptForBugOrTitle.run):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (228216 => 228217)


--- trunk/Tools/ChangeLog	2018-02-07 03:27:00 UTC (rev 228216)
+++ trunk/Tools/ChangeLog	2018-02-07 03:45:59 UTC (rev 228217)
@@ -1,3 +1,20 @@
+2018-02-06  Ross Kirsling  <[email protected]>
+
+        webkit-patch upload should ask for confirmation before creating a new bug
+        https://bugs.webkit.org/show_bug.cgi?id=182551
+
+        Reviewed by Daniel Bates.
+
+        It is quite easy to paste unintended text into the bug number prompt. This creates a junk bug with an uneditable
+        first comment, which could result in embarrassment or potentially even a proprietary information leak.
+
+        * Scripts/webkitpy/tool/commands/upload_unittest.py:
+        (test_prepare):
+        * Scripts/webkitpy/tool/steps/promptforbugortitle.py:
+        (PromptForBugOrTitle):
+        (PromptForBugOrTitle.options):
+        (PromptForBugOrTitle.run):
+
 2018-02-06  Youenn Fablet  <[email protected]>
 
         HasServiceWorkerRegistration bit should be sent when creating a new page

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py (228216 => 228217)


--- trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py	2018-02-07 03:27:00 UTC (rev 228216)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py	2018-02-07 03:45:59 UTC (rev 228217)
@@ -110,6 +110,7 @@
     def test_prepare(self):
         options = MockOptions()
         options.sort_xcode_project = False
+        options.non_interactive = True
         expected_logs = "MOCK create_bug\nbug_title: Mock user response\nbug_description: Mock user response\ncomponent: MOCK component\ncc: MOCK cc\n"
         self.assert_execute_outputs(Prepare(), [], expected_logs=expected_logs, options=options)
 

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py (228216 => 228217)


--- trunk/Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py	2018-02-07 03:27:00 UTC (rev 228216)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py	2018-02-07 03:45:59 UTC (rev 228217)
@@ -27,9 +27,16 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from webkitpy.tool.steps.abstractstep import AbstractStep
+from webkitpy.tool.steps.options import Options
 
 
 class PromptForBugOrTitle(AbstractStep):
+    @classmethod
+    def options(cls):
+        return AbstractStep.options() + [
+            Options.non_interactive,
+        ]
+
     def run(self, state):
         # No need to prompt if we alrady have the bug_id.
         if state.get("bug_id"):
@@ -40,6 +47,8 @@
         try:
             state["bug_id"] = int(user_response)
         except ValueError as TypeError:
+            if not self._options.non_interactive and not self._tool.user.confirm("Are you sure you want to create a new bug?", default="n"):
+                self._exit(1)
             state["bug_title"] = user_response
             # FIXME: This is kind of a lame description.
             state["bug_description"] = user_response
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to