Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.
Version: 11.3.0

Policy Examples

Every example on this page is a complete HYPR AgentPass™ policy in miniature. It gives the intent, the phase and action to choose on the form, the condition to paste, and what to watch for before you promote it from Observe.

The page has three kinds of example:

  • The built-in example chips on the policy form
  • The AI wizard's starter guardrails, which you reach by describing a goal instead of pasting an expression
  • Recipes for the attributes the AI does not write

Save every one of these in Observe first, and read its matches on the connector's Policies tab. See Observe First, Then Enforce.

The Built-In Example Chips​

The Add Policy form offers these eleven conditions as clickable chips above the editor. Click a chip to load it, then adjust it.

ChipIntentPhase · ActionConditionWatch for
Block DELETEsStop any HTTP DELETE through a REST connectorPre-Request · DENYrequest.method == "DELETE"Scope it to the connector you mean. Unscoped, it applies to every connector
Large token requestsCap how much a model may be asked to generatePre-Request · DENYhas(request.body.max_tokens) && request.body.max_tokens > 50000A body with no max_tokens is a non-match either way. The has() guard makes that intent explicit
Specific pathGovern one part of an APIPre-Request · DENY or REQUIRE_APPROVALrequest.path.startsWith("/v1/admin")Paths are compared as sent. Check the Request Log for the exact prefix
Error responsesRecord backend failuresPost-Response · ALLOWresponse.status >= 500response.* is empty during Pre-Request, so this must be a Post-Response rule
Specific agentApply a rule to one agentPre-Request · anyrequest.agent.name == "my-agent"request.agent is empty when the caller is unauthenticated, so this never matches anonymous traffic
Slow responsesRecord slow backendsPost-Response · ALLOWresponse.latency_ms > 10000Post-Response only, as for error responses
Bedrock: unattributed callerBlock a Bedrock call the gateway could not attribute to a named developerPre-Request · DENYconnector.template == "AWS_BEDROCK" && connector.aws.bedrock.identity_source != "CLOUDTRAIL"Safe by construction: identity_source is always present on a Bedrock request
Bedrock: no MFAFlag identified sessions that were not MFA-backedPre-Request · DENYconnector.aws.bedrock.mfa_authenticated == falsemfa_authenticated is present only when the caller was identified. Pair it with the unattributed-caller chip to catch the unidentified
M365: Copilot Studio agents onlyApply a rule to turns with a Copilot Studio agentPre-Request · anyconnector.m365.copilot.surface == "copilot_studio"surface is the one Copilot attribute that is always present. Lead every Copilot rule with it
Files: confidential attachmentStop a document marked confidential from reaching an agentPre-Request · DENYrequest.files.exists(f, f.text.contains("CONFIDENTIAL"))text holds at upload and on the send, so you can enforce it at either
Files: over 10 MBRefuse large attachmentsPre-Request · DENYrequest.files.exists(f, f.size_bytes > 10485760)Size is the gateway's own measurement only at upload. On the send, it is what the caller says. Enforce at upload

The AI Starter Guardrails​

The wizard offers these six under Start from a common guardrail when you author a policy with AI on an inference connector. They are goals, not expressions. Picking one fills the goal box, and the drafted rule is compiled, checked and backtested like any other.

The expression the AI writes adapts to the tools and models in use on your connector, so none is reproduced here.

GuardrailGoal, as the wizard words itPhase · Action
Block destructive shell commandsStop the agent from running destructive shell commands such as rm -rf, mkfs, dd if= writing to a device, or a fork bomb.Post-Response · DENY
Block writes outside the projectStop the agent from writing to files outside the project directory, such as anything under /etc, ~/.ssh, or system configuration paths.Post-Response · DENY
Block reads of credential filesStop the agent from reading credential files. Match the path the tool was asked to open — anything named .env, aws/credentials, id_rsa, id_ed25519, or a keychain file.Post-Response · DENY
Block production system accessStop the agent from connecting to production systems — production hostnames, production database connection strings, or a prod kubeconfig context.Post-Response · DENY
Flag secrets pasted into a promptBlock a request when the most recent message contains a secret — a private key header, an AWS secret access key, or a bearer token.Pre-Request · DENY
Flag personal data in promptsBlock a request when the most recent message contains personal data such as a national insurance or social security number, or a payment card number.Pre-Request · DENY

