skills/missing-authentication-anti-pattern/SKILL.md
Security anti-pattern for missing or broken authentication (CWE-287). Use when generating or reviewing code for login systems, API endpoints, protected routes, or access control. Detects unprotected endpoints, weak password policies, and missing rate limiting on authentication.
npx skillsauth add igbuend/grimbard missing-authentication-anti-patternInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Severity: Critical
Missing or broken authentication occurs when applications fail to verify user identity, allowing unauthorized access to protected data and functionality. This manifests as unprotected endpoints, missing session checks, or weak credential verification vulnerable to bypass or brute-force. AI-generated code frequently produces insecure boilerplate with stubbed or missing authentication checks.
Never create endpoints accessing sensitive data or functionality without verifying user identity and validating active sessions.
# VULNERABLE: Critical API endpoint without authentication check
from flask import request, jsonify
from db import User, session
@app.route("/api/users/<int:user_id>/profile")
def get_user_profile(user_id):
# Takes user ID and returns profile data
# CRITICAL FLAW: Never checks who makes the request
# Any user can access any profile by changing user_id in URL
user = session.query(User).filter_by(id=user_id).first()
if not user:
return jsonify({"error": "User not found"}), 404
# Returns sensitive profile information without verification
return jsonify({
"id": user.id,
"username": user.username,
"email": user.email,
"signed_up_at": user.created_at
})
# SECURE: Endpoint protected by authentication and authorization
from flask import request, jsonify
from db import User, session
from auth import require_authentication # Decorator for auth
@app.route("/api/users/<int:user_id>/profile")
@require_authentication # Ensures valid user session exists
def get_user_profile_secure(current_user, user_id):
# `require_authentication` decorator decodes session token (JWT)
# and passes authenticated user object to function
# AUTHORIZATION CHECK:
# Verify user can access this data
# Users see only their own profile unless admin
if current_user.id != user_id and not current_user.is_admin:
return jsonify({"error": "Access denied. You are not authorized to view this profile."}), 403
user = session.query(User).filter_by(id=user_id).first()
if not user:
return jsonify({"error": "User not found"}), 404
# Safe to return data after authentication and authorization
return jsonify({
"id": user.id,
"username": user.username,
"email": user.email,
"signed_up_at": user.created_at
})
rg '@app\.route|@router\.(get|post)' --type py -A 5 | rg -v '@require|@login|@auth'rg 'app\.(get|post|put|delete)\(' --type js -A 3 | rg -v 'authenticate|isAuth'rg '@GetMapping|@PostMapping' --type java -A 3 | rg -v '@PreAuthorize|@Secured'rg '/admin|/api/users|/profile|/account|/payment' -irg 'if.*not.*authenticated.*return|except.*pass' --type pyrg 'catch.*\{\s*\}|if.*!auth.*continue' --type jscurl -X GET https://api.example.com/api/users/me (no auth header)curl -X DELETE https://api.example.com/api/admin/users/1 (no token)development
Security anti-pattern for Cross-Site Scripting vulnerabilities (CWE-79). Use when generating or reviewing code that renders HTML, handles user input in web pages, uses innerHTML/document.write, or builds dynamic web content. Covers Reflected, Stored, and DOM-based XSS. AI code has 86% XSS failure rate.
development
Security anti-pattern for XPath injection vulnerabilities (CWE-643). Use when generating or reviewing code that queries XML documents, constructs XPath expressions, or handles user input in XML operations. Detects unescaped quotes and special characters in XPath queries.
development
Security anti-pattern for weak password hashing (CWE-327, CWE-759). Use when generating or reviewing code that stores or verifies user passwords. Detects use of MD5, SHA1, SHA256 without salt, or missing password hashing entirely. Recommends bcrypt, Argon2, or scrypt.
development
Security anti-pattern for weak encryption (CWE-326, CWE-327). Use when generating or reviewing code that encrypts data, handles encryption keys, or uses cryptographic modes. Detects DES, ECB mode, static IVs, and custom crypto implementations.