security-hardening

Applies OWASP Top 10 mitigations, CORS, rate limiting, and secret management to Spring Boot services.

Updated Jun 25, 2026
One-click install
npx skills add https://github.com/oriddd/ai-toolkit --skill security-hardening-oriddd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-hardening
Source: https://github.com/oriddd/ai-toolkit/tree/main/copilot/public/skills/security-hardening
Command: npx skills add https://github.com/oriddd/ai-toolkit --skill security-hardening-oriddd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Public-facing Spring Boot services are exposed to injection, misconfiguration, vulnerable dependencies, and leaked secrets, and teams often address these risks inconsistently across projects. ## Core Features & Use Cases - OWASP Top 10 Checklist for Spring Boot: Maps each risk (broken access control, injection, SSRF, and more) to concrete mitigations such as parameterized JPA queries, ArchUnit rules, and outbound host allow-lists. - Defense-in-depth Configuration: Provides ready patterns for input validation at every layer, deny-by-default CORS, bucket4j rate limiting, security response headers, and Actuator endpoint lockdown. - Supply Chain & Secrets Security: Covers dependency scanning with dependency-check-maven and Trivy, cosign image signing, SBOM generation, and secret management via Vault or cloud secret stores. - Use Case: Before exposing a new REST endpoint that handles customer data, apply this skill to add validation annotations, restrict CORS origins, configure rate limits, and verify CI fails on CVSS 7.0+ vulnerabilities. ## Quick Start Apply the security-hardening skill to review this Spring Boot service and add input validation, CORS restrictions, rate limiting, and security headers.

Frequently Asked Questions about security-hardening

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure a Spring Boot REST API against OWASP Top 10?

Map each OWASP risk to a concrete control: parameterized JPA queries for injection, an OAuth2 resource server with JWK rotation for authentication, ArchUnit rules for access control, and dependency scanning for vulnerable components. Validate input at controller, service, and database layers.

How to configure CORS in Spring Boot securely?

Default to denying all cross-origin requests, then register a CorsConfigurationSource that allows only explicit front-end origins, specific methods, and headers like Authorization and Idempotency-Key. Never use wildcard origins when allowCredentials is true.

What rate limiting library works with Spring Boot?

The bucket4j-spring-boot-starter integrates rate limiting via configuration, defining per-route bandwidth capacities such as 100 requests per minute. Exceeded limits return 429 Too Many Requests with a Retry-After header; ingress-level limiters like Kong or Envoy are alternatives.

How do I manage secrets in a Spring Boot application?

Never store secrets in application.yaml or container images. Inject them as environment variables sourced from Kubernetes Secrets backed by Vault or AWS Secrets Manager, use TLS in transit, and rotate credentials on a schedule with @RefreshScope or container restarts.

Which Actuator endpoints are safe to expose in production?

Expose only health, info, and prometheus via management.endpoints.web.exposure.include. Never expose env, beans, or heapdump in production, and restrict health details to authorized users with the ACTUATOR role.

How do I scan Spring Boot dependencies for vulnerabilities in CI?

Combine Renovate for automated upgrades with dependency-check-maven to fail builds on CVEs scoring CVSS 7.0 or higher. Scan container images with Trivy or Grype, sign them with cosign, and attach an SBOM generated by syft.