-
-
Notifications
You must be signed in to change notification settings - Fork 645
Closed
Labels
Description
When the only parameter is an empty list/set, it causes all the fields to be de/serialized like None. The implementation of 2.x and 3.0 are not in compliance with their respective docs.
only (tuple) – A list or tuple of fields to serialize. If None, all fields will be serialized.
class TestSchema(Schema):
foo = fields.Field()
sch = TestSchema(only=())
data = dict(foo='bar')
result = sch.dump(data)
assert 'foo' not in result
# assert 'foo' not in {'foo': 'bar'}This could create a security vulnerability if an application was dynamically generating the field set based on security role. A filter that was meant to hide everything would inadvertently show everything.
lafrech, sloria and justanr