agent-guard-fail-open-v1
4 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo not. - Confidence
- P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
- False-positive risk
- low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
- Edge
- The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
- Taxonomy chips
- References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.
keryn.failopen.py.gate-exception-runs-action
Section titled “keryn.failopen.py.gate-exception-runs-action”error python python
A security or approval gate is called inside try/except, and the except branch runs a side-effecting action instead of denying. When the gate throws (error, timeout, approver unreachable) this becomes default-allow. Deny on gate failure: re-raise or return a denial, and run the action only on an explicit allow.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-636 CWE-755 CWE-280 LLM06 ASI03 ASI08 MANAGE MANAGE-2.4
Fix: Treat a gate failure as a denial. Put only the gate call in try/except, and on any exception re-raise or return a deny result; call the side-effecting action solely on the gate’s explicit allow. Never place the action in the except branch.
References: https://docs.python.org/3/tutorial/errors.html · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as billing/payouts.py and scan it with keryn scan billing --verbose; the finding below appears.
import logging
from billing.policy import require_approvalfrom billing.ledger import payout_vendor
log = logging.getLogger(__name__)
def settle_invoice(invoice, requester): try: require_approval(invoice, requester) except TimeoutError: log.warning("approval service timed out for %s", invoice.id) payout_vendor(invoice.vendor_id, invoice.amount) return "paid" payout_vendor(invoice.vendor_id, invoice.amount) return "paid"Checked with Keryn’s browser engine when this page was built: it reports keryn.failopen.py.gate-exception-runs-action at line 10 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.failopen.py.approval-error-path-returns-allow
Section titled “keryn.failopen.py.approval-error-path-returns-allow”error python python, claude-agent-sdk, openai-agents
An approval/authorization function’s error path returns an allow value (True / PermissionResultAllow / {“approve”: True}). A gate that allows when it cannot decide is fail-open. Return a denial on error and allow only after a positive decision.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-636 CWE-280 LLM06 ASI09 ASI03
Fix: In the except branch return a denial (False / PermissionResultDeny / {“approve”: False}) or re-raise. Return allow only from the branch that positively verified the request.
References: https://docs.python.org/3/tutorial/errors.html · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/src/claude_agent_sdk/types.py
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as agent/permissions.py and scan it with keryn scan agent --verbose; the finding below appears.
import logging
import httpx
log = logging.getLogger(__name__)POLICY_URL = "https://policy.internal.example/v1/check"
def check_tool_permission(tool_name: str, args: dict) -> bool: try: resp = httpx.post(POLICY_URL, json={"tool": tool_name, "args": args}, timeout=3) resp.raise_for_status() return resp.json()["allowed"] except httpx.HTTPError as exc: log.error("policy lookup failed: %s", exc) return TrueChecked with Keryn’s browser engine when this page was built: it reports keryn.failopen.py.approval-error-path-returns-allow at line 10 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.failopen.ts.gate-exception-runs-action
Section titled “keryn.failopen.ts.gate-exception-runs-action”error typescript, javascript typescript, nodejs
A security or approval gate is called inside try/catch, and the catch branch runs a side-effecting action instead of denying. When the gate throws this becomes default-allow. Deny on gate failure and run the action only on an explicit allow.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-636 CWE-755 CWE-280 LLM06 ASI03 ASI08 MANAGE MANAGE-2.4
Fix: Treat a thrown gate as a denial: in catch, return/throw a deny result; call the side-effecting action only on the gate’s explicit allow. Never put the action in catch.
References: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try…catch · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as src/cleanup.tsx and scan it with keryn scan src --verbose; the finding below appears.
import { requireApproval } from "./approvals";import { deleteWorkspace } from "./workspaces";
export async function removeStaleWorkspace(id: string, actor: string) { try { await requireApproval({ action: "workspace.delete", id, actor }); await deleteWorkspace(id); } catch (err) { console.warn("approval backend unreachable", err); await deleteWorkspace(id); }}Checked with Keryn’s browser engine when this page was built: it reports keryn.failopen.ts.gate-exception-runs-action at line 5 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.failopen.go.auth-error-ignored
Section titled “keryn.failopen.go.auth-error-ignored”error go go
An authorization/approval call’s error is discarded with the blank identifier, and its result is then used as the decision. Ignoring the gate’s error is fail-open: a failed check looks like a pass. Handle the error and deny on it.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-636 CWE-755 CWE-280 LLM06 ASI03 ASI08
Fix: Check the error from the authorization call and deny (return false / an error) when it is non-nil; never discard it with _ and proceed on the result.
References: https://cwe.mitre.org/data/definitions/636.html · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/