Skip to content

django-lasuite malware detection integration #936

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

lunika
Copy link
Member

@lunika lunika commented May 5, 2025

Purpose

The django lasuite library has a dedicated module managing malware detection.
We have to configure it using django settings and then put the logic we want to apply in a callback.
While the analyse is not made, we set a temporary status to the file metadata and this status is check in the media-auth endpoint to determine is the s3 signature should be return or not.
If a file is glas as unsafe, it is deleted.

Proposal

  • ✨(backend) force loading celery shared task in libraries
  • ✨(backend) configure lasuite.malware_detection module
  • ✨(backend) manage uploaded file status and call to malware detection

@lunika lunika self-assigned this May 5, 2025
@lunika lunika marked this pull request as draft May 5, 2025 12:50
@securitykernel
Copy link
Collaborator

IMHO the best way to add malware scanning would be to implement an ICAP client that forwards files to an ICAP server that the admin can configure. This is the way most services, e.g., Nextcloud, do it.

@lunika
Copy link
Member Author

lunika commented May 6, 2025

This part of the library can have many implementation. Maybe it is possible to add an ICAP backend alongside the other ones ?

Library we are using can have celery shared task. We have to make some
modification to load them earlier when the celery app is configure and
when the impress app is loaded.
lunika added 2 commits May 6, 2025 18:58
We want to use the malware_detection module from lasuite library. We add
a new setting MALWARE_DETECTION to configure the backend we want to use.
The callback is also added. It removes the file if it is not safe or
change it's status in the metadata to set it as ready.
In the attachment_upload method, the status in the file metadata to
processing and the malware_detection backend is called. We check in the
media_auth if the status is ready in order to accept the request.
@lunika lunika marked this pull request as ready for review May 6, 2025 17:00
@lunika lunika requested review from sampaccoud and qbey May 6, 2025 17:00
@lunika lunika removed the wip label May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants