Security Engineerのロゴ

Security Engineer

コミュニティ
wasintoh
security-engineer

Security-first auditing of AI-generated code — Level 1 quick checks during /toh-dev and /toh-test (hardcoded secrets, dangerous code execution, obvious injection vectors) and Level 2 full audits for /toh-protect (SQL/XSS/command injection, auth and authorization flaws, configuration and dependency risks) with human-readable, actionable fix reports. Use for any security review or before shipping.

Add to TypingMind

概要

公開者wasintoh
リポジトリtoh-framework
スキル名security-engineer
スター
96
フォーク
19
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    wasintohがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Security Engineer」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/wasintoh/toh-framework/tree/main/src/skills/security-engineer
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wasintoh/toh-framework.git /tmp/toh-framework
mkdir -p .claude/skills
cp -r /tmp/toh-framework/src/skills/security-engineer .claude/skills/security-engineer
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSecurity Engineerを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSecurity Engineerを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Security Engineerは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Security Engineer Skill

Overview

Security-first approach for AI-generated code auditing. Provides both quick checks (during dev/test) and comprehensive audits (full protection).

Core Philosophy

"Trust, but verify - especially AI-generated code"

  1. Proactive Detection - Catch issues before they become vulnerabilities
  2. Layer Defense - Quick checks + Full audits = Maximum coverage
  3. Zero False Sense - Don't trust code just because it "looks safe"
  4. Human-Readable Reports - Clear findings with actionable fixes

Security Check Levels

text
+-------------------------------------------------------------+
|  LEVEL 1: Quick Check (during /toh-dev, /toh-test)          |
|  - Hardcoded secrets                                        |
|  - Dangerous imports/code execution                         |
|  - Basic auth issues                                        |
|  - Obvious injection vectors                                |
|  Duration: < 5 seconds                                      |
+-------------------------------------------------------------+
                           |
                           v
+-------------------------------------------------------------+
|  LEVEL 2: Full Audit (/toh-protect)                         |
|  - All Level 1 checks                                       |
|  - Injection attacks (SQL, XSS, Command)                    |
|  - Auth/Authorization flaws                                 |
|  - AI-Generated Code risks                                  |
|  - Configuration security                                   |
|  - Dependency vulnerabilities                               |
|  Duration: 30-60 seconds                                    |
+-------------------------------------------------------------+

Level 1: Quick Check Patterns

1.1 Hardcoded Secrets Detection

Detection Patterns:

text
SECRET_PATTERNS:
  # API Keys
  - Pattern for api_key, apikey with 20+ char values
  - Pattern for sk-live, pk-live, sk-test prefixes

  # AWS
  - Pattern: AKIA followed by 16 alphanumeric chars
  - Pattern for aws_secret values

  # Database URLs
  - Connection strings with embedded credentials

  # Private Keys
  - PEM format key headers

  # JWT Secrets
  - jwt_secret, secret_key patterns

  # Generic passwords
  - password/passwd/pwd assignments

Files to check:

  • **/*.ts, **/*.tsx, **/*.js, **/*.jsx
  • **/*.env* (.env, .env.local, .env.production)
  • **/config/**, **/*.json

