Exceptional conditions

From thejefflarson/soundcheck · View interactive version

Exceptional conditions is an AI agent skill from the GitHub repository thejefflarson/soundcheck. Detects error handlers that leak stack traces or fail open on exception. Use when writing error handlers, exception catching blocks, try/catch/finally constructs, or API error responses. Also invoke when an application could fail open on exception, or when stack traces might reach end users.

How to use this skill

Skill file

Exceptional Conditions Security Check (A05:2025)

What this checks

Protects against information disclosure and fail-open logic. Stack traces in API responses leak internal paths, library versions, and logic for attackers to target; swallowed exceptions and default-allow error paths grant unintended access.

Vulnerable patterns

Fix immediately

Flag the vulnerable code and explain the risk. Then suggest a fix that establishes

these properties:

  1. Client responses carry no internal detail. No stack trace, no file path, no

library version, no raw exception message. The client gets a generic message

and an opaque reference ID; the full traceback goes to a server-side log keyed

by that same ID.

  1. No catch block exits silently. Every catch / except / recover takes a

definite action: re-raise, log, or return a controlled error. A bare catch-and-pass

is the exact bug this skill prevents.

  1. Authorization failures fail closed. A permission or access-denied exception

inside a catch block must produce a deny response — never a fall-through or

default-allow. The safest pathway on ambiguity is refusal.

  1. Debug / verbose-error flags are off at deployment. The framework's

production-mode switch is set explicitly, not left at its development default.

  1. **Every unhandled exception produces a server-side log entry containing a

correlation ID** that matches the opaque reference returned to the client, so

operators can reconstruct the failure without leaking internals to the user.

Translate these principles to the audited file's language and framework. Use the

documented error-handler hook, production-mode switch, and logging facility for

that stack — do not invent ad-hoc traceback formatters or response shapes.

Verification

Confirm the following properties hold (language-agnostic):

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.