Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions api/v1alpha1/agentgateway/ai_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ const (

// Action to take if a regex pattern is matched in a request or response.
// This setting applies only to request matches. PromptguardResponse matches are always masked by default.
// +kubebuilder:validation:Enum=Mask;Reject
type Action string

const (
// Mask the matched data in the request.
MASK Action = "MASK"
MASK Action = "Mask"

// Reject the request if the regex matches content in the request.
REJECT Action = "REJECT"
REJECT Action = "Reject"
)

// Regex configures the regular expression (regex) matching for prompt guards and data masking.
Expand All @@ -105,8 +106,8 @@ type Regex struct {

// The action to take if a regex pattern is matched in a request or response.
// This setting applies only to request matches. PromptguardResponse matches are always masked by default.
// Defaults to `MASK`.
// +kubebuilder:default=MASK
// Defaults to `Mask`.
// +kubebuilder:default=Mask
// +optional
Action *Action `json:"action,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,14 @@ spec:
and data masking.
properties:
action:
default: MASK
default: Mask
description: |-
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `MASK`.
Defaults to `Mask`.
enum:
- Mask
- Reject
type: string
builtins:
description: |-
Expand Down Expand Up @@ -987,11 +990,14 @@ spec:
and data masking.
properties:
action:
default: MASK
default: Mask
description: |-
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `MASK`.
Defaults to `Mask`.
enum:
- Mask
- Reject
type: string
builtins:
description: |-
Expand Down Expand Up @@ -2854,11 +2860,14 @@ spec:
for prompt guards and data masking.
properties:
action:
default: MASK
default: Mask
description: |-
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `MASK`.
Defaults to `Mask`.
enum:
- Mask
- Reject
type: string
builtins:
description: |-
Expand Down Expand Up @@ -3074,11 +3083,14 @@ spec:
for prompt guards and data masking.
properties:
action:
default: MASK
default: Mask
description: |-
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `MASK`.
Defaults to `Mask`.
enum:
- Mask
- Reject
type: string
builtins:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,14 @@ spec:
for prompt guards and data masking.
properties:
action:
default: MASK
default: Mask
description: |-
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `MASK`.
Defaults to `Mask`.
enum:
- Mask
- Reject
type: string
builtins:
description: |-
Expand Down Expand Up @@ -790,11 +793,14 @@ spec:
for prompt guards and data masking.
properties:
action:
default: MASK
default: Mask
description: |-
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `MASK`.
Defaults to `Mask`.
enum:
- Mask
- Reject
type: string
builtins:
description: |-
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/features/agentgateway/aibackend/testdata/setup.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only test that uses the enum names?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ spec:
message: "request rejected"
statusCode: 403
regex:
action: REJECT
action: Reject
matches:
- "credit card"
response:
- regex:
action: REJECT
action: Reject
builtins:
- Ssn
---
Expand Down