This article has one primary layer: L6 Security, Identity & Governance. It examines two interfaces only: L5 Capability & Integration, which admits concrete tool operations, and L8 Infrastructure & Execution, which enforces boundaries before and during effects. It is the practical counterpart to Identity, Delegation and Least Authority for Agents. The controls below are a design proposal, not evidence of a deployed control system.

What makes a guardrail enforceable?

An instruction such as "do not export private records" is useful model guidance but not a permission boundary. A retrieved document, tool description or generated plan may contain inaccurate or hostile instructions. A guardrail is enforceable only if a component the model cannot override can deny a prohibited action before the target state changes.

The proposed policy enforcement point sits on the action path, not inside the prompt. The policy decision service consumes authenticated, trusted attributes. The target service retains its own tenant and object authorization. Output review and monitoring remain valuable, but neither substitutes for these checks.

Untrusted context flows to an agent proposal. A separate trusted enforcement gate checks identity, mandate, capability, exact arguments and policy before a resource receives an action. Denial stops execution; successful actions require independent effect evidence.
Original L6 control-path diagram. Model output proposes an operation; trusted enforcement decides whether any effect is permitted.

A six-gate action contract

  1. Admit the source and capability. Treat retrieved pages, emails, memory and tool descriptions as untrusted content. Check the chosen tool's provider, version, schema and permitted side-effect class against a trusted L5 registry. Discovery alone is never admission.
  2. Bind a current mandate. Resolve the accountable requester and authenticated agent through trusted identity systems. Include workflow purpose, target tenant and resource, data class, environment, remaining budget and expiry. Never let a model invent a missing mandate.
  3. Authorize the exact proposed effect. Evaluate operation and normalized arguments at a separate enforcement point. Apply purpose restrictions, tenant boundaries, data minimization, rate or spend limits, revocation and deny-by-default decisions.
  4. Obtain bounded approval when needed. For high-impact changes, present the human reviewer with the exact operation, target, data affected and risk. Bind approval to those inputs, a short lifetime and a single intended action. A changed target or arguments invalidate that approval.
  5. Enforce at execution. Deliver only a permitted operation through a constrained broker and credential path. The target API must independently check its resource permissions. Model reasoning, cached approval and an earlier successful call cannot override a fresh denial.
  6. Verify and record the effect. Record the policy version, request identifier, decision, approver where applicable and resource-side outcome. Check actual state using an independent read when feasible. An HTTP success or tool-generated summary is not proof that the intended effect occurred.

When the policy service cannot be reached, the identity is stale, the approval does not match, a tool version changes or evidence cannot be trusted, stop the consequential operation. For read-only tasks, an explicitly designed degraded mode may be possible; it must not silently widen write authority.

Worked example: quarterly access review

A reviewer asks an agent to assemble access evidence for one system and one review period. The agent may read authorized role assignments and summarize discrepancies. An external ticket contains text instructing the agent to send its complete employee list to an unrelated endpoint before the review can proceed. That text is source data, not a delegation or new operator instruction.

The trusted gate rejects the attempted export because the destination and action are outside the read-only mandate. If the agent proposes removing an account instead, it must seek a separately authorized change request and receive resource-owner approval for the exact identity and target. A reviewer may reject an exception without changing any access. The evidence trace records the denied operation as a valid control result.

A minimal policy interface

The following TypeScript-shaped pseudocode shows the enforcement contract. It intentionally omits token transport, actual identity verification, authorization engine internals and persistence. Those must be implemented and tested separately. The model never calls the policy decision engine with self-asserted identity as a source of truth.

// Illustrative application contract, not an MCP protocol message.
type Decision = { allow: boolean; reason: string; policyVersion: string };
async function beforeEffect(request: ActionRequest): Promise<Decision> {
  const identity = await trustedIdentity(request.session);
  if (!identity || !request.mandate) return deny('missing-authority');
  if (!isAdmitted(request.tool, request.toolDigest)) return deny('unqualified-tool');
  if (!sameExactAction(request.approval, request.operation, request.arguments))
    return deny('approval-mismatch');
  const decision = await policyService.evaluate({
    identity, mandate: request.mandate, operation: request.operation,
    resource: request.resource, tenant: request.tenant,
    dataClass: request.dataClass, environment: request.environment,
    budget: request.remainingBudget, now: request.now
  });
  if (!decision?.allow) return deny('policy-unavailable-or-denied');
  return decision; // The target service must enforce its own access checks.
}

