Repository navigation
v5.7.6 - semantic_search Respects agent_fields for Chunk Content
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_searchbuilt chunk content from the raw value of the embedded text source before the per-recordagent_fieldsprojection ran, and itstext_fieldcheck compared against the class's embed sources but not itsagent_fieldsallowlist, 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 insideagent_fields. An explicittext_fieldnaming an embedded-but-hidden field fails closed withParse::Agent::AccessDenied(kind: :field_denied) before any search runs, rather than returning the text. - CHANGED: When
text_fieldis omitted on a class with anagent_fieldsallowlist, the tool infers the sole readable embed source, refuses with:field_deniedwhen no embedded source is readable, and asks for an explicittext_fieldwhen 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_fieldsallowlist behave exactly as before. - Direct
Parse::Retrieval.retrievecallers are application code rather than agents and are not subject toagent_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 runsCommit: be11ff3
Author: Adrian Curtin
Date: October 6, 2026