Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #390: Split send_analysis_request into analyze_file and analyze_observable #551

Merged
merged 13 commits into from
Jul 21, 2021

Conversation

m0mosenpai
Copy link
Member

@m0mosenpai m0mosenpai commented Jul 19, 2021

Description

  • New views for endpoints
  • New Serializers
  • Testing and Refactoring

Related issues

Fixes #390

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist

  • I have added tests in the Tests folder.
  • The tests gave 0 errors.
  • Black gave 0 errors.
  • Flake gave 0 errors.

@m0mosenpai m0mosenpai self-assigned this Jul 19, 2021
@m0mosenpai
Copy link
Member Author

m0mosenpai commented Jul 19, 2021

#547 (comment)

@eshaan7
Regarding this, It requires passing the function the file and file_name arguments. I'm not sure how i can access those values here. file_mimetype = serializers.HiddenField(default=calculate_mimetype(file_buffer, file_name))

Last case, we could also leave it the way it was since there isn't really a validation going on in this field. Just calculation. The actual filtering occurs in the filter_analyzers()

@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 19, 2021
@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 19, 2021
tests/test_api.py Outdated Show resolved Hide resolved
@eshaan7
Copy link
Member

eshaan7 commented Jul 19, 2021

I am not sure but I think it should be possible to do like:

file_mimetype = serializers.HiddenField(default=lambda attrs: calculate_mimetype(attrs["file"], attrs["file_name"]))

api_app/api.py Outdated Show resolved Hide resolved
@m0mosenpai
Copy link
Member Author

m0mosenpai commented Jul 19, 2021

I am not sure but I think it should be possible to do like:

file_mimetype = serializers.HiddenField(default=lambda attrs: calculate_mimetype(attrs["file"], attrs["file_name"]))

@eshaan7
I don't think this works. It says it's missing a positional argument attrs. I tried looking it up online as well but didn't find examples where they had called a function with positional arguments in HiddenField

@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 19, 2021
api_app/serializers.py Outdated Show resolved Hide resolved
@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 19, 2021
@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 19, 2021
@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 19, 2021
@eshaan7
Copy link
Member

eshaan7 commented Jul 19, 2021

Looks good to me. Can you run only the relevant tests on your local to test and post the screenshot here ? (inconvenience caused since the testing suite is broken for develop-2 branch)

@m0mosenpai
Copy link
Member Author

API Tests:
image

GUI:
Observable:
image

FIle:
image

api_app/serializers.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Jul 20, 2021

This pull request introduces 1 alert when merging bb9da49 into 82a390f - view on LGTM.com

new alerts:

  • 1 for Information exposure through an exception

@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 20, 2021
@intelowlproject intelowlproject deleted a comment from lgtm-com bot Jul 20, 2021
@lgtm-com
Copy link

lgtm-com bot commented Jul 21, 2021

This pull request introduces 1 alert when merging 40ba84f into 82a390f - view on LGTM.com

new alerts:

  • 1 for Information exposure through an exception

federicofantini pushed a commit that referenced this pull request Aug 20, 2024
added changelog and bump 6.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Divide /send_analysis_request endpoint into /analyse_observable and /analyse_file
2 participants