agentic-security-labs

embesozzi/agentic-security-labs Checked 6 hours ago

Hands-on labs for securing AI agents and agentic protocols based open standards

Hands-on labs for securing AI agents and the tools they call, using open identity and authorization standards. Built by Martin Besozzi, IAM and AI Security Architect, CTO. These labs build on my experience in identity and access management, security architecture, and emerging agentic AI security patterns, with a focus on applying established standards rather than reinventing the wheel. As agents start acting on behalf of users, calling MCP tools, APIs, and other agents, the same questions from traditional IAM take on new urgency:

Summary extracted from the README.

Agentic Security Labs

Hands-on labs for securing AI agents and the tools they call, using open identity and authorization standards.

Built by Martin Besozzi, IAM and AI Security Architect, CTO. These labs build on my experience in identity and access management, security architecture, and emerging agentic AI security patterns, with a focus on applying established standards rather than reinventing the wheel.

As agents start acting on behalf of users, calling MCP tools, APIs, and other agents, the same questions from traditional IAM take on new urgency:

  • Who is calling? The user, the agent, or both?
  • What can they do? Which tools, on which resources, under which conditions?
  • Where is authorization enforced? At each tool, at a gateway, or across multiple enforcement points?

Each lab runs as a small Docker Compose environment that demonstrates a concrete security pattern, combining an identity provider, policy enforcement points (PEPs) in front of agent tools, and a policy decision point (PDP) that evaluates authorization policies.

Building blocks

Component Role in the labs
Keycloak OpenID Provider and AuthZEN PDP
Agent Gateway MCP gateway acting as the Policy Enforcement Point
OpenID AuthZEN Standard API between the PEP and the PDP
Cedar Policy language and evaluation engine behind the PDP's decisions, added to Keycloak by the Cedar policy provider
MCP Protocol the agents use to call tools

Prerequisites

  • Docker with Docker Compose
  • curl, jq and make

Labs

Both labs run from the same folder, mcp-authzen: Agent Gateway enforces per-tool authorization for an MCP server, and Keycloak decides through AuthZEN. They differ only in the policy engine Keycloak uses.

Lab What you'll learn Post
MCP Tool Authorization with OpenID AuthZEN Externalize per-tool authorization for an MCP server to a standards-based PDP, with Keycloak default policies Implementing OpenID AuthZEN in Agent Gateway
MCP Tool Authorization with Cedar The same authorization written as Cedar policies, with the Keycloak Cedar provider Keycloak Cedar Authorization with AuthZEN

To run a lab, see Running the example.

Versions

Version Changes
v1.1.0 Adds Cedar policies with the Keycloak Cedar provider
v1.0.0 MCP tool authorization with AuthZEN: Keycloak as the PDP, Agent Gateway as the PEP