Subscribe to the Non-Human & AI Identity Journal

What do teams get wrong about similarity scores and prompt rules in RAG systems?

They confuse relevance with permission. Similarity scores only rank semantic closeness, and prompt rules only steer probabilistic behaviour. Neither one can determine whether content is allowed to influence policy decisions or tool calls, so both need to be backed by explicit authorization logic.

Why This Matters for Security Teams

Similarity scores in retrieval-augmented generation can make a document look relevant without making it safe, authorised, or appropriate for policy influence. Prompt rules can steer an agent’s language, but they do not create access control. That distinction matters because RAG systems often sit between secrets, internal knowledge, and tool execution, where a mistaken assumption about “relevance” becomes a governance failure.

NHI Management Group’s Ultimate Guide to NHIs highlights how often organisations leave sensitive identity material exposed, which is exactly the kind of content that retrieval layers can surface if teams rely on scoring alone. NIST’s NIST Cybersecurity Framework 2.0 reinforces that access decisions need explicit governance, not implicit trust in model behaviour.

The practical mistake is treating the retrieval layer as if it were an authorization layer. It is not. A high cosine score only means semantic proximity, and a well-written system prompt only means the model is being nudged toward a desired response. In practice, many security teams encounter prompt leakage, data overexposure, or tool misuse only after a retrieval hit has already influenced output or action, rather than through intentional design.

How It Works in Practice

Teams usually need to separate three controls: retrieval ranking, content eligibility, and downstream action authorization. Similarity scoring belongs in the first layer. It helps rank candidate passages, but it should not decide whether a chunk from a private policy, customer record, or secret-bearing runbook can be used by the model. Authorization must happen before retrieval, during retrieval, or immediately before tool execution, depending on the architecture.

A safer design is to attach identity- and policy-aware filters to the index, then evaluate runtime policy before any content is passed to the model. Current guidance suggests using explicit allowlists, tenant scoping, and context-aware policy checks rather than assuming prompt instructions will constrain behaviour. For organizations managing secrets and service identities, the Ultimate Guide to NHIs is a useful reminder that sensitive non-human credentials are often more exposed than teams expect.

  • Use similarity scores only to rank candidates, not to authorize them.
  • Enforce document-level and tenant-level access filters before retrieval.
  • Require explicit approval logic before retrieved content can drive tool calls.
  • Log which chunks were retrieved, why they passed policy, and what action followed.

Prompt rules still matter, but they should be treated as behavioral guidance for the model, not as a security boundary. NIST CSF 2.0 emphasizes governance and access control outcomes, which maps cleanly to RAG systems that need to prove why a model saw a record, not just why it summarized it. These controls tend to break down in shared indexes with weak metadata tagging because semantic similarity cannot compensate for missing entitlement data.

Common Variations and Edge Cases

Tighter retrieval filtering often reduces answer quality or recall, so organisations must balance precision against the risk of exposing material the requester should never influence. That tradeoff becomes sharper in multi-tenant RAG, regulated data domains, and agentic workflows where retrieved content can trigger tool calls or policy recommendations.

There is no universal standard for prompt-rule enforcement as a security control. Best practice is evolving, but the current consensus is that prompts can reinforce policy, not replace it. In some environments, especially where retrieval spans multiple repositories with inconsistent tagging, teams add a second authorization check at generation time to block disallowed citations or tool inputs.

Edge cases also include cached retrieval results, cross-session memory, and embedded vector stores containing content with changing sensitivity. If the underlying source changes permission status, the similarity score does not change with it. That is why permission metadata and revocation workflows need to be part of the design, not an afterthought. NHI Management Group’s Ultimate Guide to NHIs is directly relevant here because it shows how often identity and secret hygiene failures create downstream exposure for systems that were assumed to be “just search.”

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Agentic AI Top 10 A3 RAG prompt rules fail when agents treat retrieval as authority.
CSA MAESTRO M1 MAESTRO addresses runtime governance for agentic data access and actions.
NIST AI RMF GOVERN AI RMF governance covers the need for explicit oversight beyond prompt behavior.

Define accountable ownership, policy, and review for retrieval and generation decisions.