Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create the Input Sanitization Template
/ 30
Create the Response Sanitization Template
/ 30
Test Defenses in Agent Platform Workbench
/ 20
Audit Flagged Violations in Cloud Logging
/ 20
Create the Input Sanitization Template
/ 30
Create the Response Sanitization Template
/ 30
Test Defenses in Agent Platform Workbench
/ 20
Audit Flagged Violations in Cloud Logging
/ 20
In modern enterprise AI architectures, securing Large Language Models (LLMs) requires moving beyond traditional network perimeters to content-aware, semantic firewalls.
Cymbal Wealth, a premier financial services enterprise, is deploying Cymbal Advisor—an advanced AI conversational assistant that helps portfolio managers analyze market trends and client records. However, recent security assessments revealed critical vulnerabilities:
Traditional network firewalls inspect network packets, but cannot understand the intent or semantics of conversational prompts. To safeguard Cymbal Advisor, you assume the role of Max, Lead Cloud Security Engineer, to deploy Model Armor on Google Cloud.
In this lab, you configure Model Armor input and output sanitization templates, integrate Advanced Sensitive Data Protection (SDP) for dynamic de-identification, validate defenses programmatically via Agent Platform Workbench, and audit security violations in Cloud Logging.
In this lab, you learn how to perform the following tasks:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup and access panel with the following:
Note that the lab timer is located near the top of the page, showing the remaining time.
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab setup and access panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab setup and access panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud, in Google Cloud, refer to the gcloud CLI overview guide.
Before building semantic firewall policies, explore the centralized Model Armor dashboard to understand how organization-wide floor settings and custom templates are structured.
To protect Cymbal Advisor against adversarial user prompts before they reach the model, you create an input sanitization template named advisor-input-filter.
From the Model Armor dashboard, click Create Template (or + Create).
In the template creation form, configure the following settings:
advisor-input-filter
us-central1
Under the Detections section, configure the security filters:
Expand the Additional configurations (optional) section:
Click Create to deploy the template.
Click Check my progress to verify the objective.
To prevent Cymbal Advisor from leaking sensitive customer data or generating harmful outputs, you create a dedicated output sanitization template named advisor-output-filter.
This template leverages Advanced Sensitive Data Protection (SDP), referencing pre-provisioned Cloud DLP inspect and de-identify templates (advisor-inspect-template and advisor-deidentify-template) to automatically replace detected sensitive values (such as credit card numbers and SSNs) with their infoType name (e.g. [CREDIT_CARD_NUMBER]).
In the Model Armor dashboard, click Create Template.
Configure the general properties:
advisor-output-filter
us-central1
Under the Detections section, configure the filters:
Expand the Additional configurations (optional) section:
Click Create.
Click Check my progress to verify the objective.
With your templates deployed, you will now test their effectiveness programmatically using the pre-provisioned Jupyter Notebook in Agent Platform Workbench.
In the Google Cloud console, use the Navigation menu () to navigate to Agent Platform > Notebooks > Workbench.
On the Instances tab, locate cymbal-testing-instance and click Open JupyterLab.
In the JupyterLab file browser on the left, double-click model_armor_test.ipynb to open it.
In the Select Kernel dialog, choose Python 3.
Read through and run each cell in the notebook sequentially from top to bottom (Press SHIFT+ENTER):
advisor-input-filter and observes the MATCH_FOUND block verdict.advisor-output-filter and observes dynamic redaction ([CREDIT_CARD_NUMBER], [US_SOCIAL_SECURITY_NUMBER], [EMAIL_ADDRESS], [PHONE_NUMBER]).Ensure all test cells have executed successfully and produced outputs before proceeding.
CREDIT_CARD_NUMBER do not just match digit length—they run mathematical checksum validations (such as the Luhn algorithm) before assigning a high-confidence finding. When configuring SDP inspect templates in production, setting min_likelihood allows security engineers to balance false-positive rates against strict exfiltration prevention.
Click Check my progress to verify the objective.
Model Armor integrates natively with Cloud Logging to provide comprehensive audit trails for security operations and threat hunting teams.
In the Google Cloud console, use the Navigation menu () to navigate to Logging > Logs Explorer.
In the Query pane, paste the following filter to isolate Model Armor sanitization events:
Click Run query.
In the Query results pane, click the chevron (>) next to a recent log entry to expand it and drill down into the following fields under jsonPayload:
operationType: Distinguishes whether the event evaluated an incoming user prompt (SANITIZE_USER_PROMPT) or a generated model response (SANITIZE_MODEL_RESPONSE).sanitizationInput.text: Review the intercepted payload. Notice that because de-identification was active, sensitive customer data is masked with token tags ([CREDIT_CARD_NUMBER], [US_SOCIAL_SECURITY_NUMBER]), ensuring raw sensitive data is never exposed in plain text within log storage.sanitizationResult.filterMatchState: Confirms that a threat was intercepted (MATCH_FOUND).sanitizationResult.filterResults: Expand individual detectors (such as sdp, pi_and_jailbreak, or malicious_uris) to review granular detection coordinates and confidence scores.sanitizationMetadata.sanitizationVerdict: Displays the active enforcement outcome (MODEL_ARMOR_SANITIZATION_VERDICT_BLOCK) along with the sanitizationVerdictReason.Click Check my progress to verify the objective.
You have successfully deployed and validated an active semantic firewall using Model Armor!
You configured input and output sanitization templates, integrated Advanced Sensitive Data Protection to mask sensitive financial and PII data, executed real-world attack simulations via Agent Platform Workbench, and monitored threat activity in Cloud Logging.
Copyright 2026 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We can notify you via email when it becomes available
Great!
We can contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one