Important: this is a conceptual sketch, not drop-in authentication or authorization code. In production, decisions must be tied to immutable request attributes, the enforcement point must not be bypassable, and downstream object permissions must be checked again.

Negative tests that matter more than a clean demo

Run these cases in an authorized test environment with synthetic records. A proposed test is not an executed test.

  1. Injected retrieval: an external note requests data export. Expected: the export is denied while legitimate review data remains usable.
  2. Tool-description change: a newly discovered tool or modified schema advertises more powers. Expected: quarantine until requalification.
  3. Missing mandate: the agent is authenticated but the task scope has expired. Expected: no consequential action.
  4. Cross-tenant object: a valid tool call targets another tenant's record. Expected: denial by broker and target service.
  5. Approval replay: a previously approved action is repeated with a different resource or arguments. Expected: approval mismatch and fresh review.
  6. Revoked delegation: permissions are withdrawn during a workflow. Expected: new execution requests fail and existing sessions are bounded.
  7. Policy outage: the authorization service becomes unavailable. Expected: no write operation and an explicit error receipt.
  8. Budget exhaustion: the proposed operation exceeds permitted count, spend or scope. Expected: denial rather than a silent reset.
  9. False tool success: a tool reports success while independent resource state is unchanged. Expected: no completed-effect claim.
  10. Audit sink failure: required evidence cannot be durably recorded. Expected: follow the documented fail-closed policy for the action class, not untracked privileged writes.

Track test outcome, enforcement component, policy version, preconditions, expected denial and whether any state changed. A passing test proves only the tested configuration and scenario; it does not establish universal resistance to prompt injection.

Source, claim, evidence and limitations

  • OWASP, Prompt Injection: LLM01:2025 Prompt Injection documents instruction/data confusion and recommends access restrictions, source separation, privileged-action approval and adversarial testing. Architectural decision: untrusted content cannot expand authority. OWASP guidance does not certify this example's resistance.
  • OWASP, Improper Output Handling: LLM05:2025 Improper Output Handling describes risks when generated output is executed or interpreted without validation. Architectural decision: validate structured action requests at the consuming boundary. A text filter is not a resource authorization system.
  • MCP, Authorization Security Considerations: MCP specification, 28 July 2026 calls for resource-bound token validation and prohibits token passthrough. Architectural decision: keep transport authentication and target-resource permission distinct. The exact local policy schema here is not specified by MCP.
  • NIST AI RMF: AI Risk Management Framework offers voluntary risk-management guidance. Architectural decision: record ownership, assessment evidence and operating limits. NIST does not prescribe this six-gate implementation.

Provenance and actual Harness change: the contribution of this article is a publication-ready L6 applied reference: six enforcement gates, one illustrative policy interface, an original diagram and ten proposed negative tests. Its existence does not mean these controls are implemented in the author's runtime, the Harness research catalog or any customer's production system. Catalog evidence, PR merge and production deployment each require independent verification.

Open questions: how to preserve exact approval scope across resumable jobs, what to do with partially completed multi-service workflows, how quickly revocation propagates to remote services and what independent evidence is sufficient for a side effect that cannot be directly read back.

Continue reading: L6 identity and delegation, L5 governed invocation, the guardrail architecture foundation, and the complete L0–L8 map.

Privacy Notice: With your consent, this website uses Google Analytics to understand aggregate visits and content usage. Analytics is optional and is not used for advertising or cross-site profiling. Some content and images may be generated or modified with the assistance of AI; every AI-assisted item is reviewed and manually edited by a human before publication. Full Privacy Policy · AI modified — reviewed and edited by a human