Skip to content

Guidance to install a custom validation plugin in DSA (Girder) to enforce allowed file extensions & MIME types #432

Open

Description

@mayur-bhawar

We have a custom Python Girder plugin that validates uploaded files. It checks the file extension and MIME type, and if they are not in an allowed list, it deletes the uploaded file.

We need guidance on how to package, install, and enable this plugin inside DSA (Girder). Documentation or step-by-step instructions (especially for the Docker-based DSA setup) would be very helpful.

Activity

  1. manthey commented on Jul 25, 2025

    @manthey
    Contributor

    Have you looked at how https://github.com/DigitalSlideArchive/girder-clamav does this? In that plugin, at the data.process event, a file is checked via malware scanner. Your case is probably simpler, as you aren't reading the file's contents (so you don't need communication with an external service). Further, you could hook the model.upload.finalize event (see https://girder.readthedocs.io/en/latest/plugin-development.html#the-events-system) instead, as that way the file can be rejected even sooner.

    To add to the docker DSA, see https://github.com/DigitalSlideArchive/digital_slide_archive/blob/master/devops/with-dive-volview/provision.divevolview.yaml#L6 for an example of adding adding additional python plugins.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions