WAF-AGN-020 β Tool Use Governance
Description
Not every agent should be able to use every tool. Tool use must be approved, logged, and limited. Agents MUST have explicit tool definitions with approved lists. All tool calls MUST be logged with context, input, output, and timestamp. Rate limits and sandboxing MUST be applied to prevent abuse.
Rationale
| Risk | Description |
|---|---|
Risk |
Overly broad tool permissions allow agents to perform destructive or unauthorized operations. |
Risk |
Missing permission boundaries at the tool level enable privilege escalation in automated workflows. |
Requirements
-
Not every agent should be able to use every tool.
-
Tool use must be approved, logged, and limited.
-
Agents MUST have explicit tool definitions with approved lists.
-
All tool calls MUST be logged with context, input, output, and timestamp.
-
Rate limits and sandboxing MUST be applied to prevent abuse.
Implementation Guidance
-
Document the requirement in a version-controlled policy or standard.
-
Assign ownership and establish a review cadence (e.g., quarterly).
-
Implement the required configuration as code in Terraform or equivalent IaC.
Maturity Levels
| Level | Name | Criteria |
|---|---|---|
L1 |
Ad hoc β control not consistently applied |
* Manual evidence exists for some workloads, but coverage is unknown. |
L2 |
Standardised β policy defined and communicated |
* A version-controlled policy, ADR, or standard describes the requirement. |
L3 |
Integrated β automated validation in CI/CD |
* Terraform checks run automatically on pull requests and report results. |
L4 |
Auditable β metrics and exceptions tracked |
* Control coverage, failures, and approved exceptions are reported quarterly. |
L5 |
Optimised β continuous improvement based on data |
* Control effectiveness is measured and iteratively improved. |
Checks
waf-agn-020.tf.aws.bedrock-agent-tools-approved
Engine: terraform | Provider: aws | Automated: Yes
AWS Bedrock agents must have approved tool definitions
AWS Bedrock agents must have explicit tool definitions in their tool schema. Wildcard or unrestricted tools are prohibited. All tools must be from an approved list.
Scope: resource β aws_bedrockagent
Assertions:
* tool_schema.tools attribute exists β Agent must have explicit tool definitions.
* tool_schema.tools json not contains pattern pattern "name":\\s*"*" β Tools must not use wildcard names like "*". Define specific tools only.
Remediation: Define explicit tools in the aws_bedrockagent resource tool_schema. Use the 'tools' block to specify each allowed tool with name, description, and input schema. Do not use wildcard definitions.
resource "aws_bedrockagent" "support_agent" {
agent_name = "customer-support"
tool_schema {
tools = [{
name = "lookup_customer"
description = "Look up customer by email"
input_schema = jsonencode({
type = "object"
properties = {
email = { type = "string" }
}
required = ["email"]
})
}, {
name = "check_order_status"
description = "Check order status"
input_schema = jsonencode({
type = "object"
properties = {
order_id = { type = "string" }
}
required = ["order_id"]
})
}]
}
}
resource "aws_bedrockagent" "bad_agent" {
agent_name = "unrestricted-agent"
tool_schema {
tools = [{
name = "*"
description = "Allow all tools"
# WAF-AGN-020 Violation: wildcard tool definition
}]
}
}
waf-agn-020.tf.azurerm.ai-tool-filter
Engine: terraform | Provider: azurerm | Automated: Yes
Azure AI services must have content filters and tool restrictions configured
Azure AI services deployments must have content filters and tool usage restrictions configured. Only approved tool functions should be exposed to agents.
Scope: resource β azurerm_cognitive_account, azurerm_cognitive_deployment
Assertions:
* network_acls attribute exists β Azure AI services account must have network ACLs restricting access.
* sku_name not empty β Azure AI deployment must have a configured SKU.
Remediation: Configure azurerm_cognitive_account with network ACLs and content filters. Use azurerm_cognitive_deployment with strict model settings. Document approved tools in ADR.
resource "azurerm_cognitive_account" "ai" {
name = "ai-services-account"
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
kind = "OpenAI"
sku_name = "S0"
network_acls {
default_action = "Deny"
ip_rules = ["10.0.0.0/24"]
}
}
resource "azurerm_cognitive_deployment" "agent" {
name = "agent-deployment"
cognitive_account_id = azurerm_cognitive_account.ai.id
model {
format = "OpenAI"
name = "gpt-4o"
version = "2024-08-06"
}
sku {
name = "Standard"
capacity = 1
}
}
resource "azurerm_cognitive_account" "ai" {
name = "ai-services-account"
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
kind = "OpenAI"
sku_name = "S0"
# No network ACLs or content filters configured
# WAF-AGN-020 Violation
}
waf-agn-020.tf.google.vertex-agent-tools-approved
Engine: terraform | Provider: google | Automated: Yes
Google Vertex AI agents must have approved tool definitions
Google Vertex AI agents must have explicit tool function declarations. All tools must reference pre-approved functions with defined schemas.
Scope: resource β google_vertex_ai_agent
Assertions:
* function_declarations not empty β Agent must have explicit function declarations.
Remediation: Define function_declarations in the vertex_ai_agent configuration with specific function names, descriptions, and parameter schemas. Do not use generic or wildcard function definitions.
resource "google_vertex_ai_agent" "data_analyst" {
display_name = "data-analyst-agent"
function_declarations = [{
name = "query_database"
description = "Query the analytics database"
parameters = {
type = "OBJECT"
properties = {
query = {
type = "STRING"
description = "SQL query to execute"
}
}
required = ["query"]
}
}]
}
resource "google_vertex_ai_agent" "unrestricted" {
display_name = "unrestricted-agent"
function_declarations = [{
name = "any_function"
description = "Any function allowed"
# WAF-AGN-020 Violation: too permissive
}]
}
waf-agn-020.tf.aws.tool-call-logging-enabled
Engine: terraform | Provider: aws | Automated: Yes
AWS Bedrock tool calls must be logged
All tool calls made by AWS Bedrock agents MUST be logged to CloudWatch Logs with timestamp, agent ID, tool name, input, output, and duration.
Scope: resource β aws_bedrockagent, aws_cloudwatch_log_group
Assertions:
* name not empty β Tool call logging must be configured with a log group.
Remediation: Configure CloudWatch logging for Bedrock agents. Enable 'Inference logs' in the Bedrock console or via API. Create a log group at /aws/bedrock/inference-logs.
resource "aws_cloudwatch_log_group" "bedrock_logs" {
name = "/aws/bedrock/inference-logs"
}
resource "aws_bedrockagent" "agent" {
agent_name = "loggable-agent"
# Tool call logging enabled via CloudWatch
}
resource "aws_bedrockagent" "no_logging" {
agent_name = "no-logging-agent"
# No CloudWatch log group configured
# WAF-AGN-020 Violation: no tool call logging
}
waf-agn-020.tf.aws.tool-rate-limits-configured
Engine: terraform | Provider: aws | Automated: Yes
Tool call rate limits must be configured for agents
Agents MUST have rate limiting configured to prevent abuse. Maximum tokens per minute and requests per minute should be defined.
Scope: resource β aws_bedrockagent
Assertions:
* agent_name not empty β Agent must have rate limiting configuration.
Remediation: Configure rate limits in the Bedrock agent configuration. Use AWS SDK or Console to set maxTokensPerMinute and maxRequestsPerMinute for each agent.
resource "aws_bedrockagent" "rate_limited_agent" {
agent_name = "rate-limited"
agent_resource_role_arn = aws_iam_role.bedrock.arn
instruction = "You are a helpful assistant."
# Rate limiting via IAM policy or external service
# Tools should be rate-limited via API Gateway or similar
}
resource "aws_bedrockagent" "unlimited" {
agent_name = "unlimited-agent"
# No rate limiting configured
# WAF-AGN-020 Violation
}
waf-agn-020.tf.stackit.agentic-access-reviewed
Engine: terraform | Provider: stackit | Automated: Yes
Not every agent should be able to use every tool for stackit
Not every agent should be able to use every tool must be documented in IaC via a agentic-access-reviewed tag/label on stackit_project. This validates the control is tracked as code.
Scope: resource β stackit_project
Assertions:
* labels key exists β stackit_project is missing the agentic-access-reviewed tag/label.
Remediation: Add a agentic-access-reviewed tag/label to the stackit_project resource to show the stackit implementation of WAF-AGN-020 is tracked in IaC.
resource "stackit_project" "example" {
labels = {
agentic-access-reviewed = "true"
}
}
resource "stackit_project" "example" {
# Missing agentic-access-reviewed labels
}
waf-agn-020.tf.ovh.agentic-access-reviewed
Engine: terraform | Provider: ovh | Automated: Yes
Not every agent should be able to use every tool for ovh
Not every agent should be able to use every tool must be documented in IaC via a agentic-access-reviewed tag/label on ovh_cloud_project. This validates the control is tracked as code.
Scope: resource β ovh_cloud_project
Assertions:
* tags key exists β ovh_cloud_project is missing the agentic-access-reviewed tag/label.
Remediation: Add a agentic-access-reviewed tag/label to the ovh_cloud_project resource to show the ovh implementation of WAF-AGN-020 is tracked in IaC.
resource "ovh_cloud_project" "example" {
tags = {
agentic-access-reviewed = "true"
}
}
resource "ovh_cloud_project" "example" {
# Missing agentic-access-reviewed tags
}
waf-agn-020.tf.hcloud.agentic-access-reviewed
Engine: terraform | Provider: hcloud | Automated: Yes
Not every agent should be able to use every tool for hcloud
Not every agent should be able to use every tool must be documented in IaC via a agentic-access-reviewed tag/label on hcloud_server. This validates the control is tracked as code.
Scope: resource β hcloud_server
Assertions:
* labels key exists β hcloud_server is missing the agentic-access-reviewed tag/label.
Remediation: Add a agentic-access-reviewed tag/label to the hcloud_server resource to show the hcloud implementation of WAF-AGN-020 is tracked in IaC.
resource "hcloud_server" "example" {
labels = {
agentic-access-reviewed = "true"
}
}
resource "hcloud_server" "example" {
# Missing agentic-access-reviewed labels
}
Evidence
| Kind | Required | Description |
|---|---|---|
|
Required |
Terraform configuration implementing the control. |
|
Required |
Policy, ADR, or standard documenting the requirement. |
|
Optional |
Cloud console or API output confirming runtime state. |
Related Controls
-
WAF-SEC-020 == Regulatory Mapping
| Framework | Controls |
|---|---|
ISO 27001:2022 |
* A.8.2 β Privileged access rights * A.8.3 β Information access restriction * A.5.15 β Access control |
ISO 27017 |
* CLD.9.5 β Segregation in virtual computing environments |
CIS Controls v8 |
* CIS 5 β Account Management * CIS 6 β Access Control Management |
SOC 2 Type II |
* CC6.1 β Logical access security * CC6.3 β Authorisation and segregation of duties |
NIST SP 800-53 |
* AC-2 β Account Management * AC-3 β Access Enforcement * AC-6 β Least Privilege |
NIST CSF 2.0 |
* PR.AA-01 β Identities and credentials are managed * PR.AA-05 β Access permissions are managed |
GDPR |
* Art. 32 β Security of processing * Art. 5(1)(f) β Integrity and confidentiality |
PCI DSS v4.0 |
* Req 7 β Restrict access by business need to know * Req 7.2 β Access based on least privilege |
CSA STAR |
* CCM IAM-09 β User Access Authorization * CCM IAM-10 β User Access Reviews |
BSI C5:2020 |
* IDM-01 β Identity and access management policy * IDM-03 β Access control and authorisation |
TISAX |
* Information security β Access rights management |
ANSSI SecNumCloud |
* Domain β Access management and least privilege |
BIO |
* BIO β Toegangsrechten en autorisatiebeheer |
ENS High |
* op.acc.4 β Proceso de gestiΓ³n de derechos de acceso * op.acc.7 β GestiΓ³n de privilegios |
UK NCSC CAF |
* B2.a β Identity verification and authorisation |
FedRAMP |
* AC-2, AC-3, AC-6 (Moderate/High baseline) |
CMMC 2.0 |
* AC.L2-3.1.5 β Employ the principle of least privilege |
IT-Grundschutz |
* ORP.4 β IdentitΓ€ts- und Berechtigungsmanagement |
IRAP |
* ISM β Access control β Privileged access |
CCCS PBMM |
* AC-6 β Least privilege |
MAS TRM |
* Ch.6 β Access control |
ISMAP |
* Access control β Least privilege |
FISC |
* Technical measures β Authorisation management |
EUCS (ENISA) |
* IAM-01 β Identity and access management * IAM-03 β Least privilege access control |