mirror of
https://github.com/alibaba/higress.git
synced 2026-06-05 18:57:30 +08:00
feat(ai-security-guard): structured x_higress deny response, error-path metrics, and AI logging (#3894)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: rinfx <yucheng.lxr@alibaba-inc.com>
This commit is contained in:
@@ -263,6 +263,14 @@ func TestResolveJsonPathEdgeCases(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestReplaceJsonFieldTextContentReportsReadableNoOp(t *testing.T) {
|
||||
body := []byte(`{"messages":[{"role":"user","content":"敏感内容"}]}`)
|
||||
result, err := ReplaceJsonFieldTextContent(body, "@this.messages.0.content", "masked")
|
||||
if err == nil {
|
||||
t.Fatalf("expected error for readable path that sjson leaves unchanged, got nil with %s", string(result))
|
||||
}
|
||||
}
|
||||
|
||||
// TestReplaceJsonFieldContent covers the simple ReplaceJsonFieldContent function
|
||||
func TestReplaceJsonFieldContent(t *testing.T) {
|
||||
body := []byte(`{"messages":[{"role":"user","content":"original"}]}`)
|
||||
|
||||
Reference in New Issue
Block a user