Repository: fedora-infra/bodhi

Issue:
Cannot edit builds/bugs in an update
After update to bodhi-5.0.0, I cannot edit builds nor bugs for an update.

- I haven't found any way of editing it in GUI (when clicking "edit", there is a list of builds and a list of bugs, but it cannot be edited or at least it's not clear how).
- In CLI, I get "Password:" prompt even though I have valid kerberos ticket.


Discussion:
> In CLI, I get "Password:" prompt even though I have valid kerberos ticket.

Bodhi doesn't use kerberos to authenticate, it's one of our remaining app (and the only CLI) using openid 2 so that is expected and has not changed recently (we do plan on changing this in the future though).
Can you post a screenshot of the edit update screen?

the builds and bugs boxes should show a list of the currently added builds / bugs. As well as a X button to remove builds, and also a textbox to search and add more builds.

![screencast](https://user-images.githubusercontent.com/592259/68822076-a8ee1080-06db-11ea-8b14-dea2e1e84682.gif)


Sure, this is how it looks like:

![Screenshot_2019-11-14_07-13-33](https://user-images.githubusercontent.com/7996847/68831649-323b1e00-06af-11ea-9ca9-24c975def796.png)

I can select and de-select builds and bugs, but that's about it.

> Bodhi doesn't use kerberos to authenticate, it's one of our remaining app (and the only CLI) using openid 2 so that is expected and has not changed recently (we do plan on changing this in the future though).

I'd swear I created some overrides using the CLI before without entering any password, so it surprised me now that I can't, but I am not absolutely sure. Thanks for the explanation! I'll try it out later.
I managed to edit the updates using CLI, but it would still be nice to be able to do that using GUI.
@pkratoch there is something definetly wrong on your end, the controls for adding / removing builds and bugs don't seem to loading properly.

Are you able to check the web console in your web browser to check if there are any errors being reported there?
There is indeed an error. Let me know if you want me to debug it somehow.
![Screenshot_2019-11-14_10-39-30](https://user-images.githubusercontent.com/7996847/68845560-e5b20b80-06cb-11ea-96b7-4b4600aa9d72.png)

> I'd swear I created some overrides using the CLI before without entering any password, so it surprised me now that I can't, but I am not absolutely sure. Thanks for the explanation! I'll try it out later.

The authentication cookie is stored on disk and bodhi's CLI won't ask you for username/password if that cookie is still valid, so you may not need to re-login for a while sometime :)
@ryanlerch the problem with selectize may be due to unescaped characters while parsing the JSON response: there's one bug attached to the update with `"` in title

Resolving patch:
diff --git a/bodhi/server/util.py b/bodhi/server/util.py
--- a/bodhi/server/util.py
+++ b/bodhi/server/util.py
@@ -1303,3 +1303,14 @@ def pyfile_to_module(
         e.strerror = 'Unable to load file (%s)' % e.strerror
         raise
     return d
+
+
+def json_escape(text: str) -> str:
+    """Escape double quotes for JSON.parse compatibility.
+
+    Args:
+        text: The text to sanitize.
+    Returns:
+        Escaped text.
+    """
+    return text.replace('"', '\\"')


Test patch:
diff --git a/bodhi/tests/server/test_util.py b/bodhi/tests/server/test_util.py
--- a/bodhi/tests/server/test_util.py
+++ b/bodhi/tests/server/test_util.py
@@ -1572,3 +1572,11 @@ def test_no_latest(self):
         build.get_latest.return_value = None
         util.generate_changelog(build)
         build.get_changelog.assert_called_with(0)
+
+
+class TestJsonEscape:
+    """Tests for the json_escape() function."""
+    def test_doublequotes_escaped(self):
+        """Test that double quotes are escaped correctly for JSON.parse()."""
+        title = 'This is a "terrible" bug title!'
+        assert util.json_escape(title) == 'This is a \\"terrible\\" bug title!'