Malware Scanning: When to Release Uploaded Documents

Keep upload acceptance, scan completion, and permission to process separate.

Published

Cream, navy and teal paper-cut illustration titled Malware Scanning Before Processing, showing upload, inspection with matching v2 document and result, and release to processing.

Release an uploaded document for processing only when an acceptable scan result applies to the exact content being processed. Registering an upload, finishing a scan, and authorising the next action are three separate decisions.

Consider a supplier who replaces an insurance certificate while its first scan is still running. A clean result for the earlier file arrives after the replacement. If the application checks only the document ID or a general “scan complete” flag, it can send the unscanned replacement to OCR, AI extraction, or an ERP integration.

Define what the release decision permits

A pending upload can have an identifier, an owner, and a visible status while its bytes remain restricted from ordinary users and processing workers. Keep file intake separate from the business review that will eventually accept or reject its contents.

The OWASP File Upload Cheat Sheet recommends layered file validation, controlled storage and access, and antivirus or sandbox checks where available. A no-known-malware result remains one input to release: format limits, authorisation, and permitted active content still matter. The related safe document preview guide covers conversion and browser isolation after this processing decision.

Illustrative application policy states, not a list of FormKiQ or ClamAV status codes.
Policy stateProcessing decision
Pending or runningShow status and capture trusted intake metadata. Keep content access and downstream processing restricted.
Accepted scan resultAllow only the configured actions on the inspected content version, subject to other access and format checks.
Threat detectedKeep the content restricted. Notify the responsible team and apply the approved investigation, retention, or removal procedure.
Incomplete, unreadable, failed, or overdue scanHold release and assign a retry or exception task. A completed attempt with insufficient inspection does not satisfy the release policy.
Result belongs to earlier content or an expired policyRetain the earlier evidence and obtain the result required for the current bytes and policy before further release.

Bind the scan, decision, and action to one version

Capture an immutable content reference or version plus a checksum when the file enters restricted processing. The scanner and downstream worker must read that captured input. Checking a current document property and then fetching a mutable “latest” file leaves a gap in which the content can change.

  1. 1 · Register

    Identify the bytes

    Record the document, content version or object reference, source, and intake time. Restrict access while inspection is pending.

  2. 2 · Decide

    Assess the result

    Associate the scan outcome with that input. Record whether it meets the required inspection and release policy.

  3. 3 · Process

    Claim permitted work

    Check the release decision and target version, then claim the action durably before starting its side effects.

Match the storage version in the MalwareScanResult to the content being released. Keep that result together with the applicable release policy, decision, and action outcome. Capture scanner-definition versions and inspection limits where available so later review can explain both the inspection and the permitted processing.

Handle repeated, late, and missing results

Treat completion events as prompts to evaluate the current release decision. A late result for version 1 can update version 1’s history; it must not approve version 2. A retry that finishes after a newer accepted scan also needs a rule preventing the older attempt from overwriting the current decision.

For queue-driven workers, account for repeated delivery. AWS documents at-least-once processing for Lambda’s SQS event source mappings. A proposed action key could combine the document, content version, processing step, and release decision. Persist the claim or outcome and make retries resume or reconcile that work; a key included only in the event payload cannot prevent duplicate side effects.

Assign an owner and deadline to scans that remain pending. Monitor queue age, failed attempts, and held files. Reconcile documents awaiting a decision against completed scans so a lost notification does not leave an upload indefinitely stuck or release it through a timeout fallback.

Worked example: an encrypted supplier submission

In this illustrative workflow, a supplier submits a password-protected ZIP for file VEN-1042. The application’s policy requires inspection of the enclosed certificate before OCR. Encrypted-file handling must be configured deliberately: ClamAV’s sample configuration makes encrypted-archive alerts optional and disabled by default. Do not assume every protected archive produces an automatic unreadable-file failure.

  1. 1. Hold the submission

    The intake checks identify a protected archive whose contents have not met the inspection policy. Record a local “inspection required” decision, retain the actual scanner response, and request a supported resubmission through the supplier workflow. Ordinary reviewers and OCR workers remain unable to retrieve it.

  2. 2. Inspect the replacement

    The supplier submits the certificate as a new content version. Capture its identity and scan it independently. The older ZIP’s result stays attached to the older input.

  3. 3. Release the permitted action

    An acceptable result for the replacement permits OCR on that exact version. A repeated completion notification resolves to the recorded processing attempt instead of creating an independent duplicate job.

  4. 4. Continue the business review

    Procurement checks the extracted expiry date and certificate coverage. Passing malware inspection permits the configured processing; acceptance as current supplier evidence remains the business reviewer’s decision.

Agree the exception and rescan policy

Define when changed content, restored versions, updated definitions, or a revised inspection policy require another scan. Record which earlier results remain acceptable and which actions must pause. A replacement resets the decision for its own bytes; a later rescan preserves the earlier history.

If the organisation permits an exception, record the approver, reason, exact content, permitted action, expiry, and compensating controls. Keep that decision distinct from the scanner’s result. Review access to originals, existing download grants, derived files, and queued work when withdrawing a release.

Test the decision with delayed and conflicting events

  • Verify pending and held files remain restricted through previews, direct downloads, search-derived content, and integration routes.
  • Replace content while a scan is running and deliver the earlier result last. Confirm only the matching version can be released.
  • Use approved fixtures for detected threats, protected archives, inspection limits, scanner errors, and unavailable workers.
  • Repeat completion messages and interrupt a worker after a side effect. Confirm recovery reconciles the recorded action.
  • Alert on overdue scans and reconcile held documents with completed results without treating timeouts as approval.
  • Exercise a rescan, a withdrawn release, and an authorised exception; preserve the original result and each later decision.

Make release a recorded decision

A reliable intake workflow can explain which bytes were inspected, what the result allowed, and which action followed. Keep unknown outcomes restricted, bind approval to the inspected input, and make delayed or repeated events resolve against that recorded decision.

      Start with FormKiQ Core

      The open-source foundation — API-first, deployable into your own AWS account, and free to use. Right for architecture validation and early implementation.

      Get Started Free

      Deploy FormKiQ Essentials or Advanced

      Production-ready editions for departments and complex workflows. Start with a Proof-of-Value deployment or go straight to production.

      Explore Options

      Plan an Enterprise Rollout

      For governance-heavy environments with residency, sovereignty, assurance, and multi-jurisdiction requirements. Talk to us about the right deployment model.

      Book a Call