Case study 02 · AI security engineering

Testing the controls around the model.

A local lab for exploring what happens when AI agents can request tools and access data—and why the application, not the model, must enforce the security boundary.

Python · Ollama · WazuhIndependent, synthetic test environmentPublic code & validation evidence
The problem

An AI agent can ask. That doesn't mean it should be allowed.

When an AI model is allowed to request tool calls, the surrounding application needs to decide which operations are permitted. A prompt that says “do not access another customer's information” is not an authorization system.

I built this lab to explore that distinction using synthetic financial records, local inference, and observable security controls.

My approach

Put enforcement outside the model.

Scope access

Use read-only tools, fixture identities, service permissions, and explicit customer-level scope checks to constrain operations.

Challenge the boundary

Submit malicious tool proposals in offline tests to verify that unauthorized customer access, identity overrides, and unknown tools are rejected.

Collect evidence

Emit structured application security events and connect them to Wazuh rules so access decisions become visible to defenders.

Keep decisions human

Generate evidence-grounded incident drafts that require explicit approval rather than initiating autonomous remediation.

My contribution: I defined the security questions, architecture and test boundaries, directed AI-assisted implementation, ran and validated the local environment, troubleshot unexpected behavior, and documented confirmed results and unresolved issues.

Evidence & outcomes

Passing tests, observed telemetry, documented exceptions.

406Application tests passing in the repository's recorded validation
5Indexed Wazuh alerts observed from five Python authorization denials
13CI-policy checks passing in recorded validation
Human approvalRequired before a generated SOC investigation report is approved

The repository includes an evidence index, sanitized alert records, design decisions, test instructions, and a record of failures investigated along the way.

Known limits

Tests don't prove everything.

The live prompt-injection experiment did not produce an observed unauthorized request. The offline authorization tests separately demonstrated rejection of malicious proposals; those are different claims and should not be conflated.

  • All customer data is synthetic; this is not a production financial system.
  • Fixture identities are not a production authentication or authorization stack.
  • An investigation into Wazuh correlation expiration remains unresolved in the recorded results.
  • The security reports are generated from controlled templates and do not perform autonomous remediation.
Why it matters

Governance decisions need technical evidence.

This lab is useful beyond an engineering interview. It connects AI security requirements—least privilege, traceability, human oversight—to actual control implementations and failure modes. The objective is to understand what the controls prove, what they miss, and how to explain the residual risk.

Review the implementation

Open-source lab records

Read the code, reproduce the tests, and inspect the evidence and limitations in the public repository.

Keep exploring

Vera Memory Engine

Next case study