plone.restapi
plone.restapi copied to clipboard
It is possible to create an empty AT content bypassing the validation
Hi @stevepiercy @jensens
we still use version 7.x to create AT content on some applications and we encounter a bug: it is possible to create an empty content without required fields by just giving the "portal_type".
This is because in https://github.com/plone/plone.restapi/blob/7.x.x/src/plone/restapi/deserializer/atcontent.py#L55
In DeserializeFromJson, validation is only done if a field was modified, this is not the case and it fails.
Changing if modified:
by if create or modified:
fix the problem.
I will propose a PR for this.
Thank you,
Gauthier
Thank you for review and merge, I will wait for a release 7.x.x (but it is not urgent) before closing this issue
https://pypi.org/project/plone.restapi/7.8.0/ this version solves the issue