Files to IGNORE:

  • **/node_modules/**, **/.git/**
  • **/dist/**, **/build/**
  • **/*.test.*, **/*.spec.*

1.2 Dangerous Code Patterns Detection

CRITICAL - Block immediately:

text
CRITICAL_PATTERNS:
  # Dynamic code execution
  - String-based code evaluation functions
  - Timer functions with string arguments

  # Dangerous Node.js modules
  - Shell command execution
  - Process spawning with shell mode

  # SQL without parameterization
  - Template literals in SQL statements
  - String concatenation in queries

  # Dangerous HTML rendering
  - React's unsafe HTML rendering attribute
  - Direct HTML content assignment to DOM

WARNING - Review required:

text
WARNING_PATTERNS:
  # Disabled security
  - ESLint security rule disabling
  - TypeScript strict mode bypasses
  - CORS with wildcard origin

  # Unsafe data handling
  - JSON parsing without validation
  - Deserialization of untrusted data

  # Weak cryptography
  - Deprecated hash algorithms (MD5, SHA1)
  - Non-cryptographic random for security

1.3 Basic Auth Issues

text
AUTH_PATTERNS:
  # Hardcoded credentials
  - Default admin/root credentials

  # Disabled auth
  - Authentication bypass flags
  - Skip auth configurations

  # Weak session
  - Short session secrets
  - Insecure cookie settings

  # JWT issues
  - None algorithm acceptance
  - Signature verification disabled

Quick Check Output Format

text
+------------------------------------------------------------+
|  QUICK SECURITY CHECK                                      |
+------------------------------------------------------------+

Scanning: src/**/*.{ts,tsx,js,jsx}

CRITICAL (2 issues - must fix!)
-----------------------------------
1. Hardcoded API Key
   File: src/lib/api.ts:15
   Code: const API_KEY = "sk-live-abc123..."
   Fix:  Use environment variable: process.env.API_KEY

2. SQL Injection Risk
   File: src/api/users.ts:42
   Code: SELECT with template literal interpolation
   Fix:  Use parameterized query: WHERE id = $1

WARNING (1 issue - review recommended)
-----------------------------------
1. Disabled ESLint Security
   File: src/utils/parse.ts:8
   Why:  Security rules should not be disabled

====================================
Summary: 2 critical, 1 warning
Status: BLOCKED - Fix critical issues
====================================

Level 2: Full Audit Patterns

2.1 Injection Attack Detection

SQL Injection

Vulnerable patterns:

  • String concatenation in queries
  • Dynamic table/column names via interpolation
  • Raw queries without ORM parameterization

Safe patterns:

  • Positional placeholders ($1, $2 for PostgreSQL)
  • Question mark placeholders (MySQL/SQLite)
  • Named parameters (various ORMs)
XSS (Cross-Site Scripting)

Vulnerable patterns:

  • Unsafe HTML rendering in React components
  • Direct DOM HTML content manipulation
  • User input in dynamically created HTML
  • Unvalidated URL assignments

Safe patterns:

  • HTML sanitization with DOMPurify
  • Text content assignment (no HTML parsing)
  • Proper output encoding
Command Injection

Vulnerable patterns:

  • Shell execution with user input
  • Unsanitized process arguments
  • Path traversal sequences

2.2 Authentication/Authorization Flaws

text
AUTH_FLAWS:
  # Missing auth checks
  - API routes without middleware
  - Unprotected admin endpoints

  # Insecure session
  - Missing secure flag on cookies
  - Missing httpOnly flag
  - Improper sameSite configuration

  # JWT vulnerabilities
  - Algorithm confusion attacks
  - Excessive token lifetime

  # CORS misconfig
  - Wildcard origin with credentials
  - Overly permissive origins

  # Missing rate limiting
  - Auth endpoints without throttling

2.3 AI-Generated Code Risks

text
AI_CODE_RISKS:
  # Common AI mistakes
  - Unimplemented TODO comments
  - Placeholder implementations
  - Debug logging left in code
  - Empty error handlers
  - Silently ignored exceptions

  # Over-trusting patterns
  - Unvalidated request data usage
  - Direct database queries with user input
  - Type assertion abuse
  - TypeScript safety bypasses

  # Hallucinated APIs
  - Non-existent library methods
  - Invented function calls

2.4 Configuration Security

Environment files:

  • No secrets in committed files
  • Suspicious encoded strings
  • Non-placeholder passwords

Package.json:

  • Outdated dependencies
  • Known vulnerabilities
  • Excessive permissions

Framework config:

  • Overly permissive image domains
  • Unsafe header configurations
  • Risky experimental features

Security Headers:

  • Content-Security-Policy
  • X-Frame-Options
  • X-Content-Type-Options
  • Strict-Transport-Security

