Skip to content

Commit ec50070

Browse files
committed
Fix invalid inline-checks doc examples; document missing-score fail-safe
Address review: - The XML doc examples used invalid SDK enum values (PROMPT_ATTACK, US_SSN) that would fail-closed on every call if copied. Use real constants (JAILBREAK/PROMPT_INJECTION/PROMPT_LEAKAGE; US_SOCIAL_SECURITY_NUMBER/EMAIL/PHONE). - Expand the comment on ChecksTripped's missing-score handling to make the deliberate fail-safe (deny) trade-off explicit.
1 parent fd73155 commit ec50070

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/AWS.Bedrock.MAG/Internal/GuardrailResponseMapper.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ public static bool ChecksTripped(
101101
return tripped.Count > 0;
102102
}
103103

104-
// A finding with no score is treated as meeting the threshold (fail-safe toward deny).
104+
// A finding with no score is treated as meeting the threshold. This is deliberate: an entry only
105+
// appears in the results when the guardrail flagged something, so a missing score denies (fail-safe)
106+
// rather than risk letting a real detection through. The trade-off is possible over-blocking if the
107+
// API ever returns a flagged entry without a score.
105108
private static bool Meets(double? score, double threshold) => !score.HasValue || score.Value >= threshold;
106109
}
107110
}

src/AWS.Bedrock.MAG/Policy/GuardrailChecksOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public sealed class GuardrailChecksOptions
1515
/// <summary>Content-filter categories to evaluate (e.g. HATE, INSULTS, SEXUAL, VIOLENCE, MISCONDUCT).</summary>
1616
public IList<string> ContentFilterCategories { get; } = new List<string>();
1717

18-
/// <summary>Prompt-attack categories to evaluate (e.g. PROMPT_ATTACK).</summary>
18+
/// <summary>Prompt-attack categories to evaluate (e.g. JAILBREAK, PROMPT_INJECTION, PROMPT_LEAKAGE).</summary>
1919
public IList<string> PromptAttackCategories { get; } = new List<string>();
2020

21-
/// <summary>PII entity types to detect (e.g. US_SSN, EMAIL, NAME).</summary>
21+
/// <summary>PII entity types to detect (e.g. US_SOCIAL_SECURITY_NUMBER, EMAIL, PHONE).</summary>
2222
public IList<string> SensitiveInformationEntities { get; } = new List<string>();
2323

2424
/// <summary>

0 commit comments

Comments
 (0)