This document explains how to view and update Model Armor floor settings and provides an example of a floor setting violation.
Model Armor floor settings define rules that specify minimum requirements for all the Model Armor templates created at a specific point in the Google Cloud resource hierarchy (that is, at an organization, folder, or project level). If multiple floor settings conflict, the settings lower in the resource hierarchy take precedence. For example, if a floor setting policy is created at a folder and project level, the project-level policy is applied. This behavior only applies to projects that are inside that specific folder.
For example, suppose you've set a folder-level policy on a specific folder, enabling a malicious URI filter for all content within it. Then, within that same folder, you have a particular project. On this project, you've configured a more specific project-level policy. This project-level policy requires prompt injection and jailbreak detection with a medium confidence threshold.
The outcome is the following:
Any Model Armor template created within this specific project must include the prompt injection and jailbreak detection filter, set with at least a medium confidence threshold. This is because the project-level policy establishes a minimum requirement for all templates within that project.
Templates created outside of this project's parent folder aren't affected by that specific folder policies. So, if you create a template in a different folder or at the root level, it won't automatically require the malicious URI filter that was set for this particular folder. This highlights that these policies are scoped to their specific hierarchical level and don't apply globally unless set at a higher, broader organizational level.
Floor settings help CISOs and security architects enforce minimum security posture for all the Model Armor templates in their organization. These settings help prevent developers from compromising security standards. If you're using the Premium or Enterprise service tier of Security Command Center, floor setting violations trigger findings. If a template with less restrictive settings is created before a floor setting, Security Command Center surfaces a finding. These settings help you identify and remediate less secure Model Armor templates. Floor settings cannot enforce Sensitive Data Protection.
Before you begin
Before you begin, complete the following tasks.
Obtain the required permissions
To get the permissions that
you need to manage floor settings,
ask your administrator to grant you the
Model Armor Floor Setting Admin (roles/modelarmor.floorSettingsAdmin
)
IAM role on Model Armor floor settings.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Enable APIs
You must enable Model Armor APIs before you can use Model Armor.
Console
Enable the Model Armor API.
Select the project where you want to activate Model Armor.
gcloud
Before you begin, follow these steps using the Google Cloud CLI with the Model Armor API:
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Run the following command to set the API endpoint for the Model Armor service.
gcloud config set api_endpoint_overrides/modelarmor "https://modelarmor.LOCATION.rep.googleapis.com/"
Replace
LOCATION
with the region where you want to use Model Armor.
Run the following command to enable Model Armor.
gcloud services enable modelarmor.googleapis.com --project=PROJECT_ID
Replace PROJECT_ID
with the ID of the project.
Integration with Vertex AI
Model Armor integrates with Vertex AI to screen Gemini model requests and responses based on your defined floor settings. You need to enable Cloud Logging to get visibility into prompts and responses. For more information, see Model Armor integration with Vertex AI.
Configure floor settings
You use floor settings to configure the minimum detection thresholds for Model Armor templates. These settings verify that all new and modified templates meet certain requirements. To configure floor settings, do the following:
- In the Google Cloud console, go to the Model Armor page.
- Select a project.
- On the Model Armor page, go to the Floor settings tab and click Configure floor settings.
- On the Configure floor settings page, select the configuration option.
- In the Detections section, configure the detection settings.
- Optional: If you select Sensitive Data Protection detection, you need to configure the Sensitive Data Protection settings.
In the Responsible AI section, set the confidence level for each content filter.
In the Services section, choose the services where these floor settings will be applied.
In the Logs section, select Enable Cloud Logging to log all user prompts, model responses, and the floor settings detector results.
Click Save floor settings.
Define how floor settings are inherited
When configuring floor settings, select the configuration option.
Inherit parent's floor settings: Inherits floor settings set higher in the resource hierarchy. Click Save floor settings and skip the next steps. To view the inherited settings, go to the Floor settings tab.
Custom: Define floor settings for this project. The custom settings that you define for a project override any inherited floor settings.
Disable: Disables any inherited floor settings, which means no detection rules are applied to the Model Armor templates and Vertex AI for your Gemini workloads. Click Save floor settings and skip the next steps. View the disabled status on the Floor settings tab.
Define where floor settings are applied
Select one of the following services where the configured floor settings are applied.
- Model Armor - Template creation & update: Every new and modified Model Armor template in a project is checked to ensure that the minimum settings are specified according to the floor settings.
Vertex AI: Screen requests sent to Gemini models and log or block those that meet floor settings thresholds.
If you select Vertex AI, the Vertex AI section is displayed where you can choose how floor settings are enforced.
- Inspect only: Detect requests that don't meet floor settings but don't block them.
- Inspect and block violations: Detect and block requests that don't meet the floor settings.
View Model Armor floor settings
View Model Armor floor settings to verify existing settings, to identify what the minimum requirements are for your AI applications, or to troubleshoot issues when a template is not behaving as expected.
Run the following command to view the Model Armor floor settings.
Console
In the Google Cloud console, go to the Model Armor page.
Verify that you are viewing the project that you activated Model Armor on.
On the Model Armor page, go to the Floor settings tab. If floor settings are set at the organization level, you can view them here. If no floor settings are defined, then you must configure them. For more information, see Configure floor settings.
gcloud
View the Model Armor floor setting for a given project.
gcloud model-armor floorsettings describe \ --full-uri='projects/PROJECT_ID/locations/global/floorSetting'
View the Model Armor floor setting for a given organization.
gcloud model-armor floorsettings describe \ --full-uri='organizations/ORGANIZATION_ID/locations/global/floorSetting'
View the Model Armor floor setting for a given folder.
gcloud model-armor floorsettings describe \ --full-uri='folders/FOLDER_ID/locations/global/floorSetting'
Replace the following:
PROJECT_ID
: the ID of the project for the floor settings.FOLDER_ID
: the ID of the folder for the floor settings.ORGANIZATION_ID
: the ID of the organization for the floor settings.
REST
View the Model Armor floor setting for a given project.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://modelarmor.googleapis.com/v1/projects/PROJECT_ID/locations/global/floorSetting"
View the Model Armor floor setting for a given folder.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://modelarmor.googleapis.com/v1/folders/FOLDER_ID/locations/global/floorSetting"
View the Model Armor floor setting for a given organization.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://modelarmor.googleapis.com/v1/organizations/ORGANIZATION_ID/locations/global/floorSetting"
Replace the following:
PROJECT_ID
: the ID of the project for the floor settings.FOLDER_ID
: the ID of the folder for the floor settings.ORGANIZATION_ID
: the ID of the organization for the floor settings.
Go
View the Model Armor floor setting for a given project.
View the Model Armor floor setting for a given folder.
View the Model Armor floor setting for a given organization.
Java
View the Model Armor floor setting for a given project.
View the Model Armor floor setting for a given folder.
View the Model Armor floor setting for a given organization.
Node.js
View the Model Armor floor setting for a given project.
View the Model Armor floor setting for a given folder.
View the Model Armor floor setting for a given organization.
PHP
View the Model Armor floor setting for a given project.
View the Model Armor floor setting for a given folder.
View the Model Armor floor setting for a given organization.
Python
To run this code, first set up a Python development environment and install the Model Armor Python SDK.
View the Model Armor floor setting for a given project.
View the Model Armor floor setting for a given folder.
View the Model Armor floor setting for a given organization.
Update Model Armor floor settings
Update Model Armor floor settings to change the minimum requirements for templates to reflect changes in security policies, to correct misconfigurations, or to resolve conflicts between floor settings.
Run the following command to update the Model Armor floor settings.
Console
In the Google Cloud console, go to the Model Armor page.
Verify that you are viewing the project that you activated Model Armor on.
On the Model Armor page, go to the Floor settings tab and click Configure floor settings.
Update the required fields and click Save floor settings.
gcloud
gcloud model-armor floorsettings update --full-uri=<full-uri-of-the-floorsetting>
Example command:
gcloud model-armor floorsettings update \
--malicious-uri-filter-settings-enforcement=ENABLED \
--pi-and-jailbreak-filter-settings-enforcement=DISABLED \
--pi-and-jailbreak-filter-settings-confidence-level=LOW_AND_ABOVE \
--basic-config-filter-enforcement=ENABLED \
--add-rai-settings-filters='[{"confidenceLevel": "low_and_above", "filterType": "HARASSMENT"}, {"confidenceLevel": "high", "filterType": "SEXUALLY_EXPLICIT"}]'
--full-uri='folders/FOLDER_ID/locations/global/floorSetting' \
--enable-floor-setting-enforcement=true
Replace FOLDER_ID
with the ID of the folder for the floor settings.
REST
Update the Model Armor floor setting for a given project.
curl -X PATCH -d '{"filterConfig" :{"piAndJailbreakFilterSettings": { "filterEnforcement": "ENABLED"}, "maliciousUriFilterSettings": { "filterEnforcement": "ENABLED" }, "rai_settings":{"rai_filters":{"filter_type":"DANGEROUS", "confidence_level":"LOW_AND_ABOVE" }, \ "rai_filters":{"filter_type":"HATE_SPEECH", "confidence_level":"LOW_AND_ABOVE" }, "rai_filters":{"filter_type":"HARASSMENT", "confidence_level":"LOW_AND_ABOVE" }, "rai_filters":{"filter_type":"SEXUALLY_EXPLICIT", "confidence_level":"LOW_AND_ABOVE" }}},"enableFloorSettingEnforcement":"true"}' -H "Content-Type: application/json" -H "Authorization: Bearer $(gcloud auth print-access-token) "https://modelarmor.googleapis.com/v1/projects/PROJECT_ID/locations/global/floorSetting"
Update the Model Armor floor setting for a given folder.
curl -X PATCH \ -d '{"filterConfig" :{"piAndJailbreakFilterSettings": { "filterEnforcement": "ENABLED"}, "maliciousUriFilterSettings": { "filterEnforcement": "ENABLED" }},"enableFloorSettingEnforcement":"true"}' \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://modelarmor.googleapis.com/v1/folders/FOLDER_ID/locations/global/floorSetting"
Update the Model Armor floor setting for a given organization.
curl -X PATCH \ -d '{"filterConfig" :{"piAndJailbreakFilterSettings": { "filterEnforcement": "ENABLED"}, "maliciousUriFilterSettings": { "filterEnforcement": "ENABLED" }},"enableFloorSettingEnforcement":"true"}' \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://modelarmor.googleapis.com/v1/organizations/ORGANIZATION_ID/locations/global/floorSetting"
Replace the following:
PROJECT_ID
: the ID of the project for the floor settings.FOLDER_ID
: the ID of the folder for the floor settings.ORGANIZATION_ID
: the ID of the organization for the floor settings.
The update command returns the following response:
{ "name": "projects/PROJECT_ID/locations/global/floorSetting", "updateTime": "2024-12-19T15:36:21.318191Z", "filterConfig": { "piAndJailbreakFilterSettings": { "filterEnforcement": "ENABLED" }, "maliciousUriFilterSettings": { "filterEnforcement": "ENABLED" } } }
Go
Update the Model Armor floor setting for a given project.
Update the Model Armor floor setting for a given folder.
Update the Model Armor floor setting for a given organization.
Java
Update the Model Armor floor setting for a given project.
Update the Model Armor floor setting for a given folder.
Update the Model Armor floor setting for a given organization.
Node.js
Update the Model Armor floor setting for a given project.
Update the Model Armor floor setting for a given folder.
Update the Model Armor floor setting for a given organization.
PHP
Update the Model Armor floor setting for a given project.
Update the Model Armor floor setting for a given folder.
Update the Model Armor floor setting for a given organization.
Python
To run this code, first set up a Python development environment and install the Model Armor Python SDK.
Update the Model Armor floor setting for a given project.
Update the Model Armor floor setting for a given folder.
Update the Model Armor floor setting for a given organization.
Review findings about floor setting violation
Each Model Armor finding identifies a floor setting violation. A violation occurs when a Model Armor template fails to meet the minimum security standards defined by the resource hierarchy floor settings. Floor settings define the minimum requirements for templates. A floor setting violation might involve a template missing required filters or not meeting the minimum confidence level for those filters. When a violation is detected, a high-severity finding is generated in Security Command Center. The finding specifies the violated floor setting, the non-compliant template, and details about the violation.
The following example shows the finding's sourceProperties
field. This
violation, related to the malicious URI filter, occurred
because the template setting for the maliciousUriFilterSettings
is
DISABLED
, but the floor settings require it to be ENABLED
.
{ "filterConfig": { "raiSettings": { "raiFilters": [ { "filterType": "HATE_SPEECH", "confidenceLevel": { "floorSettings": "LOW_AND_ABOVE", "template": "MEDIUM_AND_ABOVE" } }, { "filterType": "HARASSMENT", "confidenceLevel": { "floorSettings": "MEDIUM_AND_ABOVE", "template": "HIGH" } } ] }, "piAndJailbreakFilterSettings": { "confidenceLevel": { "floorSettings": "LOW_AND_ABOVE", "template": "HIGH" } }, "maliciousUriFilterSettings": { "floorSettings": "ENABLED", "template": "DISABLED" } } }
What's next
- Learn more about Model Armor.
- Learn about Model Armor templates.
- Sanitize prompts and responses.
- Troubleshoot Model Armor issues.