viper-framework / viper

Binary analysis and management framework
Other
1.54k stars 353 forks source link

space separated, all lowercase is in reality comma seperated #730

Closed jaegeral closed 5 years ago

jaegeral commented 5 years ago

https://github.com/viper-framework/viper/blob/5cf700761d904d9002a272164735c2ed2b4e0df9/viper/web/viperapi/serializers.py#L289

@frennkie is that a wrong helping text? I played with the API today and:

`data = { "file_name": filename, "tag_list":"tag1 tag2,tag3"

}`

I tried both comma separated and whitespace and only comma separated are respected as different tags.

frennkie commented 5 years ago

I just tired to think how this happend.. I believe I wanted to allow tags with spaces and for that reason switched from space separated to comma separated (and forgot to change the help description).

    # tag_list expects a comma separated list of tags (tags are always all lowercase)
    def validate_tag_list(self, value):
        return [x.lower() for x in value.strip().split(",")]
frennkie commented 5 years ago

So, the way how the CLI works prevents tags with spaces... I just tried that out.

Anyway I would suggest to keep the API field with comma separated. To enforce the "no-spaces" behavior also on the API (and Web) I could add another validation steps... what do you think?

For adding/editing single tags this already is in place: https://github.com/viper-framework/viper/blob/master/viper/web/viperapi/serializers.py#L162

frennkie commented 5 years ago

@deralexxx fixed with 911298decd4d96668f294cc1ab1cdbc3299d93dc please check.

jaegeral commented 5 years ago

cool thank you for the fast response, yes that works