الموارد · 58

RAG: التحقق من حقوق الوصول إلى المستندات وعزلها

اختبار الاسترجاع والاستشهادات وذاكرة التخزين المؤقت والإلغاء لضمان احترام مساعد المستندات لأذونات كل مستخدم.

مُحدَّث · 7 min

بنية حوسبة ذكاء اصطناعي خاصة في مختبر خالٍ رسم توضيحي تحريري مولّد بالذكاء الاصطناعي

ما يُساعد هذا الدليل على تحقيقه

  • تحديد الحدود
  • التصفية قبل العرض
  • ذاكرة تخزين مؤقت منفصلة
  • ممارسة إلغاء الصلاحيات

فحص سريع

  • هل مساحة اسم متجه منفصلة كافية؟
  • هل يجب أن تكون الصلاحيات في المطالبة؟
  • كيف يمكن تجنب المستندات السرية في الاختبار؟

طريقة خطوة بخطوة

  1. 1

    تحديد الحدود

    تعيين مالك ونطاق وقاعدة وصول لكل مستند. يصف مشروع OWASP تسرب البيانات بين السياقات نتيجةً لعدم توافق أذونات مخزن المتجهات. كما تُعامل طريقتنا المقترحة الأجزاء والبيانات الوصفية ككائنات محمية.

    المخرج: مُخرَج: جرد المستندات والمجموعات والنطاقات.

  2. 2

    التصفية قبل العرض

    فرض التخويل في خدمة الاسترجاع قبل وصول أي جزء إلى النموذج. يشمل ذلك البحث المتجهي، والبحث المعجمي، والرسوم البيانية، والتنزيلات المباشرة. لا يمكن للتعليمات الفورية أن تحل محل التخويل من جانب الخادم.

    المخرج: مُخرَج: نقاط اتخاذ القرار وسلوك الهوية المفقودة.

  3. 3

    ذاكرة تخزين مؤقت منفصلة

    جرد نتائج البحث والمحادثات والاستشهادات والإجابات المحفوظة. التحقق من أن إعادة الاستخدام تعتمد على سياق الوصول ذي الصلة. لا يُثبت حقل الفهرس الذي يُسمي عميلًا العزلَ بحد ذاته.

    المخرج: مُخرَج: مفاتيح التخزين المؤقت وسيناريوهات الفصل.

  4. 4

    ممارسة إلغاء الصلاحيات

    باستخدام مستندات اختبار غير حساسة، قم بإزالة الوصول، وحذف مستند، وتغيير مجموعة. أعد تشغيل محادثة فُتحت قبل التغيير. قياس وقت تعطل الأجزاء والروابط والإجابات المحفوظة.

    المُخرَج: أدلة الإلغاء المُؤرَّخة والفجوات.

  5. 5

    الاحتفاظ بالاختبارات السلبية.

    طرح السؤال نفسه كمستخدم مُصرَّح له، ومجموعة أخرى، وهوية غير معروفة. فحص أسماء الملفات والمقتطفات والاقتباسات والسجلات. إعادة التشغيل بعد تغييرات الفهرس أو الرابط؛ عدد قليل من الحالات الناجحة لا يُثبت سوى تغطية محدودة.

    المُخرَج: مصفوفة الاختبار ومسؤول التصحيح.

ورقة عمل قابلة لإعادة الاستخدام

أكمل بملاحظاتك المعتمدة. هذه الحقول عبارة عن نموذج عمل، وليست نتائج مُلاحظة.

الحقلالمعلومات المطلوب تسجيلها
المستند / الجزءالمالك والنطاق
هوية الاختبارالمجموعة المسموح بها، مجموعة أخرى، الهوية المفقودة
مسار الوصولالاسترجاع، الاستشهاد، الملف أو ذاكرة التخزين المؤقت
النتيجةالمتوقع، الملاحظ، التاريخ والتصحيح

مثال عملي افتراضي

حالة توضيحية

مثال افتراضي: البيانات لا تصف عميلاً أو نتيجة مرصودة. يستخدم قسمان بصلاحيات مختلفة مساعداً يبحث في مجموعة وثائق واحدة دون ترشيح متسق.

القرار والأدلة المتوقعة

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

تمييز الآليات

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

مؤشرات الإدارة

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

الأخطاء الشائعة

  • تغطية المسارات المعجمية والروابط المباشرة أيضًا
  • عدم تفويض الصلاحيات إليه
  • التحقق من سياق الأذونات قبل إعادة الاستخدام

الأسئلة المتكررة

هل مساحة اسم متجه منفصلة كافية؟