The first four are caught in the reply. The agent runs tools on its own machine, so the command appears only in the model's request to run it. Enforcing one of them cuts the reply short at that tool call. See Governing Inference Traffic.

Attached Files​

Files reach the gateway through the Agent Portal, and are checked twice: at upload, and again on the message that sends them. Name, type, size and checksum are the gateway's own measurement at upload only. text is the content that actually reaches the agent, so it holds on both.

Block PDF attachments over roughly one megabyte — enforce at upload
request.files.exists(f, f.mime_type == "application/pdf" && f.size_bytes > 1000000)
Act only on requests that carry a file
request.file_count > 0

request.file_count is always present, so it is the safe way to ask whether a request carried a file at all. request.files itself is absent when there are none. That makes request.files.exists(…) a non-match on ordinary traffic, which is correct, and worth knowing.

Sensitivity Labels​

request.files[].sensitivity_label carries the Microsoft Purview sensitivity label an uploaded document holds, as AgentPass read it from the document itself. It is present on an Agent Portal upload, and absent on the message that sends a file onward. Every rule in this group therefore acts at upload. See The Document's Sensitivity Label.

Block documents marked Highly Confidential. The first form reads clearly. Enforce the second, because a label can be renamed in Microsoft Purview and an identifier cannot.

Block a document marked Highly Confidential — readable form
request.files.exists(f, f.sensitivity_label.name == "Highly Confidential")
The same rule written on the label's identifier — prefer this to enforce
request.files.exists(f, f.sensitivity_label.id == "00000000-0000-0000-0000-000000000000")

Require every Office document to be classified. state is present on every upload, and not_applicable covers the formats that cannot carry a label at all. This rule therefore reaches unclassified Word, Excel and PowerPoint documents, without touching a text file, a CSV or a PDF.

Refuse an Office document that carries no sensitivity label
request.files.exists(f, f.sensitivity_label.state == "unlabeled")

Block a whole branch of your label taxonomy. parent_id is set on a sub-label. One rule on the parent's identifier covers every sub-label under it, and needs no editing when the taxonomy grows.

Block anything under one label, sub-labels included
request.files.exists(f, f.sensitivity_label.parent_id == "00000000-0000-0000-0000-000000000000")

Insist on Microsoft Purview's own stamp. source separates a label Purview applied from a plain sensitivity name some other tool wrote, which has no identifier and nothing to verify it against.

Flag a document whose marking did not come from Microsoft Purview
request.files.exists(f,
f.sensitivity_label.state == "labeled" && f.sensitivity_label.source != "msip_properties")

Save each of these in Observe first. Run it for a few days, and read the matches to see which of your documents actually carry which labels, before a rule starts refusing uploads.

The Signed-In Person​

request.user is the email of the person the gateway verified at sign-in, never a value the caller asserted. It is absent when nobody signed in.

Act only on requests from your own organization
request.user.endsWith("@example.com")
A block written only on request.user lets anonymous requests through
Do not write a rule this way
!request.user.endsWith("@example.com")

This blocks the outsiders it names, and allows every request that carried no identity, because a condition on a missing attribute is never true. Make the missing case match too, and say which traffic the rule governs:

The same intent, written safely
connector.template == "M365_COPILOT" && (!has(request.user) || !request.user.endsWith("@example.com"))

The !has(request.user) branch is what catches a request that carried no identity.

Requiring a sign-in in the first place is the connector's job, not the policy's.

The Connector​

Every request carries connector.name, connector.template and connector.onboarding_mode. Lead a template-specific rule with the template, so the intent is clear to whoever reads it next:

Guard a Bedrock-specific rule
connector.template == "AWS_BEDROCK" && connector.aws.bedrock.mfa_authenticated == false
Apply a rule to one connector by name
connector.name == "prod-anthropic" && request.path.startsWith("/v1/messages")

The Connectors field on the form scopes the policy the same way. The guard in the expression states the scope in the rule itself.