2.5 Dependency Vulnerabilities

bash
# Commands to run
npm audit --json
npx audit-ci --moderate

Full Audit Report Format

text
+------------------------------------------------------------+
|  FULL SECURITY AUDIT                                       |
|  Project: [project-name]                                   |
|  Date: YYYY-MM-DD HH:mm                                    |
+------------------------------------------------------------+

EXECUTIVE SUMMARY
====================================
Risk Level: HIGH / MEDIUM / LOW
Files Scanned: 142
Issues Found: 8 (3 critical, 3 high, 2 medium)

CRITICAL ISSUES
====================================
[SEC-001] SQL Injection
|- File: src/api/users.ts:42
|- Risk: Database compromise
|- Fix: Use parameterized queries

[SEC-002] Hardcoded Secret
|- File: src/lib/stripe.ts:5
|- Risk: Credential exposure
|- Fix: Use environment variables

[SEC-003] XSS Vulnerability
|- File: src/components/Comment.tsx:28
|- Risk: Script injection
|- Fix: Sanitize with DOMPurify

HIGH ISSUES
====================================
[SEC-004] Missing Authentication
[SEC-005] CORS Misconfiguration
[SEC-006] Weak Session Secret

MEDIUM ISSUES
====================================
[SEC-007] Missing Rate Limiting
[SEC-008] Outdated Dependencies

RECOMMENDATIONS
====================================
1. [URGENT] Fix critical issues before deploy
2. [HIGH] Add authentication middleware
3. [HIGH] Configure CORS properly
4. [MEDIUM] Set up rate limiting
5. [LOW] Update dependencies

====================================
Report saved: .toh/security-audit-YYYY-MM-DD.md
====================================

Integration with Commands

Quick Check Integration

Add to /toh-dev and /toh-test:

text
BEFORE building/testing:
|- Run Level 1 Quick Check
|- If CRITICAL found → BLOCK
|- If WARNING found → WARN and continue
|- If clean → PASS

Full Audit Integration

Triggered by /toh-protect:

text
FULL AUDIT FLOW:
|- Step 1: Run all Level 1 checks
|- Step 2: Run Level 2 deep analysis
|- Step 3: Run npm audit
|- Step 4: Check security headers
|- Step 5: Generate report
|- Step 6: Save to .toh/security-audit-[date].md

Auto-Fix Capabilities

IssueAuto-FixMethod
Hardcoded secretsYesMove to .env
Dynamic code executionPartialSuggest alternatives
SQL injectionPartialConvert to parameterized
XSSYesAdd sanitizer wrapper
Missing headersYesUpdate config
CORS misconfigYesFix configuration
Outdated depsYesnpm audit fix

Requires Human Review

  • Authentication logic
  • Authorization rules
  • Business logic validation
  • Complex queries
  • Third-party integrations

Security Checklist

Before Development

  • Environment variables configured
  • .gitignore includes sensitive files
  • Dependencies audited

During Development

  • No hardcoded secrets
  • Input validation on user data
  • Parameterized queries
  • Output encoding
  • Auth on protected routes

Before Deployment

  • npm audit clean
  • Security headers set
  • CORS configured
  • Rate limiting enabled
  • Full audit passed

References

よくある質問

AIスキル「Security Engineer」では何ができますか?

Security-first auditing of AI-generated code — Level 1 quick checks during /toh-dev and /toh-test (hardcoded secrets, dangerous code execution, obvious injection vectors) and Level 2 full audits for /toh-protect (SQL/XSS/command injection, auth and authorization flaws, configuration and dependency risks) with human-readable, actionable fix reports. Use for any security review or before shipping.

TypingMindでSecurity Engineerを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Security Engineerはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSecurity Engineerをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/wasintoh/toh-framework/tree/main/src/skills/security-engineerを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Security Engineerを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Security Engineerで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSecurity Engineerを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Security Engineer」は無料ですか?

はい。wasintohがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