Can't shard containers with special characters in their names
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
...in particular, at least newlines.
When we set the root container information in shards [0], we don't quote the name, we just send it raw. A slightly modified probe test demonstrates the bad:
diff --git a/test/
index 2d5c5417f.
--- a/test/
+++ b/test/
@@ -104,7 +104,7 @@ class BaseTestContain
return ['obj-%04d' % x for x in range(number)]
def _setup_
- self.container_name = 'container-%s' % uuid.uuid4()
+ self.container_name = 'container\n%s' % uuid.uuid4()
def setUp(self):
Tests fail like:
FAIL: test_async_pendings (test.probe.
-------
Traceback (most recent call last):
File "/vagrant/
[sr.state for sr in expected_
AssertionError: Lists differ: [30, 30, 20] != [10, 10, 10]
While logs show errors like:
Dec 18 18:53:00 saio container-
Traceback (most recent call last):
File "/vagrant/
headers=
File "/vagrant/
content_
File "/vagrant/
method, path, headers=headers)
File "/vagrant/
ipaddr, port, method, path, headers, query_string, ssl)
File "/vagrant/
conn.
File "/vagrant/
HTTPConnect
File "/usr/local/
raise ValueError('Invalid header value %r' % (values[i],))
ValueError: Invalid header value b'AUTH_
Bah, forgot my link for [0] -- https:/ /github. com/openstack/ swift/blob/ 2.23.0/ swift/container /sharder. py#L1129
Also, there's a similar (but subtly different) problem when sharding a reserved-name container: http.client is willing to send the header, but then it fails validation on the server: https:/ /github. com/openstack/ swift/blob/ 2.23.0/ swift/common/ db.py#L884- L885
I think the way to get around this is our usual approach of quote()ing the header value -- but we'll likely need to use a new header name so we don't mess up existing containers whose (unquoted) name actually includes percent-signs.