Automated summary
A code-generation guard that steers Java (Spring Boot, Jakarta EE, JPA) code away from OWASP Top 10 vulnerabilities while it is written.
Strengths
- Concrete never/always rules for SQL injection, deserialization, command execution, cryptography, and secrets.
- Covers OWASP Top 10 Web 2025 and API Security 2023 with CWE references.
- Modular reference index by area (injection, authentication, validation, files, Spring Security, dependencies) so the right control can be targeted.
- Clear activation triggers tied to user input, database access, authentication, file handling, and serialization.
Limitations
- Offers prevention guidance during generation, not static analysis or runtime protection.
- Focused on Java/Spring/Jakarta EE; does not cover other languages or frameworks.
- Effectiveness depends on the agent following the rules; it does not by itself detect vulnerabilities already present in a codebase.
Use it when generating or reviewing Java web/API code that handles input, authentication, SQL queries, files, or serialization.
Avoid it for non-Java stacks or for a complete security audit and penetration test of an existing system.
Security analysis
SafeThe skill is a defensive Java security guidance file with only Read permission declared. It contains no destructive commands, network exfiltration, obfuscated payloads, secret handling, or instructions to disable safety controls; it explicitly recommends secure coding practices.
No concerns found
How this analysis is madeExamples
Generate a Spring Boot REST endpoint that accepts an account ID and returns account details. Include proper authentication and resource ownership checks.Review this JPA repository method for SQL injection risk and rewrite it using named parameters or a safe Criteria query.Add file upload handling to my Jakarta EE servlet with validation and path traversal protection.name: security-antipatterns-java description: Use when generating Java code for web applications, APIs, or enterprise systems - prevents OWASP Top 10 vulnerabilities in Spring Boot, Jakarta EE, and core Java version: "1.0.0" allowed-tools: "Read" metadata: short-description: Prevents OWASP Top 10 vulnerabilities in Java/Spring applications
Security Anti-Patterns Guard for Java
Overview
Code generation guard that prevents security vulnerabilities while writing Java web application code. Covers OWASP Top 10 Web (2025), OWASP API Security Top 10 (2023), with CWE references throughout.
Stack: Java 11/17/21, Spring Boot, Spring Security, Jakarta EE, Hibernate, JPA
Java Version Focus:
- Java 17 (primary target - ~35% usage)
- Java 11 (secondary - ~33% usage)
- Java 21 (latest LTS - growing adoption)
When to Activate
Activate when generating code that:
- Handles user input (forms, API requests, file uploads)
- Queries databases (JDBC, JPA, Hibernate)
- Performs authentication or authorization
- Manages sessions or JWT tokens
- Processes files or paths
- Serializes/deserializes data (ObjectInputStream, XML, JSON)
- Uses cryptographic operations
- Executes system commands or processes
- Configures Spring Security or Jakarta EE security
Critical Rules (Top 10)
- NEVER concatenate strings into SQL queries - use
PreparedStatementor JPA named parameters - NEVER use
ObjectInputStream.readObject()on untrusted data - use JSON with validation - NEVER use
Runtime.exec()with user input - useProcessBuilderwith argument list - NEVER use
java.util.Randomfor security - useSecureRandom - NEVER use MD5/SHA1 for passwords - use BCrypt or Argon2
- NEVER hardcode secrets - use environment variables or secret managers
- NEVER disable CSRF without understanding the risk - keep enabled for browser clients
- NEVER trust user-supplied file paths - normalize and validate with
Path.resolve()+startsWith() - ALWAYS verify resource ownership (BOLA) - check
userIdbefore returning data - ALWAYS validate input at API boundaries - use Bean Validation annotations
Module Index
| Module | Focus | Key Vulnerabilities | |--------|-------|---------------------| | references/injection.md | SQL, Command, LDAP, XPath, JPQL | CWE-89, CWE-78, CWE-90, CWE-643 | | references/deserialization.md | ObjectInputStream, XXE, JSON/YAML | CWE-502, CWE-611 | | references/xss-output.md | XSS, template escaping, JSP/Thymeleaf | CWE-79 | | references/auth-access.md | BOLA, BFLA, sessions, JWT | CWE-862, CWE-863, CWE-287 | | references/crypto-secrets.md | Secrets, hashing, encryption | CWE-798, CWE-327, CWE-916 | | references/input-validation.md | Bean Validation, forms, uploads | CWE-20, CWE-434, CWE-915 | | references/file-operations.md | Path traversal, temp files, NIO | CWE-22, CWE-377 | | references/spring-security.md | CSRF, CORS, method security, actuators | Spring-specific | | references/jakarta-ee.md | Servlet security, EJB, JAX-RS | Jakarta EE-specific | | references/dependencies.md | Maven/Gradle audit, supply chain | CWE-1104, CWE-1357 | | references/java-runtime.md | Reflection, ReDoS, ScriptEngine | CWE-94, CWE-1333 |
Quick Decision Tree
User input involved?
├─ Database query → See references/injection.md (use PreparedStatement/JPA named params)
├─ File path → See references/file-operations.md (use Path.resolve() + startsWith check)
├─ Command execution → See references/injection.md (ProcessBuilder with list args)
├─ Deserialization → See references/deserialization.md (NEVER ObjectInputStream on untrusted)
├─ Template rendering → See references/xss-output.md (use th:text not th:utext)
└─ API endpoint → See references/auth-access.md + references/input-validation.md
Storing/generating secrets?
├─ API keys → See references/crypto-secrets.md (env vars or Vault)
├─ Passwords → See references/crypto-secrets.md (BCrypt/Argon2)
└─ Tokens → See references/crypto-secrets.md (SecureRandom)
Framework-specific?
├─ Spring Boot → See references/spring-security.md
├─ Jakarta EE → See references/jakarta-ee.md
└─ Core Java → See references/java-runtime.md
How to Use This Skill
- During code generation: Reference relevant module for specific vulnerability patterns
- Code review: Check generated code against patterns in each module
- When uncertain: Default to the more secure option; add explicit comments explaining security decisions
Sources
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/java-security-anti-patterns-guard-mrwakbaf/download' --output '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md.part' && mv '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md.part' '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md' && test -s '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/security-antipatterns-java' && cp -R '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf' '.claude/skills/security-antipatterns-java'Cursor
test -f '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md' && test -s '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/security-antipatterns-java' && cp -R '.skill-downloads/java-security-anti-patterns-guard-mrwakbaf' '.cursor/skills/security-antipatterns-java'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/java-security-anti-patterns-guard-mrwakbaf'openskills read 'java-security-anti-patterns-guard-mrwakbaf'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/java-security-anti-patterns-guard-mrwakbaf/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
DeFi AMM Security
Security
Security checklist for Solidity AMM contracts, liquidity pools, and swap flows. Covers reentrancy, donation attacks, oracle manipulation, slippage, and integer math.
Semgrep Rule Creator
Security
Creates custom Semgrep rules for detecting security vulnerabilities, bug patterns, and code patterns. Includes test-first methodology, taint mode support, and validation steps. Helps when building targeted static analysis detections.
Dev Toolbar Review Guide
Security
Safety rules for the dev toolbar, PostHog client, and feature flags. Use when reviewing changes to dev-tools and related files, covering environment guards, override cookies, and SSE stream safety.