Overview
Sharp Edges analyzes code and designs through the lens of three adversaries:- The Scoundrel - Can a malicious developer or attacker disable security via configuration?
- The Lazy Developer - Will copy-pasting the first example lead to insecure code?
- The Confused Developer - Can parameters be swapped without type errors?
Core Principle: The Pit of SuccessSecure usage should be the path of least resistance. If developers must read documentation carefully or remember special rules to avoid vulnerabilities, the API has failed.
Installation
When to Use
Use this plugin when:- Reviewing API designs for security-relevant interfaces
- Auditing configuration schemas that expose security choices
- Evaluating cryptographic library ergonomics
- Assessing authentication/authorization APIs
- Any code review where developers make security-critical decisions
Sharp Edge Categories
The skill identifies six categories of misuse-prone designs:1. Algorithm Selection Footguns
1. Algorithm Selection Footguns
APIs that let developers choose algorithms invite choosing wrong ones.The JWT Pattern (canonical example):
- Header specifies algorithm: attacker can set
"alg": "none"to bypass signatures - Algorithm confusion: RSA public key used as HMAC secret when switching RS256→HS256
- Root cause: Letting untrusted input control security-critical decisions
2. Dangerous Defaults
2. Dangerous Defaults
Defaults that are insecure, or zero/empty values that disable security.Detection patterns:
- Timeouts/lifetimes that accept 0 (infinite? immediate expiry?)
- Empty strings that bypass checks
- Null values that skip validation
- Boolean defaults that disable security features
- What happens with
timeout=0?max_attempts=0?key=""? - Is the default the most secure option?
- Can any default value disable security entirely?
3. Primitive vs. Semantic APIs
3. Primitive vs. Semantic APIs
APIs that expose raw bytes instead of meaningful types invite type confusion.The Libsodium vs. Halite Pattern:
4. Configuration Cliffs
4. Configuration Cliffs
One wrong setting creates catastrophic failure, with no warning.Examples:
5. Silent Failures
5. Silent Failures
Errors that don’t surface, or success that masks failure.Detection patterns:
- Functions returning booleans instead of throwing on security failures
- Empty catch blocks around security operations
- Default values substituted on parse errors
- Verification functions that “succeed” on malformed input
6. Stringly-Typed Security
6. Stringly-Typed Security
Security-critical values as plain strings enable injection and confusion.Detection patterns:
- SQL/commands built from string concatenation
- Permissions as comma-separated strings
- Roles/scopes as arbitrary strings instead of enums
- URLs constructed by joining strings
Analysis Workflow
Phase 1: Surface Identification
- Map security-relevant APIs: authentication, authorization, cryptography, session management, input validation
- Identify developer choice points: Where can developers select algorithms, configure timeouts, choose modes?
- Find configuration schemas: Environment variables, config files, constructor parameters
Phase 2: Edge Case Probing
For each choice point, ask:Zero/Empty/Null
What happens with
0, "", null, []?Negative Values
What does
-1 mean? Infinite? Error?Type Confusion
Can different security concepts be swapped?
Default Values
Is the default secure? Is it documented?
Phase 3: Threat Modeling
Consider three adversaries:| Adversary | Threat Model |
|---|---|
| The Scoundrel | Actively malicious developer or attacker controlling config. Can they disable security via configuration? Can they downgrade algorithms? Can they inject malicious values? |
| The Lazy Developer | Copy-pastes examples, skips documentation. Will the first example they find be secure? Is the path of least resistance secure? Do error messages guide toward secure usage? |
| The Confused Developer | Misunderstands the API. Can they swap parameters without type errors? Can they use the wrong key/algorithm/mode by accident? Are failure modes obvious or silent? |
Phase 4: Validate Findings
For each identified sharp edge:- Reproduce the misuse: Write minimal code demonstrating the footgun
- Verify exploitability: Does the misuse create a real vulnerability?
- Check documentation: Is the danger documented?
- Test mitigations: Can the API be used safely with reasonable effort?
Severity Classification
| Severity | Criteria | Examples |
|---|---|---|
| Critical | Default or obvious usage is insecure | verify: false default; empty password allowed |
| High | Easy misconfiguration breaks security | Algorithm parameter accepts “none” |
| Medium | Unusual but possible misconfiguration | Negative timeout has unexpected meaning |
| Low | Requires deliberate misuse | Obscure parameter combination |
Rationalizations to Reject
Language-Specific Guides
The plugin includes detailed language-specific footgun catalogs:C/C++
Memory safety, integer overflow, format strings
Go
Error handling, crypto API misuse
Rust
Unsafe blocks, FFI boundaries
Java/Kotlin
Serialization, crypto defaults
C#
XML parsing, crypto modes
PHP
Type juggling, hash algorithms
JavaScript/TypeScript
eval(), prototype pollutionPython
pickle, YAML deserializeRuby
Marshal.load, symbol DoSRelated Skills
Constant-Time Analysis
Detect timing side-channels in cryptographic code
Differential Review
Security-focused code change review
Quality Checklist
Before concluding analysis:- Probed all zero/empty/null edge cases
- Verified defaults are secure
- Checked for algorithm/mode selection footguns
- Tested type confusion between security concepts
- Considered all three adversary types
- Verified error paths don’t bypass security
- Checked configuration validation
- Constructor params validated (not just defaulted)