variant-analysis
ما الذي تفعله
تأخذ هذه المهارة خطأً وجدته بالفعل، وتبحث عن نسخ أخرى للسبب الجذري نفسه في قاعدة الشيفرة. وهي موجهة إلى المدققين الأمنيين والمطورين الذين وجدوا مشكلة للتو.
متى تستخدمها
- ✓عندما يُعثر على خطأ في ملف واحد وتريد معرفة أين يحدث أيضًا.
- ✓عندما يُسأل هل مشكلة جديدة هي الخطأ نفسه كخطأ سابق.
- ✓عندما تريد تحويل خطأ معروف إلى استعلام CodeQL أو قاعدة Semgrep للبحث.
رابط المهارة
https://github.com/trailofbits/skills/blob/main/plugins/variant-analysis/skills/variant-analysis/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“وجدنا للتو غياب فحص صلاحية في هذا الملف. هل يحدث الخطأ نفسه في أماكن أخرى من الشيفرة؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تعمل المهارة في خمس خطوات: تجد السبب الجذري، وتكتب نمطًا يطابق الخطأ المعروف فقط، ثم تعمّم ذلك النمط، وتبحث في الشيفرة عن التطابقات.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Variant Analysis
Find the other instances of a bug you have already found. One root cause usually has several manifestations, and they are rarely in the module where you found the first one.
When to Use
- A vulnerability has been found and you need to search for similar instances
- Building or refining CodeQL/Semgrep queries for security patterns
- Performing systematic code audits after an initial issue discovery
- Analyzing how a single root cause manifests in different code paths
When NOT to Use
- Initial vulnerability discovery — use audit-context-building or a domain-specific audit
- General code review with no known pattern to search for
- Writing fix recommendations — use issue-writer
- Understanding unfamiliar code — use audit-context-building first
The Five Steps
Read the reference for a step when you reach it.
1. Understand the original issue. Extract the root cause — why the code is wrong, not what it does — and enumerate the directions a variant could hide in: related identifiers, other manifestations of the same mistake, data-type edge cases. → references/root-cause.md
2. Create an exact match. Write a pattern matching ONLY the known instance and confirm it hits. A pattern that matches nothing means you have misunderstood the bug, and every search built on it is calibrated against the wrong code.
3–4. Generalize one element at a time. Climb from the exact match toward the pattern family, running and reading all matches after each single change. Stop when more than half the matches are noise. → references/searching.md — abstraction ladder, tool selection, false-positive filters
5. Triage. Decide which candidates are real, and say so with a severity attached. → references/triage.md
Then write it up, including the patterns that failed and a CI rule to prevent regression. → references/reporting.md
Running it as a Workflow
This plugin ships /variant-analysis:variants, which runs the five steps across parallel
subagents — one per expansion axis, looping until the sweep stops finding anything new.
Each stage reads the reference above that matches its job.
Use the workflow when the codebase is large or the root cause has many manifestations. Work the steps directly when the search is narrow or you want a say in each generalization.
What Makes Hunts Fail
- Narrow scope — searching only the module the original bug was in
- Pattern too specific — searching one attribute and missing the family around it
- One vulnerability class — chasing a single manifestation of the root cause
- Happy-path testing — never trying the null, empty, and boundary cases
- Generalizing too fast — abstracting several elements at once, so noise cannot be attributed to any one of them
The first three are covered in root-cause.md and searching.md, the fourth in triage.md.
Resources
CodeQL (resources/codeql/): python.ql, javascript.ql, java.ql, go.ql, cpp.ql
Semgrep (resources/semgrep/): python.yaml, javascript.yaml, java.yaml, go.yaml, cpp.yaml
Report: resources/variant-report-template.md
الأسئلة الشائعة
هل هي لإيجاد أخطاء جديدة من الصفر؟
لا. هي للبحث عن نسخ أخرى من خطأ تعرفه بالفعل.
هل تكتب الإصلاح؟
لا. تركز المهارة على إيجاد المتغيرات ولا تكتب توصيات الإصلاح.
هل تساعد في كتابة قواعد البحث؟
نعم. تستطيع المساعدة في بناء استعلامات CodeQL أو قواعد Semgrep من مثال معروف.
التفاصيل
الوصف الأصلي من المؤلف
Hunts for the other instances of a bug already found — the variants of one root cause across a codebase. Use immediately after a vulnerability, logic bug, or bad pattern turns up in a specific file and the question becomes where else it occurs, including the bare conversational form ("are there others like this?", "is this the same bug?"). Also for generalizing one known instance into a CodeQL or Semgrep query for its whole pattern family, and for triaging a set of look-alike candidates against a known root cause. Not for initial discovery with no bug in hand.
repo: trailofbits/skills
الشعبية
- نجوم GitHub
- 8.0k
- الترتيب
- #12739
- الترخيص
- CC-BY-SA-4.0
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
audit-context-building
8.0kيساعد وكيلك على فهم شيفرة غير مألوفة قبل مراجعة أمنية، عبر رسم ما تفترضه كل دالة وما تضمنه وما تعتمد عليه.
algorand-vulnerability-scanner
8.0kيساعد وكيلك على فحص عقود Algorand الذكية المكتوبة بـ TEAL أو PyTeal لاكتشاف 11 مشكلة أمنية شائعة، مثل هجمات إعادة المفاتيح والرسوم غير المفحوصة.
audit-prep-assistant
8.0kيساعد وكيلك على تجهيز الشيفرة لمراجعة أمنية خارجية، عبر التحليل الثابت وتغطية الاختبارات وحذف الشيفرة الميتة وتوثيق واضح.
cairo-vulnerability-scanner
8.0kيساعد وكيلك على فحص عقود Cairo الذكية على StarkNet لاكتشاف 6 مشكلات خطيرة، مثل فيض الحساب والرسائل بين الطبقات وإعادة تشغيل التوقيعات.
مهارات مشابهة
reverse-engineer-anything
422kيساعد وكيلك على فحص التطبيقات والحزم المنشورة من الداخل ليشرح الميزات ويقارن الإصدارات ويرشد إلى إعادة البناء، باستخدام أداة REA.
1password
394kيساعد وكيلك على إعداد واجهة سطر أوامر 1Password وتسجيل الدخول، وقراءة الأسرار أو حقنها دون طباعة قيمها في المحادثة.
healthcheck
394kيساعد وكيلك على تدقيق جهاز OpenClaw أو خادمه أمنيًا، مثل SSH والجدار الناري والتحديثات، ويقترح إصلاحات آمنة قابلة للتراجع.