TypeError: Incorrect padding when setting metadata_encryption_key

Bug #1569937 reported by Tom Patzig on 2016-04-13
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Undecided
Konrad Djimeli

Bug Description

We are on liberty. We have show_multiple_locations set, to allow swift locations for images. But when setting metadata_encryption_key to a random 32 char string, glance throws an internal server error, e.g. on image-list:

2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi [req-fad0e0cb-1094-40ee-a314-ac189c660329 ed12c3c9e4144827bc2b041da22c94b8 7f0b5f95e9f24cf3924e5aba39fddeca - - -] Caught error: Incorrect padding
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi Traceback (most recent call last):
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 879, in __call__
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi request, **action_args)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/common/wsgi.py", line 907, in dispatch
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi return method(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/api/v2/images.py", line 116, in index
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi member_status=member_status)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/api/authorization.py", line 113, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi images = self.image_repo.list(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/domain/proxy.py", line 89, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi items = self.base.list(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/api/policy.py", line 123, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi return super(ImageRepoProxy, self).list(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/domain/proxy.py", line 89, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi items = self.base.list(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/domain/proxy.py", line 89, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi items = self.base.list(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/domain/proxy.py", line 89, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi items = self.base.list(*args, **kwargs)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/db/__init__.py", line 185, in list
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi image = self._format_image_from_db(db_image, db_image['tags'])
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/db/__init__.py", line 201, in _format_image_from_db
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi l['url'] = crypt.urlsafe_decrypt(key, l['url'])
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib/python2.7/site-packages/glance/common/crypt.py", line 74, in urlsafe_decrypt
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi ciphertext = base64.urlsafe_b64decode(six.binary_type(ciphertext))
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib64/python2.7/base64.py", line 112, in urlsafe_b64decode
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi return b64decode(s, '-_')
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi File "/usr/lib64/python2.7/base64.py", line 76, in b64decode
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi raise TypeError(msg)
2016-04-13 11:11:00.461 1592 ERROR glance.common.wsgi TypeError: Incorrect padding

Konrad Djimeli (djkonro) on 2016-05-03
Changed in glance:
assignee: nobody → Konrad Djimeli (djkonro)

Fix proposed to branch: master
Review: https://review.openstack.org/319659

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

Other bug subscribers