chore(security): 🔒 カスタム .gitleaks.toml による PII (個人情報) 検知強化 - #194
Conversation
- リポジトリ直下に `.gitleaks.toml` を作成し、デフォルトのルールに加えてハードコードされたメールアドレス(個人情報)を検知するカスタムルールを追加しました - 誤検知を防ぐため `example.com`, `test.com`, `dummy.com`, `genzouw@gmail.com` の allowlist を設定しました - セキュリティガイドライン (`docs/security/leak-prevention.md`) に、カスタムルールの適用に関する記述を追記しました Co-authored-by: genzouw <29957+genzouw@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Review limit reached
More reviews will be available in 32 minutes and 3 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesGitleaksカスタムメール検知設定
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitleaks.toml:
- Line 9: Replace the current regex value in the "regex = '''...'''" entry with
an improved pattern that enforces: local and domain parts start and end with
alphanumeric characters, no consecutive dots (..), domain labels cannot start or
end with a hyphen, and a word boundary to avoid partial matches; keep the
case-insensitive flag (?i) and the multiline/triple-quoted string format when
updating the value so gitleaks still reads it correctly.
- Around line 13-19: Update the allowlist regexes under [rules.allowlist] so
they only match email-domain endings instead of substrings: change entries like
"example\.(com|org|net)" and "test\.(com|org|net)" to anchor with an email
local-part prefix and end-of-string (e.g., prepend "@" and append "$") so they
match "`@example`\.(com|org|net)$", "`@test`\.(com|org|net)$",
"`@dummy`\.(com|org|net)$"; additionally add a rule for invalid TLD emails such as
"@.*\.invalid$" if you want to allow "*.invalid" addresses; ensure the patterns
remain properly escaped and placed in the regexes array in .gitleaks.toml under
rules.allowlist.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 771e7f6c-3de9-4191-827d-c624d5560255
📒 Files selected for processing (2)
.gitleaks.tomldocs/security/leak-prevention.md
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 本プルリクエストは、Gitleaksによるシークレット検知機能を強化し、ソースコードへの個人情報(メールアドレス)の混入を未然に防ぐことを目的としています。既存のデフォルトルールを拡張する形でカスタム設定を導入し、開発プロセスにおけるセキュリティの堅牢性を向上させます。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
このプルリクエストでは、メールアドレス(PII)のハードコードを検知するためのカスタムGitleaksルール(.gitleaks.toml)が追加され、関連するセキュリティドキュメントが更新されました。レビューでは、特定の個人メールアドレスが allowlist にハードコードされているセキュリティおよびプライバシー上の問題と、広範な正規表現によるロックファイル等での誤検知を防ぐための除外設定(グローバル allowlist)の検討が指摘されています。
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
連続ドット(..)、ドメインラベルの不正なハイフン位置、単語境界なしのマッチを防ぐ 改善版正規表現に変更。誤検知・検知漏れリスクを軽減する。 レビューコメント: #194 (comment) レビュアー: coderabbitai 優先度: high
allowlist の正規表現をサブストリングマッチから @Domain$ 形式に変更し過剰許可を防ぐ。 個人メールアドレス genzouw@gmail.com をリポジトリ共通設定から削除し、 *.invalid ドメインの除外ルールを追加した。 レビューコメント: #194 (comment) レビューコメント: #194 (comment) レビュアー: gemini-code-assist, coderabbitai 優先度: high, medium
package-lock.json・pnpm-lock.yaml・yarn.lock 等のロックファイルは メールアドレスに見える文字列を多く含むため、グローバル allowlist で スキャン対象から除外し誤検知(False Positive)を防ぐ。 レビューコメント: #194 (comment) レビュアー: gemini-code-assist 優先度: low
SECURITY.md は脆弱性報告の連絡先として意図的にメールアドレスを公開する 慣例的な場所であり、新規追加された monopo-pii-email ルールの対象から除外する。
Up to standards ✅🟢 Issues
|
背景
本リポジトリではすでに
gitleaksを利用してローカルの pre-commit や CI でシークレットの流出を防いでいますが、デフォルトのgitleaksルールでは高エントロピーのAPIキーなどは効果的に検知できるものの、一般的なメールアドレス等の個人情報(PII)のハードコードはデフォルトでは対象外となっています。現状認識(事前調査結果のサマリー)
gitleaks.yml,codeql.yml,trivy.yml,trufflehog.ymlおよび.husky/pre-commit導入済みこのPRで導入・強化するもの
.gitleaks.toml追加、docs/security/leak-prevention.mdの更新検知漏れリスクと補完策
example.comなど)マージ前に必要な手動作業(チェックリスト)
レビュアーは PR をマージする前に必ず以下を実施してください。
本 PR の CI は手動作業完了を前提に通る設計です。
マージ後の確認手順
gitleaksワークフローが正常に green になることを確認gitleaks detectがカスタムルールを含めて動作することを確認ロールバック手順
本 PR による変更(
.gitleaks.toml)を削除(revert)することで、元のデフォルトルールのみの検知に即座に戻ります。参考情報
PR created automatically by Jules for task 601686326237424699 started by @genzouw
Summary by CodeRabbit
セキュリティ向上
ドキュメント