Risorse · 58

RAG: verifica dei diritti di accesso al documento e dell'isolamento

Testare il recupero, le citazioni, le cache e la revoca in modo che un assistente di documentazione rispetti le autorizzazioni di ciascun utente.

Aggiornato · 8 min

Infrastruttura di calcolo IA privata in un laboratorio vuoto Illustrazione editoriale generata con IA

Obiettivi di questa guida

  • Definizione dei limiti
  • Filtro prima dell'esposizione
  • Cache separate
  • Esercizio di revoca

Verifica rapida

  • È sufficiente uno spazio dei nomi vettoriale separato?
  • Le autorizzazioni devono essere presenti nel prompt?
  • Come si possono evitare documenti riservati durante i test?

Metodo passo passo

  1. 1

    Definizione dei limiti

    Assegnare a ciascun documento un proprietario, un ambito e una regola di accesso. OWASP descrive la fuga di informazioni tra contesti diversi dovuta a permessi di archiviazione vettoriale non allineati. Il nostro metodo proposto tratta anche i chunk e i metadati come oggetti protetti.

    Risultato: inventario di documenti, gruppi e ambiti.

  2. 2

    Filtro prima dell'esposizione

    Applicare l'autorizzazione nel servizio di recupero prima che un chunk raggiunga il modello. Coprire la ricerca vettoriale, la ricerca lessicale, i grafici e i download diretti. Un'istruzione di richiesta non può sostituire l'autorizzazione lato server.

    Risultato: punti decisionali e comportamento in caso di identità mancante.

  3. 3

    Cache separate

    Inventariare i risultati di ricerca, le conversazioni, le citazioni e le risposte conservate. Verificare che il riutilizzo dipenda dal contesto di accesso pertinente. Un campo indice che nomina un cliente non dimostra di per sé l'isolamento.

    Risultato: chiavi di cache e scenari di separazione.

  4. 4

    Esercizio di revoca

    Utilizzando documenti di test non sensibili, rimuovere l'accesso, eliminare un documento e modificare un gruppo. Riprodurre una conversazione aperta prima della modifica. Misurare quando blocchi di testo, collegamenti e risposte memorizzate diventano non disponibili. Risultato

    Risultato: prove di revoca con timestamp e lacune.

  5. 5

    Mantenere i test negativi.

    Porre la stessa domanda come un utente autorizzato, un altro gruppo e un'identità sconosciuta. Ispezionare nomi di file, estratti, citazioni e log. Riprodurre dopo modifiche all'indice o ai connettori; pochi casi di successo garantiscono solo una copertura limitata.

    Risultato: matrice dei test e responsabile della correzione.

Foglio di lavoro riutilizzabile

Completare con le proprie osservazioni autorizzate. Questi campi costituiscono un modello di lavoro, non risultati osservati.

CampoInformazioni da registrare
Documento / bloccoProprietario e ambito
Test di identitàGruppo consentito, altro gruppo, identità mancante
Percorso di accessoRecupero, citazione, file o cache
RisultatoPrevisto, osservato, data e correzione

Esempio pratico fittizio

Situazione illustrativa

Esempio fittizio: questi dati non descrivono clienti o risultati osservati. Due reparti con diritti diversi interrogano lo stesso corpus tramite un assistente che non applica filtri coerenti.

Decisione e prove attese

Creare account e documenti fittizi con permessi distinti. Controllare ricerca, passaggi inviati al modello, citazioni e rifiuti. Impedire l’esposizione non autorizzata prima della generazione. Chiedere al modello di rispettare i permessi non sostituisce il controllo degli accessi.

Distinguere i meccanismi

MeccanismoScopoVerifica o limitazione
Filtro di recuperoLimita i blocchi recuperatiCopri anche i percorsi lessicali e i collegamenti diretti
Richiesta di rifiutoGuida il comportamento della rispostaNon delegare l'autorizzazione
Cache di rispostaRiutilizza un risultatoVerifica il contesto dei permessi prima del riutilizzo

Indicatori di gestione

IndicatoreCosa misuraPrima azione
Perdite di dati osservateDati di test esposti al di fuori dell'ambitoBlocca l'utilizzo interessato e ispeziona la causa
Ritardo di revocaTempo fino a quando tutti i percorsi testati rifiutano l'accessoCache dei nomi ancora accessibili
Copertura dei percorsiConnettori e modalità di recupero utilizzatiIdentifica i percorsi non testati

Errori comuni

  • Copri anche i percorsi lessicali e i collegamenti diretti
  • Non delegare l'autorizzazione
  • Verifica il contesto dei permessi prima del riutilizzo

Domande frequenti

È sufficiente uno spazio dei nomi vettoriale separato?

Aiuta a partizionare i dati, ma cache, collegamenti ai file e strumenti devono rispettare lo stesso confine.

Le autorizzazioni devono essere presenti nel prompt?

Il contesto utile può raggiungere il modello; il servizio che espone i dati deve applicare le decisioni di accesso.

Come si possono evitare documenti riservati durante i test?

Creare documenti sentinella fittizi per ciascun gruppo con marcatori distinti, quindi esaminare le risposte e le citazioni.

RAG: diritti, citazioni e cache

Le note dettagliate di questa edizione sono disponibili in inglese.

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 .

Due aree separate di archiviazione documentale in un laboratorio informatico vuoto Illustrazione editoriale generata con IA
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: pertinenza e ordinamento

Le note dettagliate di questa edizione sono disponibili in inglese.

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

Riferimenti ufficiali

I riferimenti supportano il metodo. Adattare i controlli al proprio contesto; non costituiscono una certificazione. I titoli dei riferimenti originali e i documenti di origine potrebbero essere in un'altra lingua.

Riferimenti consultati il .