mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-09 15:08:43 +00:00
Added a prompt injection detection (#857)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
d3163badd9
commit
902a01a4d0
55 files changed
+5598
-70
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AIStudio.Tools.Security;
|
||||
|
||||
/// <summary>
|
||||
/// One passage the runtime identified as a prompt-injection attempt and filtered out.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The property names are spelled out because the content stream is deserialized without a
|
||||
/// naming policy, so the names have to match what the runtime sends verbatim.
|
||||
/// </remarks>
|
||||
public sealed record PromptInjectionFinding
|
||||
{
|
||||
/// <summary>
|
||||
/// Which rule matched, e.g. "instruction_override".
|
||||
/// </summary>
|
||||
[JsonPropertyName("rule_id")]
|
||||
public string RuleId { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The rule's family, e.g. "exfiltration".
|
||||
/// </summary>
|
||||
[JsonPropertyName("category")]
|
||||
public PromptInjectionFindingCategory Category { get; init; } = PromptInjectionFindingCategory.UNKNOWN;
|
||||
|
||||
/// <summary>
|
||||
/// The passage as it appeared in the content, so the user can see what was removed.
|
||||
/// </summary>
|
||||
[JsonPropertyName("snippet")]
|
||||
public string Snippet { get; init; } = string.Empty;
|
||||
}
|
||||
Reference in new issue
Block a user