test(domain): clamd INSTREAM adapter maps replies to scan verdicts (refs #192)
Red: the stub adapter never connects and always answers Clean. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using Big.Application;
|
||||
|
||||
namespace Big.Infrastructure;
|
||||
|
||||
/// <summary>Scans a document with clamd over its INSTREAM protocol (S-29, ADR-0036).</summary>
|
||||
public sealed class ClamdDocumentScanner(ClamAvOptions options) : IDocumentScanner
|
||||
{
|
||||
public Task<ScanVerdict> ScanAsync(byte[] content, CancellationToken ct = default)
|
||||
=> Task.FromResult(ScanVerdict.Clean);
|
||||
}
|
||||
@@ -27,3 +27,12 @@ public sealed class AclOptions
|
||||
{
|
||||
public Uri BaseUrl { get; set; } = null!;
|
||||
}
|
||||
|
||||
/// <summary>Where clamd listens (S-29, ADR-0036). <see cref="Timeout"/> bounds one whole scan; a scan that
|
||||
/// takes longer counts as the scanner being unavailable.</summary>
|
||||
public sealed class ClamAvOptions
|
||||
{
|
||||
public string Host { get; set; } = "clamav";
|
||||
public int Port { get; set; } = 3310;
|
||||
public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user