> For the complete documentation index, see [llms.txt](https://www.nl-portal.nl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.nl-portal.nl/next/functionaliteiten/integraties-en-bouwstenen/virusscan.md). Agents can also search and read this documentation through its [MCP server](https://www.nl-portal.nl/~gitbook/mcp).

# Virusscan

Met de Virusscan controleert NL Portal elk document dat een inwoner of ondernemer uploadt op virussen, voordat het in de Documenten API wordt opgeslagen. NL Portal gebruikt hiervoor [ClamAV](https://www.clamav.net/).

## Werking

Bij elke upload in een taakformulier stuurt NL Portal het bestand naar de ClamAV-daemon. Vindt ClamAV een virus, dan wordt het bestand niet opgeslagen en krijgt de gebruiker een foutmelding. Staat de virusscan uit, dan wordt er niet gescand.

De virusscan hoort bij de [Documenten API](https://www.nl-portal.nl/next/functionaliteiten/integraties-en-bouwstenen/documenten-api.md) en werkt alleen als die aan staat.

## Configuratie

| Property                                                 | Env-variabele                                          | Standaard | Beschrijving                             |
| -------------------------------------------------------- | ------------------------------------------------------ | --------- | ---------------------------------------- |
| `nl-portal.config.virusscan.clamav.enabled`              | `NLPORTAL_CONFIG_VIRUSSCAN_CLAMAV_ENABLED`             | `false`   | Zet de virusscan aan.                    |
| `nl-portal.config.virusscan.clamav.properties.host-name` | `NLPORTAL_CONFIG_VIRUSSCAN_CLAMAV_PROPERTIES_HOSTNAME` |           | Hostnaam van de ClamAV-daemon (`clamd`). |
| `nl-portal.config.virusscan.clamav.properties.port`      | `NLPORTAL_CONFIG_VIRUSSCAN_CLAMAV_PROPERTIES_PORT`     | `3310`    | Poort van de ClamAV-daemon.              |

```shell
NLPORTAL_CONFIG_VIRUSSCAN_CLAMAV_ENABLED=true
NLPORTAL_CONFIG_VIRUSSCAN_CLAMAV_PROPERTIES_HOSTNAME=clamav
NLPORTAL_CONFIG_VIRUSSCAN_CLAMAV_PROPERTIES_PORT=3310
```

In te stellen via het [Configuration Panel](https://www.nl-portal.nl/next/configuratie/configuration-panel.md), op de pagina **Virusscan ClamAV**.

De docker-compose omgeving start ClamAV standaard, op poort 3310. Zie [Ontwikkelomgeving](https://www.nl-portal.nl/next/configuratie/aan-de-slag/ontwikkelomgeving.md).

## Voor broncode-ontwikkelaars en maatwerkimplementaties

**Module:** `zgw:documenten-api`. De bean `VirusScanService` bestaat alleen als de virusscan aan staat; de standaardimplementatie is `ClamAVService`. Een eigen virusscanner sluit je aan met een eigen `VirusScanService`-bean.

Het upload-endpoint `POST /api/taak/{taakId}/document/content` geeft bij een virus HTTP 400 terug met het resultaat van de scan (`status` = `VIRUS_FOUND` en `foundViruses`).
