Skip to content

[FEATURE] Integrate Magika for Attachment Validation in Raven MDA #270

Description

@Aravinda-HWK

Summary

Integrate Magika into the Raven MDA pipeline to validate the actual file type of email attachments before storing them in SeaweedFS.

Why is this feature needed?

Currently, attachment validation relies mainly on file extensions or MIME types, which can be spoofed. This creates a security risk where malicious files can bypass detection by disguising themselves as safe file types.

By integrating Magika, we can:

  • Accurately detect the real content type of attachments
  • Identify mismatches between file content and extension
  • Prevent malicious or disguised files from being stored
  • Improve overall security of the Silver email system

Alternatives Considered

  • Using traditional file type detection tools (e.g., file command, MIME-based validation)
    • Less accurate, especially for edge cases and obfuscated files
  • Relying solely on antivirus scanning
    • Detects known threats but may miss disguised or unknown file types
  • Custom signature-based validation
    • Requires continuous maintenance and is less scalable

Magika provides a more accurate and scalable AI-based approach compared to the above options.

Additional Context

  • Magika is an AI-powered file type detection tool with high accuracy (~99%)
  • It can quickly analyze files and determine their true type regardless of extension
  • Integration point: before persisting attachments into SeaweedFS
  • Future enhancements could include:
    • Routing files to different scanning pipelines based on the detected type
    • Blocking or quarantining suspicious files

Reference: https://github.com/google/magika

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Security UpdateThis label should be added to the tasks that is needed to update the security.enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions