Connect a Scanner
Connecting scanners requires the Edit and delete credentials permission. The workspace Owner and Admins hold it by default.
- Cloudmersive, Scanii, or MetaDefender Cloud: a hosted service you have an account with. Each file’s contents go to that service. Each file it scans uses your quota there, and any member who can edit a knowledge base’s settings can turn scanning on with this scanner. Size your plan for every knowledge base that could use it.
-
Custom Endpoint: your company’s own scanning service. See Custom Endpoint Scanner API for the request and response it must handle.
If your scanning service runs on your company’s internal network, ask your deployment administrator to allow the service’s IP address or hostname in Dify’s SSRF proxy (
ssrfProxy.squidConfin the Helm values). See SSRF Protection for details.
Turn On Scanning for a Knowledge Base
Turning on scanning requires the Edit knowledge base content and settings permission on the knowledge base. The workspace Owner, Admins, and the knowledge base’s creator hold it by default, and Editors hold it on knowledge bases they can access.
Error. To have one scanned right away, delete it and upload the file again.
Choose What Happens to Unscanned Files
For the two cases where a scan can’t give an answer, choose whether to block the file or let it in unscanned:- When the scanner is unavailable: the scanner can’t be reached, times out, returns a server error, or sends an answer Dify can’t read. Dify retries temporary failures before this choice applies.
- When a file cannot be scanned (encrypted or too large): the file is encrypted or password-protected, larger than the scanner accepts, or a type the scanner doesn’t support.
Check That Scanning Works
Download the EICAR test file from eicar.org. It’s a harmless file that every antivirus engine reports as malware. Save it with a.txt extension and upload it to the knowledge base. Its document should show Error, and hovering the icon next to it should show a malware message.
If it’s indexed instead:
- Check that scanning was turned on and saved before you uploaded the file.
- Check the knowledge base’s When the scanner is unavailable choice. With Allow files, the file goes in unscanned when the scanner doesn’t answer. In Integrations > File Security Scan, the workspace Owner or an Admin can click Test on the scanner to see whether it answers.
Handle a Blocked File
In the document list, hover the icon next to a document’sError to read why it was blocked. For these two cases, there’s more to know:
- Malware detected: delete the document. Retrying it, or uploading the same file again, only blocks it again.
- Encrypted, too large, or not supported by the scanner: such files are blocked by default. If you’re fine with them going into the knowledge base unscanned, switch the knowledge base’s When a file cannot be scanned (encrypted or too large) choice to Allow files, then retry. The choice applies to every later file in the knowledge base, so switch it back if you only needed it for this one.