recon-ng icon indicating copy to clipboard operation
recon-ng copied to clipboard

Input Validation

Open cam-barts opened this issue 6 years ago • 4 comments

Description In order to aid with he future testing story, we should have some user input validation. For example, if a table expects a name and an email address, we should check if the user actually gives a name and an properly formatted email address.

Feature Details

  • [ ] The framework should support built in validators.
  • [ ] It should also allow the developer to create custom validators.
  • [ ] The framework should enforce the validator, displaying validation errors.
  • [ ] This behavior should also have the ability to be overwritten somehow.

cam-barts avatar Oct 29 '19 13:10 cam-barts

So, an idea. Do transform level validation automatically at the framework level based on the expected incoming data. Module devs then have the ability to override this method with their own validation logic if needed.

lanmaster53 avatar Oct 30 '19 14:10 lanmaster53

Idea continued. Build a validation method in the module.py module that detects the input item's type based on module path and calls the associated validator. That way, in one-off situations, a mod dev can just just override that method.

We will need logic to determine if a module actually transforms something and disable the validator otherwise. There are reporting, import, etc. modules that don’t apply. Looking for a "-" in the second segment of the path may be enough.

lanmaster53 avatar Oct 30 '19 16:10 lanmaster53

Well crud, that won't work. Input can be anything within a given table. The above idea only determines the table. We're going to have to use some sort of metadata key to tell the framework which validator to use, or a custom one.

lanmaster53 avatar Oct 30 '19 17:10 lanmaster53

We can build validators that validate whole rows before they go in. Like validate every column in a contact as either valid or empty, except notes. Using a series of underlying single item validators. Could be good for user defined seed material too.

cam-barts avatar Oct 30 '19 18:10 cam-barts