GebSecure Docs v0.1.0

Guides · Policies

Policy templates

The built-in, parameterized policy templates, rendered with their default parameters.

Templates are vetted starting points. Rendering one produces ordinary GSL source that goes through the same validation, tests and deployment gate as hand-written policy. List them with GET /v1/policy-templates and create a policy from one with POST /v1/policies and {"name": …, "templateId": …, "templateParams": {…}}; the console offers them in the policy editor.

This page is generated from packages/policy/src/templates.ts; every rendering below is validated by the documentation tests.

Payment amount limit with approval#

payments-limit · category payments — Agents may create payments/refunds up to a hard limit; amounts above a threshold need human approval; a rolling daily cap applies.

Parameter Type Default Description
actions string[] ["stripe:payment_intents.create","stripe:refunds.create"] Payment actions
hardLimit number 1000 Maximum single amount
approvalAbove number 100 Require approval above this amount
dailyCap number 5000 Maximum total per agent per 24h
approverRole string "approver" Org role that approves

Rendered with the defaults:

gsl
policy "payments-limit" {
  description "Payments up to 1000; approval above 100; 5000/day cap"
  effect permit
  principal agent
  action in ["stripe:payment_intents.create", "stripe:refunds.create"]
  resource any
  when has(context.amount) && context.amount > 0 && context.amount <= 1000
  limit sum(context.amount) <= 5000 per 24h by agent
  require approval when context.amount > 100 {
    approvers role "approver"
    expires 4h
  }
}

Read-only in production#

production-read-only · category general — Forbids write/delete actions in production for all agents except those explicitly tagged.

Parameter Type Default Description
exemptTag string "prod-writer" Agents with this tag are exempt

Rendered with the defaults:

gsl
policy "production-read-only" {
  description "No writes in production unless the agent is tagged prod-writer"
  effect forbid
  principal agent
  action any
  resource any
  environment in ["production"]
  when action.category in ["write", "delete", "admin"]
  unless "prod-writer" in principal.tags
}

Block destructive database queries#

block-destructive-sql · category database — Forbids DROP/TRUNCATE/ALTER and unbounded DELETE/UPDATE through the database gateway.

Rendered with the defaults:

gsl
policy "block-destructive-sql" {
  description "Destructive statements are never allowed for agents"
  effect forbid
  principal agent
  action in ["db:*/drop", "db:*/truncate", "db:*/alter", "db:*/grant", "db:*/revoke"]
  resource any
}

policy "block-unbounded-writes" {
  description "UPDATE/DELETE without a WHERE clause are forbidden"
  effect forbid
  principal agent
  action in ["db:*/update", "db:*/delete"]
  resource any
  when has(context.query.hasWhere) && context.query.hasWhere == false
}

Approval for production changes#

production-deploy-approval · category devops — Any deploy/infra/IAM change in production requires approval from two platform approvers, sequentially.

Parameter Type Default Description
approverRole string "security_admin" Approver role
minApprovers number 2 Number of approvals

Rendered with the defaults:

gsl
policy "production-change-approval" {
  description "Production changes need 2 approvals"
  effect require_approval
  principal any
  action in ["cloud:*/deploy*", "cloud:*/iam.*", "cloud:*/delete*", "k8s:*/apply", "k8s:*/delete", "terraform:*/apply", "vercel:deployments.create", "github:*/merge"]
  resource any
  environment in ["production"]
  require approval {
    approvers role "security_admin"
    min 2
    mode sequential
    expires 24h
  }
}

Business hours only#

business-hours · category general — Sensitive actions are only permitted during business hours in a given time zone.

Parameter Type Default Description
actions string[] ["*"] Actions to restrict
timezone string "UTC" IANA time zone

Rendered with the defaults:

gsl
policy "outside-business-hours" {
  description "Forbid outside business hours"
  effect forbid
  principal agent
  action in ["*"]
  resource any
  when !(time.weekday >= 1 && time.weekday <= 5 && time.hour >= 9 && time.hour < 18)
}

External email requires approval#

email-external-domains · category communication — Sending email/messages to recipients outside allowed domains requires approval.

Parameter Type Default Description
internalDomains string[] ["example.com"] Internal domains

Rendered with the defaults:

gsl
policy "external-email-approval" {
  description "Messages to external recipients need approval"
  effect require_approval
  principal agent
  action in ["gmail:messages.send", "m365:mail.send", "slack:chat.postMessage.external", "twilio:messages.create"]
  resource any
  when has(context.recipient) && !(domain(context.recipient) in ["example.com"])
  require approval {
    approvers owner
    expires 2h
  }
}

MCP tool allowlist#

mcp-tool-allowlist · category mcp — Agents may call only the listed MCP tools; everything else on MCP is denied by default.

