summaryrefslogtreecommitdiff
path: root/swift/account/utils.py
diff options
context:
space:
mode:
authorClay Gerrard <clay.gerrard@gmail.com>2019-09-13 12:25:24 -0500
committerClay Gerrard <clay.gerrard@gmail.com>2019-11-27 11:22:00 -0600
commit698717d886b2b55ea9b490719851c85c20b57240 (patch)
tree57c685e8ae4c2d6bbe503ec56e109533b97d710a /swift/account/utils.py
parenta2aaf598520331874c8d49a3230f6d4892fb3207 (diff)
downloadswift-698717d886b2b55ea9b490719851c85c20b57240.tar.gz
Allow internal clients to use reserved namespace
Reserve the namespace starting with the NULL byte for internal use-cases. Backend services will allow path names to include the NULL byte in urls and validate names in the reserved namespace. Database services will filter all names starting with the NULL byte from responses unless the request includes the header: X-Backend-Allow-Reserved-Names: true The proxy server will not allow path names to include the NULL byte in urls unless a middlware has set the X-Backend-Allow-Reserved-Names header. Middlewares can use the reserved namespace to create objects and containers that can not be directly manipulated by clients. Any objects and bytes created in the reserved namespace will be aggregated to the user's account totals. When deploying internal proxys developers and operators may configure the gatekeeper middleware to translate the X-Allow-Reserved-Names header to the Backend header so they can manipulate the reserved namespace directly through the normal API. UpgradeImpact: it's not safe to rollback from this change Change-Id: If912f71d8b0d03369680374e8233da85d8d38f85
Diffstat (limited to 'swift/account/utils.py')
-rw-r--r--swift/account/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/swift/account/utils.py b/swift/account/utils.py
index 4e5ebe1ad..89fb26f84 100644
--- a/swift/account/utils.py
+++ b/swift/account/utils.py
@@ -17,6 +17,7 @@ import json
import six
+from swift.common import constraints
from swift.common.middleware import listing_formats
from swift.common.swob import HTTPOk, HTTPNoContent, str_to_wsgi
from swift.common.utils import Timestamp
@@ -71,15 +72,17 @@ def get_response_headers(broker):
def account_listing_response(account, req, response_content_type, broker=None,
- limit='', marker='', end_marker='', prefix='',
- delimiter='', reverse=False):
+ limit=constraints.ACCOUNT_LISTING_LIMIT,
+ marker='', end_marker='', prefix='', delimiter='',
+ reverse=False):
if broker is None:
broker = FakeAccountBroker()
resp_headers = get_response_headers(broker)
account_list = broker.list_containers_iter(limit, marker, end_marker,
- prefix, delimiter, reverse)
+ prefix, delimiter, reverse,
+ req.allow_reserved_names)
data = []
for (name, object_count, bytes_used, put_timestamp, is_subdir) \
in account_list: