Skip to content

GrydFiles Module ​

GrydFiles is the platform's record of a file: who uploaded it, the hash the server computed, what the antivirus said, who still points at it and when it may die. The bytes travel between the client and the bucket by presigned URL and never through the API.

The decisions behind it are in ADR 0010; fields, routes, error codes and invariants are in the specification (v1.13). These pages are about using and running the module. Coming from v9 or v10.0: Migrating to v10.1.

The gap it closes ​

The framework could already talk to S3, Azure Blob Storage and Google Cloud Storage and issue presigned URLs. What no module had was the record around the bytes. GrydReports kept the output of a report as a URI in a string; GrydNotifications kept each e-mail attachment as byte[] in a column. Neither had a hash, an antivirus verdict, a retention rule or an answer to "does anybody still need this?" — and without that answer nothing can ever be purged safely. Both now store their files here.

✨ Features ​

FeatureDescription
🚚 Two-phase uploadReserve (POST /files), PUT straight to the bucket, confirm (POST /files/{id}/complete)
🦠 Quarantine before referencePending → Scanning → Available; nothing is referenceable without a verdict, and there is no manual release
🔑 Server-side identitysha256 computed on the one read that also feeds the type detector and the engine
🧪 Content-type checkBy content signature, OOXML package or text validation — never by extension; unconditional, even with the antivirus waived
📄 One record, one objectEvery upload is its own record and its own object; what is reused is the record, by reference — never content across tenants
🔗 Reference registryConsumers register what they hold (ownerScope + ownerKey); the count is what purges read
⏳ Declared retentionUntilReleased, RetainUntil or Permanent, from the upload or the profile; dates only move forward; legal hold
🪦 Purge with a tombstoneThe object dies, the record keeps hash, size, type, profile, scan result and location
📥 Short download URLsattachment + application/octet-stream, a few minutes of validity, a line in the audit trail per URL
🩺 Scanner healthGET /files/scanner-status, a health check and three alerts: queue, signature age and an engine that misses the EICAR sample
🏢 Multi-tenantTenant at the root of every key; another tenant's file is answered exactly as a missing one
🧩 In-process consumersModules in the same host register their scope and use the ports bound to it — IFileStore<TScope> and IServerFileStore<TScope> — with no HTTP and no scope argument
📬 Verdict deliveryThe result of the scan reaches the owner after the commit, at least once, through an IFileOutcomeHandler per scope
🔒 Legal hold per holderThe platform and each consumer hold and lift their own; legalHold is derived
⚖️ ErasureThe data subject's request is the one act that passes the retention floor, with its authors, dual custody and a durable trail
🔁 Re-scanPOST /files/{id}/rescan for Failed and for released files, and a job that reads the archive again after a signature update
🧾 Trail in the transactionThe audit line is written with the act and delivered after the commit through the module's outbox

📦 Packages ​

📦 GrydFiles
├── GrydFiles.Core                    # StoredFile, FileReference, FileScanAttempt, FileLegalHold, error codes, options
├── GrydFiles.Application             # consumer ports (IFileStore<TScope>, IServerFileStore<TScope>), use cases, profiles, IFileScanner
├── GrydFiles.Infrastructure          # EF Core (PostgreSQL), the scan job and the six recurring jobs, the outbox
├── GrydFiles.API                     # FilesController — the eleven routes
├── GrydFiles.Infrastructure.ClamAv   # The clamd adapter and the generated clamd.conf
└── GrydFiles (meta-package)          # Core + Application + Infrastructure + API
Depends onWhy
Gryd.Infrastructure object storage (AddGrydObjectStorage)The bucket, the provider and the presigned URLs
GrydJobsThe scan queue and the recurring jobs
An IAuditStoreDownload URLs, quarantines, purges and legal holds are written to the trail; erasure and lifting a hold need a durable one
The Core outbox (AddOutboxMessaging + AddOutboxWorker)The trail and the verdicts are written with the act and delivered after the commit
PostgreSQLThe module's own schema; the jobs lock records with FOR UPDATE SKIP LOCKED

🔄 The life of a file ​

Infected is terminal: no permission, platform permissions included, brings a file back from it. Failed never releases anything either; it waits for another pass — automatic, or the operator's POST /files/{id}/rescan. Available is not eternal either: a signature the base learns later takes a released file to Infected.

🚀 Where to go next ​

PageWhat it covers
Getting StartedRegistration, migrations and the minimal flow
ConfigurationThe GrydFiles section, profiles and the scanner limits
API ReferenceThe eleven routes, the error contract and the permissions
Antivirus & QuarantineRunning clamd, the retry budget and the two alerts
DownloadURL validity, the two headers and the trail
Retention & PurgeHow a file dies, and the consistency sweep
Registered consumersAddGrydFilesConsumer<TScope>, the scope-bound ports and the gate
The verdict contractIFileOutcomeHandler, FileOutcomeFlow and what at-least-once asks of a consumer
Legal holdsOne hold per holder, the declared author, the route and the port
The act of erasureThe one purge that passes the retention floor, dual custody and the pre-condition query
Audit trail and outboxComposing the outbox, what is on the trail, and files without a tenant
Migrating to v10.1Every signature, migration and setting that changed
Specificationv1.13, with the errata of the implementation and the conformity table

Released under the MIT License.