Brewless Brewless Docs

Running your application

Malware Protection

ClamAV scans every file in the Object Storage buckets of your Scaleway account, inside that account. One switch, every bucket, no file through Brewless.

On this page

Malware Protection scans the files in the Object Storage buckets of your Scaleway account with ClamAV, the open source antivirus engine. It runs as Serverless Jobs in your own Scaleway account: your files are read there, scanned there and never pass through Brewless. Scaleway bills you directly for the few seconds the jobs run.

It is the European alternative to AWS GuardDuty Malware Protection for S3, on every plan, the free one included.

Getting started

  1. Connect a Scaleway project on the Providers page, if you have not yet.
  2. Open Providers → Malware Protection and choose Switch on. The dialog lists what Brewless makes in your account, the rights the scanner gets and an estimate of what it costs.
  3. Wait for the operation to finish. From then on, every bucket the scanner can reach is protected, existing and future, until you exclude one.

New files are found within about two scan intervals (by default about 5 to 10 minutes) and get a tag with the result. The scanner can also look every hour or every four hours: that costs fewer runs, and a new file then waits up to that long for its scan; what does not fit in one run waits for the next. For a verdict at the moment of upload, use the realtime scanner. You get a mail when something is found.

Note

Switching on does not scan the files that are already in your buckets. Start a full scan of one bucket, or of all of them, from the console when you want that: the console shows how many files and what it will roughly cost before it starts.

One protection for the whole account

Malware Protection belongs to your Scaleway organisation, not to one application. One protection covers every project the connected key can reach, and every bucket in them, whichever application or tool made them. A customer with ten applications and forty buckets has one scanner.

The private bucket and the jobs live in the project of the connection that manages the protection, one set per region that has buckets: Paris, Amsterdam or Warsaw. Scaleway has no Serverless Jobs in Milan yet, so buckets in Milan are scanned by the jobs in Paris; Scaleway bills the traffic between the two regions.

How new files are found

Scaleway Object Storage does not send events when an object is written. It does log every request it serves to Cockpit, Scaleway's observability service, for free. Brewless uses both of the following, so nothing depends on your application:

  • The watcher runs every few minutes (1 to 60, default 5). It reads the new PutObject, CopyObject, PostObject and CompleteMultipartUpload lines since its last run, queues the objects they name and starts a scan only when something is waiting. Uploads from any client count: your Laravel application, another application, the AWS CLI, a presigned URL.
  • The reconciler runs every few hours (1 to 24, default 6). It lists every protected bucket and compares it with what was scanned, and queues what is new, what changed and what the logs missed. It also notices new and removed buckets.

S3 requests are not billed by Scaleway, so listing a bucket costs time, not money.

Note

How quickly a request reaches Cockpit is not documented by Scaleway; in our measurements it was within a minute or two. The reconciler is what makes the protection complete: a file the logs missed is found at the latest at its next run.

The result of a scan

The scanner writes three tags on the object it scanned, and keeps the tags you set yourself:

Tag Value
brewless-av clean, infected, unsupported or failed
brewless-av-etag The ETag of the version that was scanned
brewless-av-at When, in UTC

Trust the result only when brewless-av-etag equals the object's current ETag. An overwritten object is a new object without these tags, so it never inherits clean from what was there before. An object that already has ten tags has no room: its result is kept only in the scanner's own register.

Status Means
clean ClamAV found nothing
infected ClamAV found malware; the signature is in the console and in the mail
unsupported The file could not be scanned in full: larger than 2 GiB (ClamAV's limit), an encrypted archive, or an archive that unpacks to more than the scan limits. Treat it as unknown, not as clean.
failed The scan went wrong three times, with 1, 4 and 16 minutes between the tries
quarantined Infected, and moved to quarantine

Buckets: protected, excluded or in protection mode

Every bucket the scanner finds is protected in detection mode, unless you change it in the bucket table:

  • Protected (detection mode): files are scanned, tagged and reported. Nothing is moved or deleted.
  • Excluded: the bucket is not scanned. Exclude buckets with backups, build artifacts or public assets you trust.
  • Protection mode: see below.

The table also shows buckets that are not scanned now: no access (the scanner's key may not read them), a region without jobs yet, definitions that are too old, or the daily limit reached. A bucket is never shown as protected when it is not.

Protection mode: release only what is clean

Detection tells you about an infected file after it was uploaded. To make sure no one ever downloads an unscanned file, use protection mode on a bucket:

  1. Your application uploads to a staging folder, incoming/ by default.
  2. A clean file is copied to its real place, without the folder, and the upload in the folder is removed.
  3. An infected file goes to quarantine. A file that cannot be scanned in full, or whose scan failed, stays in the folder: it is never released.

Your application only reads files outside the folder. Brewless does not enforce that with a bucket policy: Scaleway's bucket policies cannot deny reads by a tag, and a policy written by Brewless would replace yours. With the Laravel integration, Antivirus::disk('s3')->stagingPath($path) gives the upload path and release($path) says whether the clean copy is in place.

Quarantine and deleting

Both are off by default: an infected file is tagged and reported, and stays where it is.

  • Move infected files to quarantine moves them to the private bucket of the protection, under quarantine/, where they are kept for a number of days (1 to 365, default 30) and then removed by a lifecycle rule.
  • Delete infected files deletes them.

Either one changes your buckets, so the console asks you to confirm.

Scanning what is already there

From the bucket table you can scan one bucket in full, every bucket, or the files whose scan failed. The console counts the files first and shows the estimated scan time and cost before you confirm. A full scan queues the files; the scanner works through them in batches within the daily limit.

Realtime scanning

For an application that needs a result before it answers, switch on the realtime scanner in the settings. Brewless makes a private Serverless Container in your account that runs ClamAV with an HTTP interface:

  • POST /scan with the file as the body, or with JSON naming an object ({"bucket", "key", "project"}), answers {"status", "signature", "clamav", "definitions", "ms"}.
  • GET /health answers once ClamAV is ready.

The container is private: a call needs a Scaleway IAM key with ContainersPrivateAccess in the X-Auth-Token header. It scales to zero when it is not used; the first call after a quiet spell waits while ClamAV loads its definitions, about 20 seconds. The batch scanner stays on next to it.

Laravel integration

None of this needs a package in your application. With brewless/laravel 1.12 or later, an application can also read and request scans itself:

use Brewless\Laravel\Facades\Antivirus;

$result = Antivirus::disk('s3')->status('avatars/1.png');

$result->isClean();     // the tag matches this exact version
$result->isInfected();
$result->isPending();   // not scanned yet, or overwritten since

Antivirus::disk('s3')->requestScan('avatars/1.png');            // queue it now
$result = Antivirus::disk('s3')->wait('avatars/1.png', 60);     // poll until there is a result

status() reads the object's tags and ETag through your own disk and costs no request to Brewless. requestScan() asks Brewless, signed with the environment's BREWLESS_MALWARE_KEY, which Brewless sets on environments of organisations with Malware Protection on. Brewless also hands findings in an environment's own buckets to its application, which turns them into the MalwareDetected and FileScanned events. In tests, Antivirus::fake() replaces it all.

What Brewless makes in your account

Resource What for
IAM application brewless-malware-… with one policy and one key The scanner's own identity
Secrets in Secret Manager That key and the secret the scanner signs its reports with
A private, versioned bucket per region, brewless-malware-<project>-<region> Signatures, the queue, the register, the status and the quarantine. It is never scanned itself.
Four Serverless Jobs per region watch, scan, update and reconcile
A private Serverless Container Only with the realtime scanner on

Switching Malware Protection off removes exactly what Brewless recorded making, and nothing else: never one of your buckets or files. A private bucket that still holds files in quarantine is kept, unless you also tick that it may go.

Permissions

The scanner's IAM policy gives, in every project it covers:

  • ObjectStorageBucketsRead, to find buckets;
  • ObjectStorageObjectsRead, to read the files it scans;
  • ObjectStorageObjectsWrite, to write its tags and, in protection mode, the released copy;
  • ObservabilityReadOnly, to read the request logs in Cockpit;
  • ObjectStorageObjectsDelete, only where quarantine, deleting or protection mode asks it to remove an object.

In the project of the private buckets also ServerlessJobsFullAccess (the watcher starts the scan), SecretManagerSecretAccess (its own key) and ObjectStorageObjectsDelete (its own queue), plus ContainersPrivateAccess with the realtime scanner on. The key you connected to Brewless needs nothing beyond the permissions Brewless already asks for.

Costs

Scaleway bills Serverless Jobs per second of CPU and memory: €0.000014 per vCPU-second (from 1 January 2027; €0.00001 before) and €0.000002 per GB-second, with a free allowance of 200,000 vCPU-seconds and 400,000 GB-seconds a month per account.

  • Watching, updating and reconciling cost cents a month per region, whether or not files arrive. The console shows the estimate for your settings.
  • Scanning happens only when a file waits. Loading the definitions takes about 20 seconds per run, after which ClamAV scans hundreds of small files in seconds, so files are scanned in batches: at most one run per interval, however many files arrive.
  • The daily limit (default 14,400 seconds of scanning) caps what scans cost. Once it is used, new files wait until midnight, Amsterdam time, and you get a mail.
Uploads per day Scan runs per day Scanning per month, at list prices
0 0 €0
10 about 10 about €0.15
100 up to about 85 about €1.40
1,000 up to 288 about €4.50
10,000 288 about €5, plus the time the files take

These are estimates for small files at the default scan size (1.12 vCPU, 4 GB), before the free allowance. Large files add the time they take to scan.

Security and privacy

  • Files are read and scanned in your own account and never sent to Brewless or anywhere else.
  • The scanner keeps a file on its own disk only while it scans it; nothing is written to its logs but keys, sizes and results.
  • Reports to Brewless are signed and hold the bucket, the key, the size, the ETag and the signature name of what was found, never the contents.
  • Brewless keeps findings for 90 days, because a key can be personal data, such as a name in a filename.
  • ClamAV is used for malware detection only: no content moderation and no other analysis.
  • The signatures come from ClamAV's official mirrors through freshclam, every four hours.

Technical limits

  • Detection takes about two scan intervals, and depends on Cockpit logs whose delay Scaleway does not promise. The reconciler makes up for what they miss.
  • ClamAV scans files up to 2 GiB; larger files are unsupported.
  • Encrypted archives cannot be opened, so they are unsupported.
  • Protection mode works through a staging folder; Brewless cannot block reads of an object by its tag.
  • Buckets in Milan are scanned from Paris until Scaleway offers Serverless Jobs there.
  • One key reaches one project at a time; the scanner gets a policy for every project the connection can see. A project added later is covered the next time you save the settings, which rewrites the policy.

Troubleshooting

You see What to do
A bucket with No access The scanner's policy does not cover its project. Change a setting and save, which rewrites the policy, or check that the connected key can reach that project.
Definitions are too old The update job could not reach ClamAV's mirrors. Scanning stops rather than scan with old signatures; it resumes after the next successful update.
Daily limit reached Raise the daily scan limit in the settings, or wait for midnight.
No figures, or a mail that the scanner does not report Look at the job runs of brewless-malware-… in the Scaleway console, under Serverless Jobs.
A file stays pending It waits for the next scan, or the daily limit is reached. failed after three tries is shown in the console; scan the failed ones again from there.

Compared with AWS GuardDuty Malware Protection for S3

Brewless Malware Protection GuardDuty Malware Protection for S3
Where it runs Your own Scaleway account, in the EU AWS
Engine ClamAV, open source Amazon's own engines
Which buckets Every bucket of the account, new ones included, minus the ones you exclude The buckets you enable it on
How a file is found Request logs in Cockpit plus a regular reconciliation S3 events
Speed Minutes Seconds
Result Object tags, register, mail Object tags, EventBridge events
Blocking unscanned files Staging folder (protection mode) Bucket policy on the tag
Cost Scaleway's per-second job prices; cents to a few euros a month Per GB scanned and per object evaluated