Summary
SqlSinkGuard has one test file, SqlSinkGuardTaintTests.cs, but it only exercises the
[Tainted] enrichment tag — never the guard's own block/audit/no-threat decision in
isolation. Add a new Rasp.Core.Tests/Guard/SqlSinkGuardTests.cs alongside it (don't grow
the taint file with unrelated assertions).
Background
Every *DetectionEngine has a dedicated test file; most Guard classes don't, and even
SqlSinkGuard's existing test file is narrowly scoped. This is one of five identical-shaped
issues — see docs/good-first-issues-dotnet.md for the full list and the shared rationale
(this is about naming concrete gaps, not chasing a coverage percentage).
Pattern to copy
Rasp.Core.Tests/Guard/SqlSinkGuardTaintTests.cs itself — NoOpRaspMetrics fake, a real
RaspAlertBus, Options.Create(new RaspOptions {...}), NullLogger<T>.Instance. Reuse
NoOpRaspMetrics from that file rather than redefining it (or, if convenient, move it to a
shared test helper as part of this PR — flag the decision either way).
What to test
AnalyzeCommand(commandText, context) (src/Rasp.Core/Guard/SqlSinkGuard.cs)'s own
decision branches, gated by RaspOptions.BlockOnDetection — separate from (and in addition
to) the existing taint-enrichment coverage:
Summary
SqlSinkGuardhas one test file,SqlSinkGuardTaintTests.cs, but it only exercises the[Tainted]enrichment tag — never the guard's own block/audit/no-threat decision inisolation. Add a new
Rasp.Core.Tests/Guard/SqlSinkGuardTests.csalongside it (don't growthe taint file with unrelated assertions).
Background
Every
*DetectionEnginehas a dedicated test file; mostGuardclasses don't, and evenSqlSinkGuard's existing test file is narrowly scoped. This is one of five identical-shapedissues — see
docs/good-first-issues-dotnet.mdfor the full list and the shared rationale(this is about naming concrete gaps, not chasing a coverage percentage).
Pattern to copy
Rasp.Core.Tests/Guard/SqlSinkGuardTaintTests.csitself —NoOpRaspMetricsfake, a realRaspAlertBus,Options.Create(new RaspOptions {...}),NullLogger<T>.Instance. ReuseNoOpRaspMetricsfrom that file rather than redefining it (or, if convenient, move it to ashared test helper as part of this PR — flag the decision either way).
What to test
AnalyzeCommand(commandText, context)(src/Rasp.Core/Guard/SqlSinkGuard.cs)'s owndecision branches, gated by
RaspOptions.BlockOnDetection— separate from (and in additionto) the existing taint-enrichment coverage:
RaspAlertBus, no exception thrown.RaspSecurityExceptionthrown, alert still pushedbefore the throw.
SqlSinkGuardTests.cs, not merged intoSqlSinkGuardTaintTests.cs.