GCP Vertex AI Response Blocked by Safety Filters

Last updated 18 days ago on 2026-11-03
Created 2 months ago on 2026-10-02

About

Detects Vertex AI GenerateContent responses whose candidate finish_reason is SAFETY. That value is emitted when Gemini safety filters stop generation. Unlike textual refusals (finish_reason STOP), SAFETY means the provider blocked or truncated the completion.
Tags
Domain: GenAIDomain: CloudData Source: GCP Vertex AIData Source: GCPData Source: Google Cloud PlatformPlatform: GCPService: GCP Vertex AIUse Case: Policy ViolationUse Case: Threat DetectionTactic: Defense EvasionThreat: Unauthorized AI UsageRule Type: ES|QLLanguage: esql
Severity
medium
Risk Score
47
False Positive Examples
Aggressive safetySettings (for example BLOCK_LOW_AND_ABOVE) on red-team or content-moderation workloads can produce frequent SAFETY finishes. Exclude those projects or models, or require concurrent HIGH/MEDIUM ratings.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

gcp_vertexai(external, opens in a new tab or window)

Query
text code block:
from logs-gcp_vertexai.prompt_response_logs-* metadata _id, _version, _index | where data_stream.dataset == "gcp_vertexai.prompt_response_logs" and MV_CONTAINS(gcp.vertexai.prompt_response_logs.full_response.candidates.finish_reason, "SAFETY") | keep _id, _version, _index, @timestamp, cloud.project.id, gcp.vertexai.prompt_response_logs.model, gcp.vertexai.prompt_response_logs.api_method, gcp.vertexai.prompt_response_logs.full_request.contents.parts.text, gcp.vertexai.prompt_response_logs.full_request.safety_settings.category, gcp.vertexai.prompt_response_logs.full_request.safety_settings.threshold, gcp.vertexai.prompt_response_logs.full_response.candidates.finish_reason, gcp.vertexai.prompt_response_logs.full_response.candidates.safety_ratings.category, gcp.vertexai.prompt_response_logs.full_response.candidates.safety_ratings.probability, gcp.vertexai.prompt_response_logs.full_response.candidates.safety_ratings.severity

Install detection rules in Elastic Security

Detect GCP Vertex AI Response Blocked by Safety Filters in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).