Skip to content

Spike - DRS API: support anti-virus scanning of documents submitted by public  #28420

Closed

Description

@mbertucci

Enhance the DRS API to check that files submitted by the public are safe / virus free. Two options have been identified: leverage the existing STRR ClamAV anti-virus service, or implement a new PDF converter service.

As backround for the PDF converter, a note from Thor:
What we proposed was using the same type of setup shown in the google example, but using something like https://dangerzone.rocks/ that will just convert everything to a PDF.

Option 1: Use ClamAV

  1. From 26364, leverage the existing GCP ClamAV scanning service https://github.com/GoogleCloudPlatform/docker-clamav-malware-scanner?tab=readme-ov-file.
    • Upload a new file to a known GCP unscanned storage bucket.
    • Sometime later download a clean file from a different, known clean file storage bucket (same file name).
  2. Create a new AV Scan API as a wrapper to the GCP ClamAV service.
    • Decouple the AV scanning implementation.
    • Scan a file as a synchronous call.
    • Return a distinct status code for infected files (422)
  3. Integrate the DRS API with the new AV Scan API
    • Create a new endpoint for receiving files submitted by the public. Always scan these files before storing.
    • Add a request parameter to existing endpoints that receive files to include an AV scan.
    • Scan the file using the new AV Scan API.
    • Do not scan files that are generated by registries (application reports and documents created by the Registries desktop scanning application).

Clean file sequence diagram:
DRS-scan-file-clean-sequence.png

Infected file sequence diagram:
DRS-scan-file-infected-sequence.png

Option 2: Use a PDF Converter Service

  1. Create a new PDF Converter API
    • Use a similar approach to the https://dangerzone.rocks/about/ solution to produce safe pdfs.
    • Convert the submitted file to a PDF format using the Gotenberg report service LibreOffice convert endpoint.
    • With a PDF editing library render the report service PDF as pixel data, page by page, to produce the final, clean PDF.
  2. Integrate the DRS API with the new PDF Converter API
    • Create a new endpoint for receiving files submitted by the public. Always check these files before storing.
    • Add a request parameter to existing endpoints that receive files to include a public file check parameter.
    • Create a safe file using the new PDF Converter API.
    • Do not check files that are generated by registries (application reports and documents created by the Registries desktop scanning application).

Convert sequence diagram:
DRS-convert-safe-sequence.png

Recommendation: implement option 2

Activity

  1. self-assigned this
    on May 19, 2025
  2. mbertucci commented on May 27, 2025

    @mbertucci
    ContributorAuthor
  3. mbertucci commented on May 30, 2025

    @mbertucci
    ContributorAuthor

    @sal-hamood @thorwolpert Here is the spike ticket. I am in the process of working with @oanyahuru to flush out the user story, requirements, etc.. the DRAFT story is in the epic https://app.zenhub.com/workspaces/assets-team-space-new-655515cb02e714000e74f9f3/issues/gh/bcgov/entity/28690

    @forgeuxGH5 fyi

  4. added
    connect
    on May 30, 2025
  5. added theissue type on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Assetsconnect

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions