You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a table/network in Multinet, we don't currently check the supplied names for their validity against Arango's naming conventions. Due to this, it's currently possible to supply an invalid name, and cause a 500 error to occur when collection/graph creation is attempted.
We should instead enforce a regex constraint on these names. One way to do this would be at the serializer level, creating a custom RegexField for table and network names. Another is to create a RegexValidator, which can be attached to the name field on tables and networks. That would require calling full_clean before saving each object though, and might not lead to a great API surface, but would enforce these constraints before saving to the database. Perhaps both could be used.
The text was updated successfully, but these errors were encountered:
Why not enforce this at creation time instead of serialization (I may not be understanding the problem properly).
In either case, creation with an invalid name can be done with the model directly, as calling model.full_cleanbefore calling model.save is required to trigger the validation. When done at the serializer level, the serializer will prevent creation (because the request will immediately return), as well as provide a useful error message from the API. If validation is only done on the model itself, we wouldn't have a good error message to show the user.
I think in either case we should do validation in the serializer. However I'm not sure if it's worthwhile to also do this check upon model creation, as that would provide marginally better protection against this, but will probably also increase the complexity of creating a table/network.
When creating a table/network in Multinet, we don't currently check the supplied names for their validity against Arango's naming conventions. Due to this, it's currently possible to supply an invalid name, and cause a 500 error to occur when collection/graph creation is attempted.
We should instead enforce a regex constraint on these names. One way to do this would be at the serializer level, creating a custom
RegexField
for table and network names. Another is to create aRegexValidator
, which can be attached to thename
field on tables and networks. That would require callingfull_clean
before saving each object though, and might not lead to a great API surface, but would enforce these constraints before saving to the database. Perhaps both could be used.The text was updated successfully, but these errors were encountered: