Java Security Anti-Patterns Guard

VerifiedSafe

Prevents OWASP Top 10 vulnerabilities in Java web applications using Spring Boot or Jakarta EE.

Sby Skills Guide Bot
SecurityIntermediate
7/22/2026
Claude CodeCursorWindsurf
#java#owasp-top-10#secure-coding#spring-boot#code-generation

Recommended for

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.
When to use it

Use it when generating or reviewing Java web/API code that handles input, authentication, SQL queries, files, or serialization.

When not to use it

Avoid it for non-Java stacks or for a complete security audit and penetration test of an existing system.

Security analysis

Safe
Quality score88/100

The 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 made

Examples

Secure REST endpoint
Generate a Spring Boot REST endpoint that accepts an account ID and returns account details. Include proper authentication and resource ownership checks.
SQL injection review
Review this JPA repository method for SQL injection risk and rewrite it using named parameters or a safe Criteria query.
Safe file upload
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)

  1. NEVER concatenate strings into SQL queries - use PreparedStatement or JPA named parameters
  2. NEVER use ObjectInputStream.readObject() on untrusted data - use JSON with validation
  3. NEVER use Runtime.exec() with user input - use ProcessBuilder with argument list
  4. NEVER use java.util.Random for security - use SecureRandom
  5. NEVER use MD5/SHA1 for passwords - use BCrypt or Argon2
  6. NEVER hardcode secrets - use environment variables or secret managers
  7. NEVER disable CSRF without understanding the risk - keep enabled for browser clients
  8. NEVER trust user-supplied file paths - normalize and validate with Path.resolve() + startsWith()
  9. ALWAYS verify resource ownership (BOLA) - check userId before returning data
  10. 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

  1. During code generation: Reference relevant module for specific vulnerability patterns
  2. Code review: Check generated code against patterns in each module
  3. 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 files

This 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.md

From 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 installation
openskills 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 sync

Manual 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.

Related skills