After encountering the same issue, I came across a helpful solution in the form of Alfresco: Mime Type Blocker created by Angel Borroy.
Within Alfresco, all file formats are supported with no built-in restrictions on allowed MIME types. This means that executables, databases, and potentially harmful content can be stored without limitations.
This add-on offers an Alfresco extension to establish a mime type blacklist within alfresco-global.properties and introduces an aspect called Mime Type Restrictable for determining which folders will enforce this restriction.
The process involves defining a blacklist of blocked mime types by configuring a variable in the alfresco-global.properties
file:
## Samples
## STARTS WITH video = video*
## ENDS WITH xml = *xml
## CONTAINS pdf = *pdf*
## EXACTLY ONE = application/octet-stream
## MANY (use pipes) = application/octet-stream|application/zip|video*
mimetypes.restricted.expression=video*
Additionally,
Using the default Alfresco Share folder action 'Manage Aspects', the Mime Type Restrictable aspect can be applied to designated folders as needed.
This allows you to specify where the rule should be enforced.
EDIT 2016-05-27
I also discovered an alternative method based on rules:
To begin, create a simple javascript webscript named block-document.js
designed to throw an exception:
function main()
{
var name = document.name;
var siteName = document.siteShortName;
var parent = document.parent;
throw "Unsupported file format";
}
main();
Then upload it via Alfresco Share into the
Repository>Data Dictionary>Scripts
directory.
https://i.sstatic.net/RKwBM.png
To apply a rule to a folder (and potentially its subfolders), select the desired folder and navigate to the Folder Actions menu to choose Manage Rules.
https://i.sstatic.net/IYRrP.png
You can then create a rule that triggers the previously uploaded script when adding a new document with specific mime type(s) to the folder.
https://i.sstatic.net/CY674.png
This approach offers the advantage of being able to apply the rule to subfolders simply by checking a checkbox option, while applying the aspect to each individual folder was required in the previous method.
Users uploading documents will immediately receive a warning if the file is not successfully added to the repository, regardless of their chosen upload method.