חזרה למחברת
IT & Security4 דקות קריאה

לזהות סודות מקומית ולתכנן טיפול עם AI בלי לשתף מפתחות

תרגיל Gitleaks עם סימון מזויף, מאמת מטא-נתונים מחמיר ופרומפטים באנגלית למיון אירוע.

מתחילים כאן: למה המדריך שימושי

מפתח מכניס בטעות מפתח API למאגר; שליחתו ל-AI עלולה להפיץ אותו. סורקים מקומית, שומרים דוחות פרטיים ומעבירים רק מטא-נתונים מבוקרים. הסמן בתרגיל פיקטיבי. התוצר הוא ממצא, רשומה עם מזהים אטומים ותוכנית טיפול. מחיקת השורה אינה מספיקה לסוד שנחשף: יש לבטל או להחליף ולבדוק שימוש. המאמת כאן אינו גלאי סודות או מנקה כללי.

דוגמה מעשית

זו דוגמה לפורמט תשובה ולא תוצאת ביקורת של היישום שלכם. עקבו אחר השלבים והשוו קבצים, בדיקות ופלט אמיתיים ליעד. אם העוזר רק אומר שסיים, בקשו תוצר, ראיות ומה עדיין לא נבדק.

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.

המטרה

הסורק מזהה חשדות ו-AI מסייע לארגן תוכנית בדוקה. התרגיל כולל סימון מזויף במכוון וחמש בדיקות למניפסט מסירת מידע. אין צורך בפרטי גישה אמיתיים.

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. לבקש ראיות מה-AI

הפרומפט הראשון משתמש רק במניפסט שנבדק. סכימה מצמצמת שיתוף אך אינה מבטיחה שכל פלט סריקה נקי. בדקו בעצמכם את המידע לפני שליחה לעוזר חיצוני.

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

העתיקו את הפרומפט באנגלית לעוזר הפיתוח. הוא כולל את המאמר, הקבצים הזמינים ושלבי ההכנה.

הצגת פרומפט ההכנה
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.
GitleaksSecretsAICybersecurity