يساعد في تقسيم البيانات، ولكن يجب على ذاكرات التخزين المؤقت وروابط الملفات والأدوات الالتزام بنفس الحدود.

هل يجب أن تكون الصلاحيات في المطالبة؟

قد يصل السياق المفيد إلى النموذج؛ يجب على الخدمة التي تعرض البيانات فرض قرارات الوصول.

كيف يمكن تجنب المستندات السرية في الاختبار؟

أنشئ مستندات افتراضية لكل مجموعة بعلامات مميزة، ثم افحص الإجابات والاستشهادات.

RAG: حقوق الوصول والاستشهادات والذاكرة المؤقتة

الملاحظات المرجعية المفصّلة متاحة باللغة الإنجليزية في هذه النسخة.

An accurate answer can disclose a forbidden document. Retrieval relevance, citation validity and access authorisation are separate checks. The service providing passages must enforce the current identity’s rights before exposing them to the model.

Fictional CIE teaching set: four technical identities, six documents and three states. It illustrates a proposed policy without querying your system, authenticating real users or measuring product security. OWASP references describe risk families; the scenarios, rules and numbers below are our examples.

References consulted on .

منطقتان منفصلتان لتخزين الوثائق في مختبر سيبراني خالٍ رسم توضيحي تحريري مولّد بالذكاء الاصطناعي
Two storage zones in an empty lab. The depicted separation establishes neither real isolation nor certification.

Explore the fictional document policy

Choose identity, document, state and access path. The result is the decision expected under this policy, not an observed test of your application. All four paths should enforce the same access decision.

Local browser calculation with no connection to an AI model, vector database or account. No free-text field, secret or document to send.

Matrix of 24 expected decisions

Ops has group ops; Alpha has alpha; Beta has beta. The unauthenticated identity has no access. Documents without an explicit rule are denied.

10 allowed accesses across 24 fictional combinations

1 · Initial rights
Identity / documentCross-team procedureAlpha noteBeta noteOps fileOld Alpha noteUnclassified document
Ops serviceAllowedAllowedAllowedAllowedAllowedDenied
Alpha serviceAllowedAllowedDeniedDeniedAllowedDenied
Beta serviceAllowedDeniedAllowedDeniedDeniedDenied
UnauthenticatedDeniedDeniedDeniedDeniedDeniedDenied

Three states with reproducible outcomes

Three states with reproducible outcomes
Fictional statePolicy changeAllowed accesses / 24
1 · Initial rightsOps has group ops; Alpha has alpha; Beta has beta. The unauthenticated identity has no access. Documents without an explicit rule are denied.10 / 24
2 · Alpha group removedAlpha remains authenticated but no longer has any required group. The cross-team procedure also requires one of ops, alpha or beta, so Alpha loses access to it as well. Ops and Beta groups are unchanged.7 / 24
3 · Group removed and old note deletedAlpha’s group removal persists. The old Alpha note is deleted and denied to every identity, including Ops. Other document rules stay unchanged.6 / 24

These counts describe a small closed set, not a security rate. State changes are instant in this demonstration. In production, measure the actual delay on every path; revoking a right cannot retroactively erase a copy already read or exported.

Twelve replay cases with positive controls and expected evidence

Fictional scenarios. Buttons populate the demonstration and run no penetration test. To assess an application, compare each expectation with an actual trace from an authorised environment using sentinel data.

Twelve replay cases with positive controls and expected evidence
Situation and referenceDemonstration inputDecision and evidence to retain
The group’s own document

OWASP · LLM08:2025 Vector and Embedding Weaknesses

Alpha service
Alpha note
1 · Initial rights
Vector retrieval

Allowed in this example

Positive control: retain the permitted fictional passage and service decision. A system denying everything does not pass the functional test.

Another group’s document

OWASP · LLM08:2025 Vector and Embedding Weaknesses

Beta service
Alpha note
1 · Initial rights
Vector retrieval

Denied in this example

Check that the passage, sensitive title and metadata are absent from data supplied to the model.

The secondary lexical branch

OWASP · LLM08:2025 Vector and Embedding Weaknesses

Beta service
Alpha note
1 · Initial rights
Lexical / hybrid retrieval

Denied in this example

Retain each branch’s decisions before fusion and the final result. No vector leak does not establish lexical coverage.

A known citation identifier

OWASP · API1:2023 Broken Object Level Authorization

Beta service
Alpha note
1 · Initial rights
Citation / file resolution

Denied in this example

Call citation resolution using the Beta test identity; retain the object denial, not just the absence of a link in the answer.

