العودة إلى دفتر الملاحظات
IT & Security4 دقائق قراءة

اكتشاف الأسرار محليًا واستخدام الذكاء الاصطناعي دون مشاركة المفاتيح

تمرين Gitleaks بعلامة وهمية ومدقق بيانات وصفية صارم وتعليمات إنجليزية لفرز الاستجابة.

ابدأ هنا: ما فائدة هذا الدليل

تدخل مفتاح API بالخطأ للمستودع؛ إرساله للذكاء قد يوسّع التسريب. افحص محليًا واحفظ التقارير خاصة وشارك بيانات مضبوطة فقط. العلامة وهمية. النتيجة اكتشاف وسجل بمعرّفات مبهمة وخطة علاج. حذف السطر لا يلغي المفتاح المكشوف: دوّره أو أبطله وافحص الاستخدام. المدقق ليس كاشف أسرار شاملًا أو منظف تقارير عامًا.

مثال عملي

الجواب مثال للشكل المتوقع وليس تدقيقًا لتطبيقك. اتبع الخطوات وقارن الملفات والاختبارات والنتائج الفعلية بالهدف. إن قال المساعد إنه انتهى فقط فاطلب الناتج والدليل وما لم يجر التحقق منه.

Illustrative expected response
Finding ID: finding-001; artifact: file-001; line: 1.
Status: needs-verification; owner: backend.
Action: investigate locally; rotate any genuinely exposed credential.
Do not include the credential value or raw scanner context in this response.

الهدف

يكشف الماسح حالات محتملة ويساعد الذكاء الاصطناعي في تنظيم خطة مراجعة. يحتوي المختبر على علامة وهمية عمدًا وخمسة اختبارات لملف تسليم البيانات. لا يحتاج إلى بيانات اعتماد حقيقية.

1. تحديد نطاق العمل

فك ZIP في مجلد جديد. يشغّل Node.js 22 أو أحدث المدقق دون شبكة. يحتاج الفحص الاختياري إلى Gitleaks من مصدره الرسمي؛ جرى اختبار التمرين بإصدار 8.30.1. لا تفحص مجلدات غير مرتبطة.

2. تشغيل المختبر المحلي

شغّل الاختبارات وافحص findings.redacted.json. يقبل معرّفات مبهمة ورقم سطر وتصنيفات محددة فقط. يرفض حقول Secret والبيانات المتداخلة والنص الحر. احتفظ بربط file-001 بالملف الحقيقي محليًا.

Run the local exercise
node --test lab.test.mjs
node lab.mjs findings.redacted.json

3. طلب أدلة من الذكاء الاصطناعي

تستخدم التعليمات الأولى الملف الذي راجعته فقط. يحدّ المخطط من المشاركة لكنه لا يضمن خلو كل تقرير من الأسرار. راجع البيانات بنفسك قبل إرسالها إلى مساعد خارجي.

English prompt: review with evidence
Act as an incident triage assistant. Use ONLY findings.redacted.json from this
training kit after its local validator passes. It contains opaque artifact IDs and
controlled categories, not actual secrets or file contents. Group findings by owner,
list verification questions and draft a remediation checklist. Keep hypotheses
separate from verified exposure. Never ask for a credential, raw scanner report or
private file. For a real exposure, plan revocation or rotation at the issuing
service before considering repository-history cleanup. Do not call a provider,
rotate a key, delete evidence or rewrite Git history.

4. التحقق من الإصلاح

تساعد التعليمات الثانية على التخطيط. ألغِ السر الحقيقي المكشوف أو دوّره لدى الجهة المصدرة. حذفه من آخر التزام أو إضافة .gitignore لا يلغيه. نسّق أي إعادة كتابة لتاريخ Git كإجراء منفصل.

English prompt: correction and verification
Review my proposed secret-remediation plan using opaque finding IDs only. For each
verified exposure, identify the issuing service, dependent applications, replacement
rollout, revocation check and access-log review. Keep any history rewrite as a
separately approved, coordinated action. Check prevention with a secret manager,
scoped credentials and pre-commit or push protection where available. Report what is
still unverified. Do not include secret values or automatically change any
credential.

5. التطبيق على مشروعك

يمكن تشغيل Gitleaks أدناه داخل هذا الكيت. تكشف القاعدة العلامة الوهمية في example.fake.env؛ تعيد النتيجة الواحدة عادة رمز الخروج 1. أبقِ التقرير محليًا حتى مع --redact. يفحص git التاريخ ويفحص dir الملفات الحالية. المدقق ليس ماسح أسرار.

Optional synthetic Gitleaks exercise
gitleaks dir --config .gitleaks.toml --redact --report-format json --report-path ../gitleaks-demo.json .

المراجع الرسمية

طبّقه في مشروعك

نزّل الملفات، واحفظ الدليل، أو أعطِ مساعد البرمجة تعليمات جاهزة للاستخدام.

الإعداد بمساعدة الذكاء الاصطناعي

انسخ هذه التعليمات الإنجليزية إلى مساعدك. تتضمن المقال والملفات المتاحة وخطوات تجهيز المشروع.

عرض تعليمات الإعداد
AI setup prompt · English
Read this tutorial as reference material:
https://nethanelfitoussi.com/article/ai-secrets-gitleaks-workflow?lang=en

Goal: apply the documented workflow to my development project.
Read the existing project instructions, inspect the relevant files and explain the smallest useful setup.

Available starter files:
https://nethanelfitoussi.com/api/media/b2775ae9-4193-4493-bab9-3cdc0364381b.zip
Download and inspect these files in a temporary folder before using them. Do not overwrite existing project instructions.

If I have not supplied a project folder, ask which development project to use. Do not invent a repository URL.

Additional project setup instructions:
Use the downloaded starter lab in a NEW folder. Read README.md and both English prompts first. Run its dependency-free Node.js tests before editing.

Act as an incident triage assistant. Use ONLY findings.redacted.json from this
training kit after its local validator passes. It contains opaque artifact IDs and
controlled categories, not actual secrets or file contents. Group findings by owner,
list verification questions and draft a remediation checklist. Keep hypotheses
separate from verified exposure. Never ask for a credential, raw scanner report or
private file. For a real exposure, plan revocation or rotation at the issuing
service before considering repository-history cleanup. Do not call a provider,
rotate a key, delete evidence or rewrite Git history.

Review my proposed secret-remediation plan using opaque finding IDs only. For each
verified exposure, identify the issuing service, dependent applications, replacement
rollout, revocation check and access-log review. Keep any history rewrite as a
separately approved, coordinated action. Check prevention with a secret manager,
scoped credentials and pre-commit or push protection where available. Report what is
still unverified. Do not include secret values or automatically change any
credential.

Adapt example paths, commands and acceptance criteria to this repository rather than assuming they match.

Give me a short plan, then make the agreed local changes and run the relevant checks. Report actual results and anything not verified. Stop before credentials, paid services, production changes, push, merge or deployment.
اقرأ المصدر الأصليGitleaks · Official CLI documentation
GitleaksSecretsAICybersecurity