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:
JianweiWang
2026-05-29 10:45:10 +08:00
committed by GitHub
parent 385f8d8b4e
commit c21a38e783
14 changed files with 2181 additions and 195 deletions

View File

@@ -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"}]}`)