I have an angular app pulling data from strapi; pretty much a blog.
Strapi is excellent for providing anonymous access to data.
But another part of a website is collecting information from anonymous users. The canonical example would be comments, but in general - any organization might have their information that they’re interested in.
I could just expose a model and allow it to be created by public without any limitation, but that’s asking for trouble.
I could add a rate limit, but that doesn’t stop a million bots on different ips submitting a single spam each.
So I’m adding a custom recaptcha controller, which will take some JSON properties in the body:
The recaptcha code
The model to create
The data to put in the model
Which is great, but there’s a lot of manual work, checking the recaptcha, creating the data from the post ensuring that it matches the model schema, validating the model…
Ideally, I would mark a data type as “able to be created by anyone with recaptcha”, set my recaptcha key, and not have to do anything else server side.
And the client would post with an additional property called recaptcha_code, in addition to the model.
Alternatively, there could be a service to simplify the custom controller - something like query.create, where you pass in the recaptcha code, model name, and data (name/value or JSON, where names/keys must match schema), and it would return an error if recaptcha or schema validation fails.
Alternatively, there could be a new role called “Passed recaptcha”, and I can specify what additional things a person can do if they pass recaptcha. (similarly how now you can specify what a public user can do).
Really, it should be something somewhat generalized, so a person could use any sort of captcha or honeypot.
Thoughts?
Is this something that others have thought have? Find useful?
Should this be a plugin?