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

מתחילים כאן: למה המדריך שימושי
ביישום B2B יש חשבוניות של חברות שונות. משתמש מחובר משנה מזהה: האם יוכל לקרוא חשבונית זרה? התחברות לבדה אינה מספיקה. המדריך הופך את הסיכון לכלל הרשאה, ביקורת AI עם ראיות ובדיקת נסיגה. התוצר הוא תיקון קטן שחוסם גישה אסורה ושומר על גישת הבעלים. הסרת בדיקת הארגון צריכה להפיל בדיקה בין לקוחות; הצלחת הבדיקות אינה אישור לכל היישום.
דוגמה מעשית
זו דוגמה לפורמט תשובה ולא תוצאת ביקורת של היישום שלכם. עקבו אחר השלבים והשוו קבצים, בדיקות ופלט אמיתיים ליעד. אם העוזר רק אומר שסיים, בקשו תוצר, ראיות ומה עדיין לא נבדק.
Finding: invoice lookup must enforce the authenticated tenant.
Evidence: exact policy function and the cross-tenant regression case.
Expected: owner in Acme allowed; the same user cannot read Beta data.
Remaining work: verify the actual HTTP route derives identity on the server.המטרה
השתמשו ב-AI כדי לחקור גבול אבטחה אחד, ואז הוכיחו את ההתנהגות בבדיקות. התרגיל בודק מי רשאי לקרוא חשבונית ביישום B2B. זו דוגמת מדיניות, לא מערכת התחברות מלאה.
1. הגדרת גבולות הבדיקה
הורידו את קובץ ZIP שלהלן, חלצו לתיקייה חדשה ופתחו אותה. נדרש Node.js 22 ומעלה בלבד, ללא תלות נוספת, חשבון או מפתח API. בדקו קוד שבבעלותכם או שיש לכם הרשאה לבחון.
2. הפעלת התרגיל המקומי
הריצו את הפקודות. שבע הבדיקות מכסות בעל חשבונית, חבר אחר, מנהל כספים, מעבר בין לקוחות ונתוני זהות חסרים. המדיניות המתוקנת עוברת אותן. כדי לראות נסיגה, הסירו זמנית את השוואת הלקוח בעותק ניסוי: בדיקות הגישה בין לקוחות אמורות להיכשל.
node --version
node --test lab.test.mjs3. לבקש ראיות מה-AI
תנו לעוזר את הפרומפט האנגלי הראשון. ממצא שימושי מציין קוד, זהות וגישה אסורה. אימות קובע מי המשתמש; הרשאה קובעת אם מותר לו לקרוא את החשבונית.
Act as a security reviewer for this LOCAL training project. Read lab.mjs and
lab.test.mjs before proposing changes. The actor must come from verified server
authentication. Map the invoice owner, tenant boundary and finance_admin exception.
Produce a table: claim, exact file/line, required attacker capability, affected
data, existing test and missing evidence. Separate confirmed findings from
hypotheses. Check same-tenant and cross-tenant cases, anonymous users and missing
fields. Do not assume that a hidden button or an unpredictable ID is authorization.
Do not contact a live service or change files yet.4. אימות התיקון
הפרומפט השני מגדיר תיקון מקומי מוסכם. בדקו גם חסימות וגם שימוש תקין. הצהרה של AI שהקוד בטוח אינה תוצאת בדיקה.
Implement only the smallest agreed authorization correction in this local exercise.
Keep the same-tenant owner and finance administrator use cases working. Add a
negative regression case that would fail with the original faulty policy. Run node
--test lab.test.mjs and report the real result, remaining assumptions and diff. Do
not weaken an existing check to make a test pass. In an application, derive identity
and roles from verified server authentication and enforce the policy on every
relevant request. Stop before deployment.5. יישום בפרויקט שלכם
ביישום אמיתי זהות ונתוני לקוח צריכים להגיע מאימות שרת מהימן. הוסיפו בדיקות API שמוכיחות כי JSON מהבקשה אינו בוחר משתמש או לקוח אחר. תעדו בנפרד סריקות ובדיקה אנושית; שבע הבדיקות אינן אישור אבטחה לכל היישום.
מקורות רשמיים
מכאן לפרויקט שלכם
הורידו את הקבצים, שמרו את המדריך או תנו לעוזר הפיתוח תיאור משימה מוכן.
מכינים את הפרויקט עם AI
העתיקו את הפרומפט באנגלית לעוזר הפיתוח. הוא כולל את המאמר, הקבצים הזמינים ושלבי ההכנה.
הצגת פרומפט ההכנה
Read this tutorial as reference material:
https://nethanelfitoussi.com/article/ai-security-code-review?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/b10c304f-9e50-4c20-8185-b8190a92c5cd.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 a security reviewer for this LOCAL training project. Read lab.mjs and
lab.test.mjs before proposing changes. The actor must come from verified server
authentication. Map the invoice owner, tenant boundary and finance_admin exception.
Produce a table: claim, exact file/line, required attacker capability, affected
data, existing test and missing evidence. Separate confirmed findings from
hypotheses. Check same-tenant and cross-tenant cases, anonymous users and missing
fields. Do not assume that a hidden button or an unpredictable ID is authorization.
Do not contact a live service or change files yet.
Implement only the smallest agreed authorization correction in this local exercise.
Keep the same-tenant owner and finance administrator use cases working. Add a
negative regression case that would fail with the original faulty policy. Run node
--test lab.test.mjs and report the real result, remaining assumptions and diff. Do
not weaken an existing check to make a test pass. In an application, derive identity
and roles from verified server authentication and enforce the policy on every
relevant request. Stop before deployment.
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.