An old cached answer

OWASP · LLM08:2025 Vector and Embedding Weaknesses

Alpha service
Alpha note
2 · Alpha group removed
Cached answer or passage

Denied in this example

Create the answer before group removal and replay afterwards. Check that old passages are not returned under current rights.

The cross-team procedure after removal

OWASP · API1:2023 Broken Object Level Authorization

Alpha service
Cross-team procedure
2 · Alpha group removed
Vector retrieval

Denied in this example

This document requires an explicit group; remaining authenticated is insufficient. Retain the rule and membership change explaining the denial.

The unchanged group

OWASP · LLM08:2025 Vector and Embedding Weaknesses

Beta service
Beta note
2 · Alpha group removed
Lexical / hybrid retrieval

Allowed in this example

Beta positive control: confirm that revocation handling does not block another authorised group.

The deleted but remembered document

OWASP · API1:2023 Broken Object Level Authorization

Ops service
Old Alpha note
3 · Group removed and old note deleted
Cached answer or passage

Denied in this example

Try an old citation and cache after deletion. Record object state and refusal to return it; separately verify removal of copies under your policy.

A document without a rule

OWASP · API1:2023 Broken Object Level Authorization

Ops service
Unclassified document
1 · Initial rights
Vector retrieval

Denied in this example

Even Ops has no implicit privilege. Retain the handling of an unclassified document and the process for correcting its access rule.

Access without an authenticated identity

OWASP · API1:2023 Broken Object Level Authorization

Unauthenticated
Cross-team procedure
1 · Initial rights
Citation / file resolution

Denied in this example

Check citation paths and their errors: reserved content must not be exposed during a denied attempt.

A source claims higher authority

OWASP · LLM01:2025 Prompt Injection

Beta service
Ops file
1 · Initial rights
Cached answer or passage

Denied in this example

A sentence inside the document changes neither groups nor service rules. Retain the technical denial even if model wording is persuasive.

The Ops file remains allowed

OWASP · LLM06:2025 Excessive Agency

Ops service
Ops file
3 · Group removed and old note deleted
Citation / file resolution

Allowed in this example

Positive control after both changes: establish this specific access without granting Ops the unclassified or deleted document.

Document six technical boundaries

Collection
Retain document origin, version and status. Internal content can also carry hostile instructions. OWASP · LLM01:2025 Prompt Injection →
Authorisation
Check identity, object and groups in the service. Prompt text is not the permissions engine. OWASP · API1:2023 Broken Object Level Authorization →
Generation and rendering
Validate outputs for their destination: text, HTML, query or tool argument. A plausible answer is not directly executable input. OWASP · LLM05:2025 Improper Output Handling →
Tool action
Separate reading, proposing and modifying. Limit function, permission and autonomy to the task; read access does not authorise sending. OWASP · LLM06:2025 Excessive Agency →
Configuration
Keep secrets out of the system prompt. Confidentiality of its wording does not replace access controls. OWASP · LLM07:2025 System Prompt Leakage →
Consumption
Set request, duration and action limits, then exercise stopping and degraded operation with a demonstration budget. OWASP · LLM10:2025 Unbounded Consumption →

Useful traces without copying documents

Link test identifier, policy version, technical identity and effective groups, document identifier/version, access path, decision and timestamp. For revocation, add the change time and first observed denial per path. Use demonstration markers instead of secrets; restrict logs to necessary information and protect their access.

Continue with prompt injection testing →

Sources, editions and scope of the example

OWASP 2025 and API 2023 editions are explicitly identified. NIST AI 100-2 E2025 is a taxonomy published in March 2025; its page notes an April PDF correction and a June 2025 potential-update note. None certifies this simulator or your application.

RAG: الملاءمة والترتيب

الملاحظات المرجعية المفصّلة متاحة باللغة الإنجليزية في هذه النسخة.

Relevance and permission need separate checks

A relevant document may be forbidden to the requester. Build the evaluation corpus within accessible scope and test denials independently of ranking scores.

  • Keep permissions and document versions with the test set.
  • Check revocation, deletion and citation paths before measuring relevance.
  • Do not use an nDCG improvement as evidence that permissions are respected.

Explore ranking measures and relevance judgments →

Stanford CS276 · Retrieval evaluation · 2019 course archive · PDF pp. 3, 5–6 · consulted 2026-10-23

NIST TREC · Reciprocal rank definition · Repository snapshot 35cf096ba6d5ae08ca4803c056b31ed61a56a6d4 · consulted 2026-10-23

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

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

تاريخ مراجعة المراجع .