diff --git a/s3-bucket-list b/s3-bucket-list index acd128e..e6ca077 100755 --- a/s3-bucket-list +++ b/s3-bucket-list @@ -62,6 +62,9 @@ while True: if not body.startswith(b'\n'): raise RuntimeError(f'Invalid body: {body[:200]}...') + if b'' in body[:200] and 'marker' in params: + raise RuntimeError('Marker loop (empty marker in response despite providing one)') + # No risk, no fun! contents = body.split(b'') assert all(content.startswith(b'') for content in contents[1:]) @@ -91,4 +94,6 @@ while True: if not truncated: break + if 'marker' in params and params['marker'] == lastKey: + raise RuntimeError('Marker loop (same last key as previous marker)') params['marker'] = lastKey