Appearance
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
| Feature | Description |
|---|---|
| 🚚 Two-phase upload | Reserve (POST /files), PUT straight to the bucket, confirm (POST /files/{id}/complete) |
| 🦠 Quarantine before reference | Pending → Scanning → Available; nothing is referenceable without a verdict, and there is no manual release |
| 🔑 Server-side identity | sha256 computed on the one read that also feeds the type detector and the engine |
| 🧪 Content-type check | By content signature, OOXML package or text validation — never by extension; unconditional, even with the antivirus waived |
| 📄 One record, one object | Every upload is its own record and its own object; what is reused is the record, by reference — never content across tenants |
| 🔗 Reference registry | Consumers register what they hold (ownerScope + ownerKey); the count is what purges read |
| ⏳ Declared retention | UntilReleased, RetainUntil or Permanent, from the upload or the profile; dates only move forward; legal hold |
| 🪦 Purge with a tombstone | The object dies, the record keeps hash, size, type, profile, scan result and location |
| 📥 Short download URLs | attachment + application/octet-stream, a few minutes of validity, a line in the audit trail per URL |
| 🩺 Scanner health | GET /files/scanner-status, a health check and three alerts: queue, signature age and an engine that misses the EICAR sample |
| 🏢 Multi-tenant | Tenant at the root of every key; another tenant's file is answered exactly as a missing one |
| 🧩 In-process consumers | Modules 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 delivery | The result of the scan reaches the owner after the commit, at least once, through an IFileOutcomeHandler per scope |
| 🔒 Legal hold per holder | The platform and each consumer hold and lift their own; legalHold is derived |
| ⚖️ Erasure | The data subject's request is the one act that passes the retention floor, with its authors, dual custody and a durable trail |
| 🔁 Re-scan | POST /files/{id}/rescan for Failed and for released files, and a job that reads the archive again after a signature update |
| 🧾 Trail in the transaction | The 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 on | Why |
|---|---|
Gryd.Infrastructure object storage (AddGrydObjectStorage) | The bucket, the provider and the presigned URLs |
| GrydJobs | The scan queue and the recurring jobs |
An IAuditStore | Download 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 |
| PostgreSQL | The 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
| Page | What it covers |
|---|---|
| Getting Started | Registration, migrations and the minimal flow |
| Configuration | The GrydFiles section, profiles and the scanner limits |
| API Reference | The eleven routes, the error contract and the permissions |
| Antivirus & Quarantine | Running clamd, the retry budget and the two alerts |
| Download | URL validity, the two headers and the trail |
| Retention & Purge | How a file dies, and the consistency sweep |
| Registered consumers | AddGrydFilesConsumer<TScope>, the scope-bound ports and the gate |
| The verdict contract | IFileOutcomeHandler, FileOutcomeFlow and what at-least-once asks of a consumer |
| Legal holds | One hold per holder, the declared author, the route and the port |
| The act of erasure | The one purge that passes the retention floor, dual custody and the pre-condition query |
| Audit trail and outbox | Composing the outbox, what is on the trail, and files without a tenant |
| Migrating to v10.1 | Every signature, migration and setting that changed |
| Specification | v1.13, with the errata of the implementation and the conformity table |