IntelOwl icon indicating copy to clipboard operation
IntelOwl copied to clipboard

Allow editing plugin `params` from the GUI

Open mlodic opened this issue 4 years ago • 12 comments

At the moment, the API keys can be inserted only before starting the project, as environment variables.

It would be useful to let the user set up those keys and the other required configuration directly from the GUI.

This would imply a lot of changes. Also, we have already planned to work on the configuration (#306) so this idea could be considered as a later development

mlodic avatar Apr 27 '21 10:04 mlodic

After much deliberation/pain, we dropped the idea of storing the analyzer_config,json in the database.

~Now we need another way to handle this. Ideally, a robust way to publish edits/writes directly to the JSON file.~

eshaan7 avatar Jun 17 '21 13:06 eshaan7

Why was the idea of storing analyzer_config.json in the database dropped? What exactly kept going wrong? it seems like a feasible thing to do in theory.

0x0elliot avatar Feb 03 '22 13:02 0x0elliot

The discussion was complex and I think it is forgotten between PRs and slack....this is what I remember right now, but maybe @eshaan7 has something else to say about:

The analyzer_config.json can change over time. This is normal and can happen several times. If we preload this to the database, then, with a new official version of that JSON, we would need to add a way to align the already existing databases for the ones who already have a working IntelOwl instance. But that adds another issue: if the user of that DB has made personal changes, and that is normal, we won't be able to overwrite the database with the new configuration by default. This problem is also available right now if you locally change the analyzer_config.json and add your own analyzers / modify the existing ones. Anyway, imho, this is more managable cause you just need to change a single file and don't mess with the DB.

API keys have not this problem so, for this case, it makes sense to store them into the database and have them managable from the GUI. It would be great to have a "marketplace" where it would be possible to check the analyzers/connectors configuration and insert the keys directly there. This would be super useful.

Then, I also think that the analyzer_config.json file has become too much big and we should start to think to handle this differently (by moving all that JSON code to python. This could be another refactor issue)

mlodic avatar Feb 21 '22 11:02 mlodic

With a JSON file, I feel like it's pretty flexible for development and on-the-go changes, but as the project grows the JSON is going to get highly populated. I think moving to a python based config seems suitable. This can be introduced with a major version change like dev-v4 GUI.

Another thing that came to my mind while reading the issue was that we could also make use of a quick converter, a startup script that converts JSON to a DB / config file to maintain backward compatibility.

CypherpunkSamurai avatar Mar 16 '22 14:03 CypherpunkSamurai

a startup script that converts JSON to a DB / config file

This was actually one of the original ideas - load the JSON into DB as django models and allow read/writes to these models from the django admin and a DRF view for the GUI.

Only issue is this should be accomplished while keeping the JSON file still as the single source of truth while storing the user modified changes in the DB. This means user should not need to touch anymore the JSON files and only use the django admin / React GUI to update the configurations.

eshaan7 avatar Mar 22 '22 15:03 eshaan7

Hopefully I should find sometime during the weekend/next week where I can implement a MVP of this idea.

eshaan7 avatar Mar 22 '22 15:03 eshaan7

So, initially we convert the JSON configuration to a DB, then allow changes to the DB from the GUI, instead of editing JSON everytime. Sounds neat, that way the JSON can function like a skeleton config for the DB.

With due respect Sirs, I'm somewhat interested in the issue and was thinking if allowed, I would like to work on this for GSOC. I haven't yet thought of a proposal yet, so I would really appreciate both of yours suggestions on this :)

CypherpunkSamurai avatar Mar 26 '22 17:03 CypherpunkSamurai

Hello Mr. @eshaan7 and Mr. @mlodic I feel interested in working on this issue for GSoC 2022. Can I please takeover this issue for the proposal?

CypherpunkSamurai avatar Apr 04 '22 17:04 CypherpunkSamurai

yes, you can

mlodic avatar Apr 04 '22 17:04 mlodic

Rough explanation of a solution I had in mind:

We could replace the dataclasses with django models like so:

class Plugin(models.Model): # applies to both Analyzer and Connector
  name = models.CharField(primary_key=True) 
  params = models.JsonField()

This way we can allow users to store their own versions of config dict against a plugin name. Rest of the fields maybe do not need to duplicated in the DB and can be mapped (mapped and read from the config serializers) using @property decorators.

eshaan7 avatar Apr 10 '22 12:04 eshaan7

Thank you very much for the heads up Eshan Sir. I'm currently going through the Django sources thoroughly while also learning more about Django. I'll try my best to present a draft soon, before the proposal is ready if possible :)

CypherpunkSamurai avatar Apr 11 '22 18:04 CypherpunkSamurai

This issue was tracking 2 different feature requests together which was creating confusion so I splitted it into 2 issues as these can be independently worked upon:

  • #433
  • #978

eshaan7 avatar Apr 14 '22 11:04 eshaan7

closed with #1238

mlodic avatar Oct 12 '22 09:10 mlodic