Agent skill

Laravel Security

by affaan-m in affaan-m/ECC

Laravel セキュリティベストプラクティス:認証・認可、バリデーション、CSRF、一括割当、ファイルアップロード、シークレット管理、レート制限、安全なデプロイメント

MITAuto-check passedBackend & APIs

Install Laravel Security

skills CLI
$ npx skills add affaan-m/ECC --skill laravel-security -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC laravel-security --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/ja-JP/skills/laravel-security .claude/skills/laravel-security && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
laravel-security
GitHub stars
276k
Token cost
~1.5k tokens
SKILL.md length
148 words
Files
1
Skills in repo
683
Repo updated
First seen
Licence
MIT

At a glance

Laravel セキュリティベストプラクティス:認証・認可、バリデーション、CSRF、一括割当、ファイルアップロード、シークレット管理、レート制限、安全なデプロイメント

  • Tasks that involve Backend development
  • SKILL.md covers アクティベートする時機, 仕組み, コアセキュリティ設定 and セッションとクッキーの強化, plus 17 more sections
  • Calls composer; needs APP_KEY
  • Tasks that involve Web application vulnerabilities

What it does

Laravel Security is an agent skill from affaan-m/ECC. Laravel セキュリティベストプラクティス:認証・認可、バリデーション、CSRF、一括割当、ファイルアップロード、シークレット管理、レート制限、安全なデプロイメント

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Backend development and Web application vulnerabilities. It works with Laravel. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve Backend development
  • Tasks that involve Web application vulnerabilities

Example prompts

  • “/laravel-security”

Requirements

  • A credential in APP_KEY

What it can do on your machine

Read from SKILL.md and the folder at commit 4eb71d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • composer

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • APP_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Laravel Security loads about 1.5k tokens when it runs. Until then it costs about 25 tokens; SKILL.md has 148 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~25
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit 4eb71d9, republished under its MIT licence (© affaan-m). 148 words, ~1,485 tokens.

Download SKILL.mdSave it as .claude/skills/laravel-security/SKILL.md (or your agent's skills folder).
name
laravel-security
description
Laravel セキュリティベストプラクティス:認証・認可、バリデーション、CSRF、一括割当、ファイルアップロード、シークレット管理、レート制限、安全なデプロイメント
origin
ECC

Laravel セキュリティベストプラクティス

Laravel アプリケーションを一般的な脆弱性から守るための包括的なセキュリティガイダンス。

アクティベートする時機

  • 認証または認可を追加する場合
  • ユーザー入力とファイルアップロードを処理する場合
  • 新しい API エンドポイントを構築する場合
  • シークレットと環境設定を管理する場合
  • 本番環境デプロイメントを強化する場合

仕組み

  • ミドルウェアは基本的な保護を提供(CSRF は VerifyCsrfToken 経由、セキュリティヘッダーは SecurityHeaders 経由)
  • ガードとポリシーがアクセス制御を実施(auth:sanctum、$this->authorize、ポリシーミドルウェア)
  • フォームリクエストが入力を検証し形成(UploadInvoiceRequest)サービスに到達する前に
  • レート制限が不正使用保護を追加(RateLimiter::for('login'))認証制御と並行して
  • データの安全性は暗号化されたキャスト、一括割当ガード、署名付きルート(URL::temporarySignedRoute + signed ミドルウェア)から来ます

コアセキュリティ設定

  • APP_DEBUG=false を本番環境で設定
  • APP_KEY をセットして、漏洩時にはローテーション必須
  • SESSION_SECURE_COOKIE=true と SESSION_SAME_SITE=lax(または機密アプリケーションは strict)を設定
  • 正しい HTTPS 検出のため、信頼できるプロキシを設定

セッションとクッキーの強化

  • SESSION_HTTP_ONLY=true を設定して JavaScript アクセスを防止
  • 高リスクフローに対して SESSION_SAME_SITE=strict を使用
  • ログイン時と権限変更時にセッションを再生成

認証とトークン

  • Laravel Sanctum または Passport を API 認証に使用
  • 機密データの場合、有効期限の短いトークンとリフレッシュフローを優先
  • ログアウトと侵害されたアカウントでトークンを無効化

ルート保護例:

php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Route::middleware('auth:sanctum')->get('/me', function (Request $request) {
    return $request->user();
});

パスワードセキュリティ

  • Hash::make() でパスワードをハッシュし、平文で保存しない
  • パスワードリセットフロー用に Laravel のパスワードブローカーを使用
php
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;

$validated = $request->validate([
    'password' => ['required', 'string', Password::min(12)->letters()->mixedCase()->numbers()->symbols()],
]);

$user->update(['password' => Hash::make($validated['password'])]);

認可:ポリシーとゲート

  • モデルレベルの認可にはポリシーを使用
  • コントローラーとサービスで認可を実施
php
$this->authorize('update', $project);

ルートレベルの実施にはポリシーミドルウェアを使用:

php
use Illuminate\Support\Facades\Route;

Route::put('/projects/{project}', [ProjectController::class, 'update'])
    ->middleware(['auth:sanctum', 'can:update,project']);

バリデーションとデータサニタイゼーション

  • フォームリクエストで常にユーザー入力をバリデーション
  • 厳密なバリデーションルールと型チェックを使用
  • リクエストペイロードを派生フィールドに信頼しない

一括割当保護

  • $fillable または $guarded を使用して、Model::unguard() は回避
  • DTO またはかば詰明示的な属性マッピングを優先

SQL インジェクション防止

  • Eloquent またはクエリビルダーのパラメータバインディングを使用
  • 厳密に必要でない限り生 SQL を回避
php
DB::select('select * from users where email = ?', [$email]);

XSS 防止

  • Blade は標準で出力をエスケープ({{ }})
  • {!! !!} は信頼できる、サニタイズされた HTML にのみ使用
  • リッチテキストを専用ライブラリでサニタイズ

CSRF 保護

  • VerifyCsrfToken ミドルウェアを有効に保つ
  • フォームに @csrf を含めて、SPA リクエストで XSRF トークンを送信

SPA 認証(Sanctum)の場合、ステートフルなリクエストが設定されていることを確認:

php
// config/sanctum.php
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', 'localhost')),

ファイルアップロード安全性

  • ファイルサイズ、MIME タイプ、拡張子をバリデーション
  • 可能な場合、公開パスの外にアップロードを保存
  • 必要に応じてファイルをマルウェアスキャン
php
final class UploadInvoiceRequest extends FormRequest
{
    public function authorize(): bool
    {
        return (bool) $this->user()?->can('upload-invoice');
    }

    public function rules(): array
    {
        return [
            'invoice' => ['required', 'file', 'mimes:pdf', 'max:5120'],
        ];
    }
}
php
$path = $request->file('invoice')->store(
    'invoices',
    config('filesystems.private_disk', 'local') // set this to a non-public disk
);

レート制限

  • 認証とライトエンドポイントに throttle ミドルウェアを適用
  • ログイン、パスワードリセット、OTP にはより厳しい制限を使用
php
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;

RateLimiter::for('login', function (Request $request) {
    return [
        Limit::perMinute(5)->by($request->ip()),
        Limit::perMinute(5)->by(strtolower((string) $request->input('email'))),
    ];
});

シークレットと認証情報

  • シークレットをソースコントロールにコミットしない
  • 環境変数とシークレットマネージャーを使用
  • 公開後はキーをローテーション、セッションを無効化

暗号化された属性

保存中のシックレット列には暗号化されたキャストを使用。

php
protected $casts = [
    'api_token' => 'encrypted',
];

セキュリティヘッダー

  • 必要に応じて CSP、HSTS、フレーム保護を追加
  • HTTPS リダイレクトを実施するために信頼できるプロキシ設定を使用

ヘッダーを設定するためのミドルウェア例:

php
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

final class SecurityHeaders
{
    public function handle(Request $request, \Closure $next): Response
    {
        $response = $next($request);

        $response->headers->add([
            'Content-Security-Policy' => "default-src 'self'",
            'Strict-Transport-Security' => 'max-age=31536000', // add includeSubDomains/preload only when all subdomains are HTTPS
            'X-Frame-Options' => 'DENY',
            'X-Content-Type-Options' => 'nosniff',
            'Referrer-Policy' => 'no-referrer',
        ]);

        return $response;
    }
}

CORS と API 公開

  • config/cors.php でオリジンを制限
  • 認証済みルートではワイルドカードオリジンを回避
php
// config/cors.php
return [
    'paths' => ['api/*', 'sanctum/csrf-cookie'],
    'allowed_methods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
    'allowed_origins' => ['https://app.example.com'],
    'allowed_headers' => [
        'Content-Type',
        'Authorization',
        'X-Requested-With',
        'X-XSRF-TOKEN',
        'X-CSRF-TOKEN',
    ],
    'supports_credentials' => true,
];

ログと個人情報

  • パスワード、トークン、フルカードデータをログに記録しない
  • 構造化ログで機密フィールドをマスク
php
use Illuminate\Support\Facades\Log;

Log::info('User updated profile', [
    'user_id' => $user->id,
    'email' => '[REDACTED]',
    'token' => '[REDACTED]',
]);

依存関係セキュリティ

  • composer audit を定期的に実行
  • 依存関係をケアをもって固定し、CVE で迅速にアップデート

署名付き URL

一時的な改ざん防止リンクに署名付きルートを使用。

php
use Illuminate\Support\Facades\URL;

$url = URL::temporarySignedRoute(
    'downloads.invoice',
    now()->addMinutes(15),
    ['invoice' => $invoice->id]
);
php
use Illuminate\Support\Facades\Route;

Route::get('/invoices/{invoice}/download', [InvoiceController::class, 'download'])
    ->name('downloads.invoice')
    ->middleware('signed');

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/ja-JP/skills/laravel-security of affaan-m/ECC.

Open the folder on GitHubat commit 4eb71d9

Compare with similar skills

Laravel Security next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Laravel Security compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Laravel Security this skillaffaan-m/ECC276k—~1.5kAutomated safety check: PassMIT
Cashier Stripe Developmentluadotsh/lua3431 repos~1.2kAutomated safety check: PassMIT
Spa Auth Developmentgdarko/laravel-vue-starter145—~668Automated safety check: NotesMIT
Php Laravel Audit0xShe/PHP-Code-Audit-Skill4021 repos~821Automated safety check: PassNone
Laravel SecurityHoangNguyen0403/agent-skills-standard572—~887Automated safety check: PassMIT
Php Framework Auditwgpsec/AboutSecurity1.8k—~767Automated safety check: NotesNone

Similar skills

  • Handles Laravel Cashier Stripe integration including subscriptions, webhooks, Stripe Checkout, invoices, charges, refunds, trials, coupons, metered billing, and payment failure handling.

    343 GitHub starsUsed in 1 repo~1.2k tokens
    Backend & APIsAuto-check passed
  • Spa Auth Development

    gdarko/laravel-vue-starter

    Activate when working on SPA authentication flow, Sanctum cookie-based auth, Vue Router guards, auth store, login/register/password reset pages, or CORS/session configuration.

    145 GitHub stars~668 tokensUpdated 6 mo ago
    Backend & APIsAuto-check: notes
  • Php Laravel Audit

    0xShe/PHP-Code-Audit-Skill

    Laravel 框架特效安全审计工具。针对 Laravel 常见鉴权/CSRF/Session/模型填充/Blade 渲染等框架特性进行白盒静态审计,并将风险映射到你现有通用漏洞类型体系(AUTH/CSRF/LOGIC/XSS/CFG 等)。

    402 GitHub starsUsed in 1 repo~821 tokens
    Backend & APIsAuto-check passed
  • Laravel Security

    HoangNguyen0403/agent-skills-standard

    Harden Laravel apps with Policies for model authorization, Gate-based RBAC, validated mass assignment, and CSRF protection.

    572 GitHub stars~887 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Php Framework Audit

    wgpsec/AboutSecurity

    PHP 框架特定安全审计。当在 PHP 白盒审计中已识别目标使用特定框架、 需要检查框架特有安全机制和常见配置缺陷时触发。

    1.8k GitHub stars~767 tokensUpdated yesterday
    Backend & APIsAuto-check: notes
  • Runs and interprets Psalm security (taint) analysis on a Laravel project.

    230 GitHub stars~4.7k tokensUpdated 6 days ago
    SecurityAuto-check passed

More from affaan-m/ECC

All 682 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    277k GitHub starsUsed in 5 repos~3.1k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    277k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Docs Governance

    affaan-m/ECC

    Route broad documentation-governance requests to existing ECC skills and run an opt-in, read-only audit of mapped documentation roles, links, ADR indexes, and evidence references.

    277k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    277k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    277k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Set an ECC-specific frontend design direction for production UI work.

    277k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Works with

Categories

Questions about Laravel Security

What does Laravel Security do?

Laravel セキュリティベストプラクティス:認証・認可、バリデーション、CSRF、一括割当、ファイルアップロード、シークレット管理、レート制限、安全なデプロイメント. Laravel Security is an agent skill from affaan-m/ECC.

When should I use Laravel Security?

Laravel Security fits situations like: tasks that involve Backend development; tasks that involve Web application vulnerabilities.

How do I install Laravel Security in Claude Code?

Run `npx skills add affaan-m/ECC --skill laravel-security -a claude-code`. Or copy the skill folder (docs/ja-JP/skills/laravel-security in affaan-m/ECC) into .claude/skills/laravel-security in your project. Claude Code loads it when a task matches its description.

How do I install Laravel Security in Codex?

Run `npx skills add affaan-m/ECC --skill laravel-security -a codex`. Or copy the skill folder (docs/ja-JP/skills/laravel-security in affaan-m/ECC) into .agents/skills/laravel-security in your project. Codex loads it when a task matches its description.

Can I use Laravel Security in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill laravel-security -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/laravel-security, .gemini/skills/laravel-security, .github/skills/laravel-security and .opencode/skills/laravel-security in your project.

What does Laravel Security need to run?

Going by SKILL.md and its folder, Laravel Security needs the command-line tools its instructions call (composer) and credentials named APP_KEY. Our summary lists: A credential in APP_KEY.

Does Laravel Security access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Laravel Security safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Laravel Security use?

Laravel Security is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Laravel Security use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Laravel Security?

Skills that share tags, products or a category with Laravel Security: Cashier Stripe Development (luadotsh/lua, 343 stars), Spa Auth Development (gdarko/laravel-vue-starter, 145 stars), Php Laravel Audit (0xShe/PHP-Code-Audit-Skill, 402 stars) and Laravel Security (HoangNguyen0403/agent-skills-standard, 572 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Laravel Security?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 276,111 GitHub stars. The repository holds 683 skills in this directory. The repository was last updated on October 10, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.