affaan-m/ECC/docs/ja-JP/skills/springboot-security/SKILL.md
springboot-security
Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.
- Source repository stars
- 234,327
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-07-27
- Source checked
- 2026-07-28
Decision brief
What it does—and where it fits
認証の追加、入力処理、エンドポイント作成、またはシークレット処理時に使用します。
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/springboot-security"Inspect the Agent Skill "springboot-security" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/ja-JP/skills/springboot-security/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
認証
ステートレスJWTまたは失効リスト付き不透明トークンを優先
ステートレスJWTまたは失効リスト付き不透明トークンを優先セッションには httpOnly、Secure、SameSite=Strict クッキーを使用OncePerRequestFilter またはリソースサーバーでトークンを検証 - 02
認可
メソッドセキュリティを有効化: @EnableMethodSecurity
メソッドセキュリティを有効化: @EnableMethodSecurity@PreAuthorize("hasRole('ADMIN')") または @PreAuthorize("@authz.canEdit(id)") を使用デフォルトで拒否し、必要なスコープのみ公開 - 03
入力検証
@Valid を使用してコントローラーでBean Validationを使用
@Valid を使用してコントローラーでBean Validationを使用DTOに制約を適用: @NotBlank、@Email、@Size、カスタムバリデーターレンダリング前にホワイトリストでHTMLをサニタイズ
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 63/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 234,327 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | catalog record | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- affaan-m/ECC
- Skill path
- docs/ja-JP/skills/springboot-security/SKILL.md
- Commit
- 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
- License
- MIT
- Collected
- 2026-07-28
- Default branch
- main
View the original SKILL.md
Spring Boot セキュリティレビュー
認証の追加、入力処理、エンドポイント作成、またはシークレット処理時に使用します。
認証
- ステートレスJWTまたは失効リスト付き不透明トークンを優先
- セッションには
httpOnly、Secure、SameSite=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にレート制限がある
- 依存関係がスキャンされ、最新である
- ログに機密データがない
注意: デフォルトで拒否し、入力を検証し、最小権限を適用し、設定によるセキュリティを優先します。
Alternatives
Compare before choosing
affaan-m/ECC
springboot-security
Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.
affaan-m/ECC
springboot-security
Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.
affaan-m/ECC
springboot-security
Buenas prácticas de Spring Security para autenticación/autorización, validación, CSRF, secretos, cabeceras, limitación de velocidad y seguridad de dependencias en servicios Java Spring Boot.
affaan-m/ECC
springboot-security
Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.