Skip to content

v5.7.6 - semantic_search Respects agent_fields for Chunk Content

Choose a tag to compare

@AdrianCurtin AdrianCurtin released this 06 Oct 18:35
· 8 commits to main since this release
be11ff3

semantic_search no longer returns hidden fields as chunk content

A focused security fix for the semantic_search agent tool. When a class embedded a field that its agent_fields allowlist hides from agents (for example, searching on body while exposing only title), the tool returned that field's text as chunks[].content, even though the documents map correctly omitted it. Chunk text is now restricted to fields the agent may read.

Changes

  • FIXED: semantic_search built chunk content from the raw value of the embedded text source before the per-record agent_fields projection ran, and its text_field check compared against the class's embed sources but not its agent_fields allowlist, so an agent could read a hidden field's full text through search results. A text source is now usable only when it is both an embed source and inside agent_fields. An explicit text_field naming an embedded-but-hidden field fails closed with Parse::Agent::AccessDenied (kind: :field_denied) before any search runs, rather than returning the text.
  • CHANGED: When text_field is omitted on a class with an agent_fields allowlist, the tool infers the sole readable embed source, refuses with :field_denied when no embedded source is readable, and asks for an explicit text_field when several are readable. Reranker input is built from the same text source, so it is covered by the same check.

Behavior Notes

  • Classes without an agent_fields allowlist behave exactly as before.
  • Direct Parse::Retrieval.retrieve callers are application code rather than agents and are not subject to agent_fields; they are unaffected.
  • A class may still embed a field it hides from agents. The embedding keeps powering similarity search; only the hidden text is withheld from the agent.

Code Example

class Article < Parse::Object
  property :title, :string
  property :body, :string
  property :embedding, :vector, dimensions: 1024, provider: :voyage
  embed :body, into: :embedding     # search on the body...
  agent_searchable field: :embedding
  agent_fields :title               # ...but agents may only read the title
end

agent.execute(:semantic_search, class_name: "Article", query: "refund policy")
# 5.7.5: chunks[].content contained the hidden body text
# 5.7.6: refused with error_code :access_denied (kind :field_denied); no search runs

Commit: be11ff3
Author: Adrian Curtin
Date: October 6, 2026