The AWS Caller Behind a Bedrock Request​

On an AWS Bedrock connector, connector.aws.bedrock.* describes the developer behind the call, as far as the gateway could identify them. Only identity_source, credential_type and has_security_token are always present, so build a block on those. Bedrock Caller Policies explains the attribution and the safe pattern.

Block calls that cannot be attributed to a named developer
connector.template == "AWS_BEDROCK" && connector.aws.bedrock.identity_source != "CLOUDTRAIL"
Flag identified sessions that were not MFA-backed
connector.template == "AWS_BEDROCK" && connector.aws.bedrock.mfa_authenticated == false
Block long-term IAM keys, allowing only SSO sessions
connector.template == "AWS_BEDROCK" && connector.aws.bedrock.credential_type == "LONG_TERM"
Require an AWS SSO session, blocking Bedrock API keys
connector.template == "AWS_BEDROCK" && connector.aws.bedrock.credential_type != "TEMPORARY"
Restrict a connector to developers from one email domain
connector.template == "AWS_BEDROCK"
&& connector.aws.bedrock.identity_source == "CLOUDTRAIL"
&& !connector.aws.bedrock.user_email.endsWith("@example.com")

The last acts only on callers the gateway identified. Pair it with the first, so the unidentified are caught too.

Approval-based onboarding on a Bedrock connector holds SSO sign-ins only. The fourth rule is therefore how you reach API-key callers. A policy is evaluated on every Bedrock request, whichever credential it carried.

Microsoft 365 Copilot​

On a Microsoft 365 Copilot connector, connector.m365.copilot.surface is always present. The Copilot Studio agent attributes arrive on copilot_studio turns only. Microsoft 365 Copilot Policies explains the surfaces.

Block turns with one Copilot Studio agent
connector.template == "M365_COPILOT"
&& connector.m365.copilot.surface == "copilot_studio"
&& connector.m365.copilot.agent_id == "00000000-0000-0000-0000-000000000000"
Apply a rule to Microsoft 365 Copilot chat but not to your agents
connector.template == "M365_COPILOT" && connector.m365.copilot.surface == "default_copilot"
Restrict a connector to people from one email domain
connector.template == "M365_COPILOT"
&& connector.m365.copilot.surface == "copilot_studio"
&& !connector.m365.copilot.user_email.endsWith("@example.com")
Block a confidential document at upload
connector.template == "M365_COPILOT"
&& connector.m365.copilot.surface == "attachment_upload"
&& request.files.exists(f, f.text.contains("CONFIDENTIAL"))
Block a reply that quotes a document marked confidential — Post-Response
connector.template == "M365_COPILOT" && inference.completion.text.contains("CONFIDENTIAL")

Prefer agent_id to agent_name in a rule you enforce. The name changes if someone renames the agent, and a rule on the old name quietly stops matching.

The last example is a reply-side rule. On a Copilot connector, any enabled reply-side rule makes replies arrive complete instead of streaming, for every conversation on that connector.

Recipes Across Namespaces​

One agent, one part of an API. Combine the calling agent with the path so the rule is about a specific agent doing a specific thing:

Require approval when the deploy agent touches production endpoints — Pre-Request
request.agent.name == "deploy-agent" && request.path.startsWith("/v1/prod/")

Guard an inference rule with the connector. An inference.* condition is a non-match on a connector that reaches no model, so scoping is already safe. The guard makes the intent readable:

Block prompts to one provider that mention an internal project — Pre-Request
connector.template == "ANTHROPIC" && inference.latest_turn.text.contains("Project Redwood")

Reading inference.latest_turn.text, not the whole conversation, makes this fire once, on the turn that introduced the phrase, instead of on every turn after it.

Files at upload, files at send. Write the metadata rule for upload, and the content rule for both:

Refuse a large attachment where the size is the gateway's own measurement — upload
connector.m365.copilot.surface == "attachment_upload" && request.files.exists(f, f.size_bytes > 10485760)
Stop confidential text reaching any agent — upload or send
request.files.exists(f, f.text.contains("CONFIDENTIAL"))