File contents Sanitizer
外部入力(GitHub Issue/PRの本文、コメント等)を安全に処理するためのサニタイズ機能。
目的
プロンプトインジェクション対策 : HTMLコメントや不可視文字に隠された悪意ある指示を除去
トークン漏洩防止 : 誤って含まれたGitHubトークンをマスク
入力正規化 : 不要な属性や特殊文字を除去して安全な入力に変換
使用場面
場面
適用タイミング
/implement-issues
Issue本文を読み込む際
@claude メンション処理
コメント本文を処理する際
外部PR処理
信頼できないPRの説明文を処理する際
サニタイズ関数
1. HTMLコメント除去
strip_html_comments "<!-- hidden instruction -->"
# 出力: ""
2. 不可視文字除去
strip_invisible_chars "text\u200Bwith\u200Cinvisible"
# 出力: "textwithinvisible"
3. GitHubトークンマスク
redact_github_tokens "token: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
# 出力: "token: [REDACTED_GITHUB_TOKEN]"
4. Markdown画像alt除去
strip_markdown_image_alt ""
# 出力: ""
5. HTML属性除去
strip_hidden_attributes '<div alt="hidden" data-secret="value">text</div>'
# 出力: '<div>text</div>'
CLIスクリプト
bash .opencode/skill/sanitizer/scripts/sanitize.sh <input-file>
bash .opencode/skill/sanitizer/scripts/sanitize.sh --stdin
echo "content" | bash .opencode/skill/sanitizer/scripts/sanitize.sh --stdin
引数
説明
<input-file>
サニタイズするファイルパス
--stdin
標準入力から読み込み
出力 : サニタイズ済みテキスト(標準出力)
除去対象一覧
カテゴリ
対象
例
HTMLコメント
<!-- ... -->
<!-- ignore this -->
Zero-width文字
\u200B, \u200C, \u200D, \uFEFF
不可視文字
制御文字
\u0000-\u001F, \u007F-\u009F
制御コード
Bidi制御
\u202A-\u202E, \u2066-\u2069
双方向テキスト制御
Markdown画像alt
 のalt部分
 → 
HTML属性
alt, title, aria-label, data-*, placeholder
<img alt="hidden">
HTMLエンティティ
{, {
数値エンティティ(非印字文字除去)
GitHubトークン
ghp_*, gho_*, ghs_*, ghr_*, github_pat_*
APIトークン
セキュリティ考慮事項
新しいバイパス技術 : 完全な防御は不可能。外部コントリビューターからの入力は常に注意
信頼レベル : 内部メンバーのIssueは信頼度高、外部PRは信頼度低として扱う
多層防御 : サニタイズは一層目。重要な操作前には人間の確認を推奨
関連ドキュメント
1 --- 2 name: sanitizer-3 3 description: Sanitizer 4 --- 5 6 # Sanitizer 7 8 外部入力(GitHub Issue/PRの本文、コメント等)を安全に処理するためのサニタイズ機能。 9 10 --- 11 12 ## 目的 13 14 - **プロンプトインジェクション対策**: HTMLコメントや不可視文字に隠された悪意ある指示を除去 15 - **トークン漏洩防止**: 誤って含まれたGitHubトークンをマスク 16 - **入力正規化**: 不要な属性や特殊文字を除去して安全な入力に変換 17 18 --- 19 20 ## 使用場面 21 22 | 場面 | 適用タイミング | 23 |------|---------------| 24 | `/implement-issues` | Issue本文を読み込む際 | 25 | `@claude` メンション処理 | コメント本文を処理する際 | 26 | 外部PR処理 | 信頼できないPRの説明文を処理する際 | 27 28 --- 29 30 ## サニタイズ関数 31 32 ### 1. HTMLコメント除去 33 34 ```bash 35 strip_html_comments "<!-- hidden instruction -->" 36 # 出力: "" 37 ``` 38 39 ### 2. 不可視文字除去 40 41 ```bash 42 strip_invisible_chars "text\u200Bwith\u200Cinvisible" 43 # 出力: "textwithinvisible" 44 ``` 45 46 ### 3. GitHubトークンマスク 47 48 ```bash 49 redact_github_tokens "token: ghp_1234567890abcdefghijklmnopqrstuvwxyz" 50 # 出力: "token: [REDACTED_GITHUB_TOKEN]" 51 ``` 52 53 ### 4. Markdown画像alt除去 54 55 ```bash 56 strip_markdown_image_alt "" 57 # 出力: "" 58 ``` 59 60 ### 5. HTML属性除去 61 62 ```bash 63 strip_hidden_attributes '<div alt="hidden" data-secret="value">text</div>' 64 # 出力: '<div>text</div>' 65 ``` 66 67 --- 68 69 ## CLIスクリプト 70 71 ```bash 72 bash .opencode/skill/sanitizer/scripts/sanitize.sh <input-file> 73 bash .opencode/skill/sanitizer/scripts/sanitize.sh --stdin 74 echo "content" | bash .opencode/skill/sanitizer/scripts/sanitize.sh --stdin 75 ``` 76 77 | 引数 | 説明 | 78 |------|------| 79 | `<input-file>` | サニタイズするファイルパス | 80 | `--stdin` | 標準入力から読み込み | 81 82 **出力**: サニタイズ済みテキスト(標準出力) 83 84 --- 85 86 ## 除去対象一覧 87 88 | カテゴリ | 対象 | 例 | 89 |---------|------|-----| 90 | HTMLコメント | `<!-- ... -->` | `<!-- ignore this -->` | 91 | Zero-width文字 | `\u200B`, `\u200C`, `\u200D`, `\uFEFF` | 不可視文字 | 92 | 制御文字 | `\u0000-\u001F`, `\u007F-\u009F` | 制御コード | 93 | Bidi制御 | `\u202A-\u202E`, `\u2066-\u2069` | 双方向テキスト制御 | 94 | Markdown画像alt | `` のalt部分 | `` → `` | 95 | HTML属性 | `alt`, `title`, `aria-label`, `data-*`, `placeholder` | `<img alt="hidden">` | 96 | HTMLエンティティ | `{`, `{` | 数値エンティティ(非印字文字除去) | 97 | GitHubトークン | `ghp_*`, `gho_*`, `ghs_*`, `ghr_*`, `github_pat_*` | APIトークン | 98 99 --- 100 101 ## セキュリティ考慮事項 102 103 - **新しいバイパス技術**: 完全な防御は不可能。外部コントリビューターからの入力は常に注意 104 - **信頼レベル**: 内部メンバーのIssueは信頼度高、外部PRは信頼度低として扱う 105 - **多層防御**: サニタイズは一層目。重要な操作前には人間の確認を推奨 106 107 --- 108 109 ## 関連ドキュメント 110 111 | ドキュメント | 内容 | 112 |-------------|------| 113 | [claude-code-action security](https://github.com/anthropics/claude-code-action/blob/main/docs/security.md) | 元実装のセキュリティドキュメント |
takemo101/compose-workflow/tree/main/.opencode/skill/sanitizer commit 907b7a7c5c
Frequently asked questions How do I install the Sanitizer skill? Run npx skillmds@latest add takemo101/sanitizer-3 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Sanitizer skill do? Sanitizer It is listed under Coding & Dev Tools on SkillMD.
Is Sanitizer safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Sanitizer? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Sanitizer free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Sanitizer? takemo101 (@takemo101) published this skill. Their other Agent Skills are listed on their SkillMD profile.