Parameter Type Default Description
server string "github" MCP server slug
tools string[] ["search_issues","get_issue"] Allowed tools

Rendered with the defaults:

gsl
policy "mcp-github-allowlist" {
  description "Allowed github MCP tools"
  effect permit
  principal agent
  action in ["mcp:github/search_issues", "mcp:github/get_issue"]
  resource any
}

PII export approval#

pii-export-approval · category data — Exporting data classified as PII requires approval from a security admin.

Rendered with the defaults:

gsl
policy "pii-export-approval" {
  description "PII exports need security approval"
  effect require_approval
  principal any
  action any
  resource any
  when has(resource.classification) && resource.classification == "pii" && action.verb in ["export", "download", "send", "share"]
  require approval {
    approvers role "security_admin"
  }
}

IAM change protection#

iam-change-protection · category devops — Forbids agents from modifying IAM (roles, policies, keys) in any cloud.

Rendered with the defaults:

gsl
policy "iam-change-protection" {
  description "Agents may not change IAM"
  effect forbid
  principal agent
  action in ["aws:iam.*", "gcp:iam.*", "azure:authorization.*", "k8s:*/rbac.*", "github:*/admin.*"]
  resource any
  unless action.verb in ["get", "list", "describe", "read"]
}

Infrastructure deletion protection#

infra-deletion-protection · category devops — Deleting infrastructure in production is forbidden; in staging it needs approval.

Rendered with the defaults:

gsl
policy "infra-deletion-forbidden-prod" {
  description "No infrastructure deletion in production"
  effect forbid
  principal agent
  action in ["aws:*.delete*", "aws:*.terminate*", "gcp:*.delete*", "azure:*.delete*", "k8s:*/delete", "terraform:*/destroy", "cloudflare:*.delete*"]
  resource any
  environment in ["production"]
}

policy "infra-deletion-approval-staging" {
  description "Infrastructure deletion in staging needs approval"
  effect require_approval
  principal agent
  action in ["aws:*.delete*", "aws:*.terminate*", "gcp:*.delete*", "azure:*.delete*", "k8s:*/delete", "terraform:*/destroy"]
  resource any
  environment in ["staging"]
  require approval {
    approvers role "security_admin"
  }
}

Approval for high-risk actions#

high-risk-approval · category general — Any action scoring above a risk threshold requires approval; above a hard threshold it is forbidden.

Parameter Type Default Description
approvalAbove number 60 Approval threshold
denyAbove number 90 Deny threshold

Rendered with the defaults:

gsl
policy "high-risk-approval" {
  description "Risk above 60 needs approval"
  effect require_approval
  principal any
  action any
  resource any
  risk above 60
}

policy "critical-risk-deny" {
  description "Risk above 90 is denied"
  effect forbid
  principal any
  action any
  resource any
  risk above 90
}

Agents act only on resources their owner can access#

owner-resources-only · category identity — Relationship-based (ReBAC): an agent may act on a resource only if its owner has the given relation to it.

Parameter Type Default Description
actions string[] ["docs:*"] Actions
relation string "editor" Required relation

Rendered with the defaults:

gsl
policy "owner-relationship" {
  description "Agent acts within its owner's permissions"
  effect permit
  principal agent where has(principal.owner)
  action in ["docs:*"]
  resource any
  when rel(principal.owner, "editor", resource.id)
}

Limit delegation depth#

delegation-depth · category identity — Forbids actions performed through delegation chains deeper than the given depth.

Parameter Type Default Description
maxDepth number 2 Maximum depth

Rendered with the defaults:

gsl
policy "delegation-depth" {
  description "Delegation chains deeper than 2 are forbidden"
  effect forbid
  principal agent
  action any
  resource any
  when has(delegation.depth) && delegation.depth > 2
}

Browser purchases need approval#

browser-purchase-approval · category browser — Checkout/purchase and account-change actions in browser sessions require owner approval.

Rendered with the defaults:

gsl
policy "browser-purchase-approval" {
  description "Purchases and account changes in the browser need approval"
  effect require_approval
  principal agent
  action in ["browser:purchase", "browser:account.change", "browser:message.send"]
  resource any
  require approval {
    approvers owner
    expires 1h
  }
}

Agent action rate limit#

agent-rate-limit · category general — Caps how many actions an agent may perform per window.

Parameter Type Default Description
actions string[] ["*"] Actions
max number 1000 Maximum actions
window duration "1h" Window

Rendered with the defaults:

gsl
policy "agent-rate-limit" {
  description "At most 1000 actions per 1h"
  effect permit
  principal agent
  action in ["*"]
  resource any
  limit count <= 1000 per 1h by agent
}