Add PII redaction POC for secure LLM prompting.

Implements detect-redact-sanitize pipeline with regex, domain rules, and ONNX NER before the LLM boundary, plus NUnit tests and Xenovex push documentation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Bilal Nazer Ali
2026-07-07 13:05:07 +05:30
commit dfc81dea28
60 changed files with 3283 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using FluentAssertions;
using PiiRedaction.Core.Sanitization;
using PiiRedaction.Core.Tests.TestSupport;
namespace PiiRedaction.Core.Tests.Sanitization;
[TestFixture]
public sealed class PromptSanitizerTests
{
[Test]
public void Sanitize_NullRequest_ThrowsArgumentNullException()
{
var sanitizer = ProductionPipelineFactory.Create().Sanitizer;
var action = () => sanitizer.Sanitize(null!);
action.Should().Throw<ArgumentNullException>();
}
[TestCase("")]
[TestCase(" ")]
public void Sanitize_WhitespacePrompt_ThrowsArgumentException(string prompt)
{
var sanitizer = ProductionPipelineFactory.Create().Sanitizer;
var action = () => sanitizer.Sanitize(new(prompt));
action.Should().Throw<ArgumentException>();
}
}