Insecure Design
The feature itself is unsafe, even if the code has no bugs.
What it is
Some problems are in the plan, not the code: a password reset with no rate limit, a coupon that can be applied twice, a security question anyone can look up. Fixing a typo won't help. The flow has to change.
What can happen
- Brute force on login or reset codes.
- Business-logic abuse (free items, negative quantities).
- Missing limits that make denial of service easy.
Example: Login without a limit
// Unlimited tries: a 6-digit code falls in minutes.
router.post("/login", loginHandler);import rateLimit from "express-rate-limit";
const loginLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
limit: 10, // per IP
});
router.post("/login", loginLimiter, loginHandler);Ask "what if someone does this 10,000 times?" for every feature while you design it.
How to prevent it
- Threat-model each feature: who could abuse it, and how?
- Rate-limit anything that checks a secret.
- Validate business rules on the server (prices, quantities, states).
- Reuse proven patterns instead of inventing your own.
What CrimsonScan checks
Needs a code reviewNot detectable automatically. Design flaws need a human to review the flow. CrimsonScan's own rate limits and one-active-scan rule are examples of design-level fixes.