Bad JSON in application credential example

Bug #2002672 reported by Olaf Seibert
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
In Progress
Low
Unassigned

Bug Description

In the form for creating application credentials, there is an example of what you can fill in for Access Rules.

One would expect that the example works, but it doesn't.

I attach a screen shot.

The issue is likely that there are non-breakable spaces in the example, which aren't valid JSON.
The YAML example also doesn't work.

versions (the patch is for our own skinning):

heat-dashboard-common_3.0.1-0ubuntu1+5eda8988~focal~syseleven1_all.deb
openstack-dashboard-common_18.3.5-0ubuntu2.1+220c4858~focal~syseleven1_all.deb
openstack-dashboard-ubuntu-theme_18.3.5-0ubuntu2.1+220c4858~focal~syseleven1_all.deb
openstack-dashboard_18.3.5-0ubuntu2.1+220c4858~focal~syseleven1_all.deb
python3-django-horizon_18.3.5-0ubuntu2.1+220c4858~focal~syseleven1_all.deb
python3-django-openstack-auth_18.3.5-0ubuntu2.1+220c4858~focal~syseleven1_all.deb
python3-heat-dashboard_3.0.1-0ubuntu1+5eda8988~focal~syseleven1_all.deb
python3-neutron-lbaas-dashboard_6.0.0-0ubuntu1.1+de473530~focal~syseleven1_all.deb
python3-neutron-vpnaas-dashboard_2.0.0-1+13bac31b~focal~syseleven1_all.deb
python3-octavia-dashboard_5.0.0-0ubuntu0.20.04.2+85b36c13~focal~syseleven1_all.deb

Revision history for this message
Olaf Seibert (oseibert-sys11) wrote :
summary: - Bad JSON in application crediential example
+ Bad JSON in application credential example
Revision history for this message
Akihiro Motoki (amotoki) wrote :

It seems to depend on how a browser copies-and-pastes from a code snipet (with  ) to a form.
Google Chrome allows me to paste the example as a valid JSON or YAML, but Firefox does not.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Ideally, all browsers works consistently on pasting HTML to a text node like textarea.
While it is not a fix but a workaround for different behaviors across browsers, I think horizon can replace NBSP to ASCII space during the validation process like:

 rules = rules.replace('\xa0', ' ')

in openstack_dashboard/dashboards/identity/application_credentials/forms.py.

Changed in horizon:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Olaf Seibert (oseibert-sys11) wrote :

I was indeed using Firefox. I didn't think to try another browser, sorry.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/horizon/+/870885

Changed in horizon:
status: Triaged → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.