You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Guidance to install a custom validation plugin in DSA (Girder) to enforce allowed file extensions & MIME types #432
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
manthey commentedon Jul 25, 2025
Have you looked at how https://github.com/DigitalSlideArchive/girder-clamav does this? In that plugin, at the
data.processevent, 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 themodel.upload.finalizeevent (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.