Sharp Edges: Finding Security Footguns in APIs Through a Design-Review Lens

Introduction

Many security issues stem not from a specific line of incorrect implementation, but from interfaces that designate the “path of least resistance” as the insecure path: optional weak algorithms, default values that disable validation, or verify functions that return booleans but are ignored. Regular code reviews often focus on logic loopholes but rarely systematically ask, “What happens with timeout=0?” or “Will an empty key pass directly?”

Below, we introduce sharp-edges, an Agent Skill maintained by Trail of Bits. It focuses on assessing the misuse resistance of APIs, configurations, and library interfaces. It treats the “pit of success” as its core standard: the secure usage path should be the one with the least resistance, rather than just a warning in the documentation.

What is this

sharp-edges is an Agent Skill located in the Trail of Bits skills repository. To summarize in one sentence: it identifies API designs, dangerous configurations, and footgun interfaces that easily lead developers into traps.

The trigger scenarios listed in the Skill metadata include: footgun, misuse-resistant, secure defaults, API usability, and dangerous configuration. The applicable targets include API design reviews, configuration schema audits, cryptographic library ergonomics, and judgments on adherence to secure-by-default / pit of success principles.

Unlike reviews that “hunt for implementation bugs,” this tool is explicitly positioned by the developers as a design-layer analysis: implementation defects, business logic flaws, and performance optimization should be handled through other paths and should not be replaced by this Skill.

Within Trail of Bits’ security Skill series, its rare value lies in the design review perspective. For authors writing public APIs, configuration schemas, or encapsulating cryptographic capabilities, it offers more structural inspiration than a stack of checklists.

Core Functions

Core Principles

Pit of success: Secure usage should be the path of least resistance. If developers must master cryptography, read documentation meticulously, or remember special rules to avoid vulnerabilities, the API has already failed by design.

Six Categories of Sharp Edges

The official SKILL categorizes common footguns into six types (the capabilities and examples below are derived from official documentation):

  1. Algorithm / Mode Selection Footguns
    Allowing callers to choose algorithm, cipher, hash_type, etc., easily leads to selecting weak algorithms or encountering algorithm confusion (such as alg: none in JWT, or mixing RS256/HS256). Detection points include enum/string primitive selection and security configuration items.

  2. Dangerous Defaults
    Defaults that are insecure, or where the semantics of 0, empty strings, or null are unclear, thereby disabling security capabilities. Typical probes include: what is the behavior when timeout=0, max_attempts=0, or key=""; is the default the safest option?

  3. Primitive APIs vs. Semantic APIs
    Using raw bytes/string to carry distinct concepts like keys, nonces, and ciphertexts, allowing parameters to be interchangeable without type errors. This contrasts Libsodium-style primitives with Halite-style typed wrappers. It also includes comparisons of “things that look the same but have different security properties” (such as standard == vs. hmac.Equal in Go).

  4. Configuration Cliffs
    A single misconfiguration causes catastrophic failure without warning: boolean switches turning off all security, unvalidated string configurations, dangerous combinations being silently accepted, environment variables overriding security items, or constructors having secure defaults but still accepting unsafe arguments.

  5. Silent Failures
    Security failures that do not throw, returning True to mask errors, using default values upon parsing failure, or verification functions “succeeding” on malformed input. Boolean return values are easily ignored.

  6. Stringified Security Semantics
    Expressing permissions, roles, URLs, SQL, etc., using concatenated strings, which are prone to injection or privilege accumulation errors. This is contrasted with enums/type-safe collections.

Rationalizations to Reject

The official table lists common excuses and directions for response, for example: “It is written in the documentation” → Security choices should be made the default or only option; “Advanced users need flexibility” → Provide secure high-level APIs, hide primitives; “It is just a config item” → Validate and reject dangerous combinations. When writing review reports, use this as a checklist to avoid leaving footguns on the path with the highest error rates.

Analysis Workflow and Specialized Agent

The complete process is divided into four stages: Surface Identification (mapping security-related APIs and developer choice points), Edge Case Probing (conducting boundary probes for each choice point), Threat Modeling, and Validate Findings.

When needing to run an independent, end-to-end pass, you can use the sharp-edges-analyzer agent; it executes autonomously according to the four stages above and reads language-specific references as needed.

The tools declared available by the Skill are: Read, Grep, Glob (for reading code and configurations within the repository, not a replacement for dynamic penetration testing).

Installation and Enabling

The instructions on officialskills.sh provide the following command. Add the Skill from the Trail of Bits monorepo by the name sharp-edges:

npx skills add https://github.com/trailofbits/skills --skill sharp-edges

You can also provide the repository link to your coding assistant and request the installation of the corresponding Skill:

https://github.com/trailofbits/skills/tree/main/plugins/sharp-edges

Specific menu or configuration file differences in Cursor, Codex CLI, and Claude Code are not currently listed item-by-item in public materials; please refer to the documentation for “Agent Skills / npx skills” in the client you are using.

Typical Usage

The official When to Use section and the skills.sh page summarize reproducible trigger methods (natural language descriptions of tasks are sufficient, no fixed “spells” are needed):

  • Review the API of a cryptographic library for algorithm selection footguns (e.g., accepting none, md5).
  • Review constructors: even if secure defaults exist, do they still accept unsafe arguments (e.g., otpLifetime=0, hashAlgo=md5).
  • Audit configuration schemas: whether 0, null, or negative values silently disable security features.
  • Evaluate whether JWT or session token APIs expose security decisions like algorithms to untrusted input.
  • Identify difficult-to-distinguish timing-safe comparisons versus unsafe comparisons at call sites.

When a systematic report is needed, explicitly request the enabling of sharp-edges-analyzer to output findings according to the four-stage workflow, and validate whether conclusions are actionable against the six categories and the “Rationalizations to Reject” table (defaulting to security, validating dangerous combinations, typed semantics, etc.).

Example probing ideas (from official Edge Case Probing): ask follow-up questions about boundary value semantics for each choice point, consistent with patterns in the documentation such as OTP lifetime=0 or skipping signature verification with an empty key.

Applicable Scenarios and Notes

Suitable for:

  • Design reviews for APIs or libraries, configuration schema audits.
  • Ergonomics assessment of authentication/authorization interfaces, session management, and input validation boundaries.
  • Judging whether new interfaces default to the path where “easy to misuse equals insecure.”

Not suitable for (Official When NOT to Use):

  • Implementation-layer bugs (use standard code review).
  • Business logic defects (use domain analysis).
  • Performance optimization (a separate concern).

Note: This Skill is a structured misuse and footgun analysis tool. It does not replace all aspects of a threat modeling toolchain, nor does it guarantee coverage of all language runtime details; for deep dives, refer to references/ within the repository (such as config-patterns.md), which the agent loads as needed.

Conclusion

If your work involves exposing security-related choices to the outside world (algorithms, timeouts, switches, key forms), sharp-edges turns “Is the default the safest? Do boundary values turn off security? Is the easy path the insecure path?” into a repeatable checklist, accompanied by the sharp-edges-analyzer and a four-stage workflow. Official Skill and source code path:

https://github.com/trailofbits/skills/tree/main/plugins/sharp-edges/skills/sharp-edges

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye