mcpbeat Sign in

Springboot Security Skill for Claude

Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
265
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/loulanyue/awesome-claude-notes --skill springboot-security

The instruction itself

4 sections, as written by the author

Spring Boot セキュリティレビュー

認証の追加、入力処理、エンドポイント作成、またはシークレット処理時に使用します。

認証

  • ステートレスJWTまたは失効リスト付き不透明トークンを優先
  • セッションには httpOnlySecureSameSite=Strict クッキーを使用
  • OncePerRequestFilter またはリソースサーバーでトークンを検証
@Component
public class JwtAuthFilter extends OncePerRequestFilter {
  private final JwtService jwtService;

  public JwtAuthFilter(JwtService jwtService) {
    this.jwtService = jwtService;
  }

  @Override
  protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
      FilterChain chain) throws ServletException, IOException {
    String header = request.getHeader(HttpHeaders.AUTHORIZATION);
    if (header != null && header.startsWith("Bearer ")) {
      String token = header.substring(7);
      Authentication auth = jwtService.authenticate(token);
      SecurityContextHolder.getContext().setAuthentication(auth);
    }
    chain.doFilter(request, response);
  }
}

認可

  • メソッドセキュリティを有効化: @EnableMethodSecurity
  • @PreAuthorize("hasRole('ADMIN')") または @PreAuthorize("@authz.canEdit(#id)") を使用
  • デフォルトで拒否し、必要なスコープのみ公開

入力検証

  • @Valid を使用してコントローラーでBean Validationを使用
  • DTOに制約を適用: @NotBlank@Email@Size、カスタムバリデーター
  • レンダリング前にホワイトリストでHTMLをサニタイズ

SQLインジェクション防止

  • Spring Dataリポジトリまたはパラメータ化クエリを使用
  • ネイティブクエリには :param バインディングを使用し、文字列を連結しない

CSRF保護

  • ブラウザセッションアプリの場合はCSRFを有効にし、フォーム/ヘッダーにトークンを含める
  • Bearerトークンを使用する純粋なAPIの場合は、CSRFを無効にしてステートレス認証に依存
http
  .csrf(csrf -> csrf.disable())
  .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS));

シークレット管理

  • ソースコードにシークレットを含めない。環境変数またはvaultから読み込む
  • application.yml を認証情報から解放し、プレースホルダーを使用
  • トークンとDB認証情報を定期的にローテーション

セキュリティヘッダー

http
  .headers(headers -> headers
    .contentSecurityPolicy(csp -> csp
      .policyDirectives("default-src 'self'"))
    .frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)
    .xssProtection(Customizer.withDefaults())
    .referrerPolicy(rp -> rp.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.NO_REFERRER)));

レート制限

  • 高コストなエンドポイントにBucket4jまたはゲートウェイレベルの制限を適用
  • バーストをログに記録してアラートを送信し、リトライヒント付きで429を返す

依存関係のセキュリティ

  • CIでOWASP Dependency Check / Snykを実行
  • Spring BootとSpring Securityをサポートされているバージョンに保つ
  • 既知のCVEでビルドを失敗させる

ロギングとPII

  • シークレット、トークン、パスワード、完全なPANデータをログに記録しない
  • 機密フィールドを編集し、構造化JSONロギングを使用

ファイルアップロード

  • サイズ、コンテンツタイプ、拡張子を検証
  • Webルート外に保存し、必要に応じてスキャン

リリース前チェックリスト

  • [ ] 認証トークンが正しく検証され、期限切れになっている
  • [ ] すべての機密パスに認可ガードがある
  • [ ] すべての入力が検証およびサニタイズされている
  • [ ] 文字列連結されたSQLがない
  • [ ] アプリケーションタイプに対してCSRF対策が正しい
  • [ ] シークレットが外部化され、コミットされていない
  • [ ] セキュリティヘッダーが設定されている
  • [ ] APIにレート制限がある
  • [ ] 依存関係がスキャンされ、最新である
  • [ ] ログに機密データがない

注意: デフォルトで拒否し、入力を検証し、最小権限を適用し、設定によるセキュリティを優先します。

原文

  • 英語版の原文

ナビゲーション

  • 日本語ドキュメント一覧
  • skills/README.md
  • 貢献ガイド

Other skills for the same job

different authors, same section of the catalogue
Backend Security Coder
by ComeOnOliver
×2

Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.

5k tokens
Cloud Penetration Testing
by ComeOnOliver
×2

This skill should be used when the user asks to "perform cloud penetration testing", "assess Azure or AWS or GCP security", "enumerate cloud resources", "exploit cloud misconfigurations", "test O365 security", "extract secrets from cloud environments", or "audit cloud infrastructure". It provides comprehensive techniques for security assessment across major cloud platforms.

16k tokens
Codebase Cleanup Deps Audit
by ComeOnOliver
×2

You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.

10k tokens
Flow Nexus Platform
by ComeOnOliver
×2

Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges

14k tokens
Linux Privilege Escalation
by ComeOnOliver
×2

This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.

8k tokens
Malware Analyst
by ComeOnOliver
×2

Expert malware analyst specializing in defensive malware research, threat intelligence, and incident response. Masters sandbox analysis, behavioral analysis, and malware family identification. Handles static/dynamic analysis, unpacking, and IOC extraction. Use PROACTIVELY for malware triage, threat hunting, incident response, or security research.

4k tokens
Metasploit Framework
by ComeOnOliver
×2

This skill should be used when the user asks to "use Metasploit for penetration testing", "exploit vulnerabilities with msfconsole", "create payloads with msfvenom", "perform post-exploitation", "use auxiliary modules for scanning", or "develop custom exploits". It provides comprehensive guidance for leveraging the Metasploit Framework in security assessments.

7k tokens
Mobile Security Coder
by ComeOnOliver
×2

Expert in secure mobile coding practices specializing in input validation, WebView security, and mobile-specific security patterns. Use PROACTIVELY for mobile security implementations or mobile security code reviews.

6k tokens

How to use it

Copy the folder

Take loulanyue/springboot-security from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.