← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1788045] [NEW] Cannot delete security group rules with unicode chars in their description

 

Public bug reported:

 Some editing programs, like gdoc, will mutate double quotes to their
unicode equivalent if you haven't disabled that feature. If someone
accidentally creates a security group rule with a magic quote (due to an
errant copy and paste) they could create a security group with a magic
double quote in the description.

 Subsequent attempts to delete that rule will fail with "Failed to
delete rule with name or ID 'fc52f547-300e-43cd-ae8e-833d856b304a':
'ascii' codec can't encode character u'\u201d' in position 136: ordinal
not in range(128)"

 To fix this I had to go into the DB and update the description line to
remove the errant magic quote, at which point the delete succeeded.

I'm including the following in case anyone else hits this and wants a quick example of how to fix it:
mysql> use neutron;

mysql> select * from securitygrouprules where id='fc52f547-300e-43cd-ae8e-833d856b304a' \G
*************************** 1. row ***************************
       project_id: 335384b960d53910a94b201fbb78a13a
               id: fc52f547-300e-43cd-ae8e-833d856b304a
security_group_id: e595a97d-1729-4686-b5e7-123b4af30dba
  remote_group_id: e595a97d-1729-4686-b5e7-123b4af30dba
        direction: ingress
        ethertype: IPv4
         protocol: icmp
   port_range_min: 11
   port_range_max: NULL
 remote_ip_prefix: 0.0.0.0/0
 standard_attr_id: 977
1 row in set (0.00 sec)

mysql> select * from standardattributes where id=977;
+-----+--------------------+---------------------+---------------------+---------------+-----------------+
| id  | resource_type      | created_at          | updated_at          | description   | revision_number |
+-----+--------------------+---------------------+---------------------+---------------+-----------------+
| 977 | securitygrouprules | 2018-08-08 22:37:56 | 2018-08-08 22:37:56 | ICMP Ping”    |               0 |
+-----+--------------------+---------------------+---------------------+---------------+-----------------+

1 row in set (0.00 sec)
mysql> update standardattributes set description = "ICMP PING" where id=977;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

(openstack) security group rule delete fc52f547-300e-43cd-ae8e-833d856b304a
(openstack)

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1788045

Title:
  Cannot delete security group rules with unicode chars in their
  description

Status in neutron:
  New

Bug description:
   Some editing programs, like gdoc, will mutate double quotes to their
  unicode equivalent if you haven't disabled that feature. If someone
  accidentally creates a security group rule with a magic quote (due to
  an errant copy and paste) they could create a security group with a
  magic double quote in the description.

   Subsequent attempts to delete that rule will fail with "Failed to
  delete rule with name or ID 'fc52f547-300e-43cd-ae8e-833d856b304a':
  'ascii' codec can't encode character u'\u201d' in position 136:
  ordinal not in range(128)"

   To fix this I had to go into the DB and update the description line
  to remove the errant magic quote, at which point the delete succeeded.

  I'm including the following in case anyone else hits this and wants a quick example of how to fix it:
  mysql> use neutron;

  mysql> select * from securitygrouprules where id='fc52f547-300e-43cd-ae8e-833d856b304a' \G
  *************************** 1. row ***************************
         project_id: 335384b960d53910a94b201fbb78a13a
                 id: fc52f547-300e-43cd-ae8e-833d856b304a
  security_group_id: e595a97d-1729-4686-b5e7-123b4af30dba
    remote_group_id: e595a97d-1729-4686-b5e7-123b4af30dba
          direction: ingress
          ethertype: IPv4
           protocol: icmp
     port_range_min: 11
     port_range_max: NULL
   remote_ip_prefix: 0.0.0.0/0
   standard_attr_id: 977
  1 row in set (0.00 sec)

  mysql> select * from standardattributes where id=977;
  +-----+--------------------+---------------------+---------------------+---------------+-----------------+
  | id  | resource_type      | created_at          | updated_at          | description   | revision_number |
  +-----+--------------------+---------------------+---------------------+---------------+-----------------+
  | 977 | securitygrouprules | 2018-08-08 22:37:56 | 2018-08-08 22:37:56 | ICMP Ping”    |               0 |
  +-----+--------------------+---------------------+---------------------+---------------+-----------------+

  1 row in set (0.00 sec)
  mysql> update standardattributes set description = "ICMP PING" where id=977;
  Query OK, 1 row affected (0.00 sec)
  Rows matched: 1  Changed: 1  Warnings: 0

  (openstack) security group rule delete fc52f547-300e-43cd-ae8e-833d856b304a
  (openstack)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1788045/+subscriptions


Follow ups