---
title: "Verify search excludes records outside the current user permissions"
description: "Search for a unique term shared by accessible and restricted fixture records, then verify results, counts, and previews honor the application search policy."
canonical_url: "https://vostride.com/agent-library/authorization/restricted-search-results.md"
md_url: "https://vostride.com/agent-library/authorization/restricted-search-results.md"
content_kind: "recipe"
topic: "authorization"
---

# Verify search excludes records outside the current user permissions

Search for a unique term shared by accessible and restricted fixture records, then verify results, counts, and previews honor the application search policy.

## Risk

Search can leak private titles or snippets even when opening the record is denied. An accessible control record with the same term proves the query actually ran and avoids a false pass caused by an empty or broken search index.

## Fixtures

- Two records containing the same unique run-specific search phrase, one visible to the test member and one restricted.
- A fixture readiness hook that confirms both records have reached the search index.
- Documented rules for result totals, autocomplete suggestions, and previews.

## Steps

1. Sign in as the member and verify the accessible fixture record can be opened normally.
2. Wait for the index-readiness hook to confirm both fixture records are indexed, then search the exact shared phrase.
3. Verify the accessible title appears and the restricted title, description marker, and preview do not appear.
4. Inspect displayed result counts and autocomplete suggestions according to the documented privacy policy, checking that they do not reveal restricted-record metadata.
5. Open the accessible result and verify its stable record identity; use the permission hook to confirm the other record remains restricted.

## Expected results

- Search returns the permitted control record for the unique phrase.
- Restricted record title and body snippets are absent from member-visible search surfaces.
- Counts and suggestions follow the explicit product privacy contract.

## False-pass traps

- No search results can mean indexing failed rather than permission filtering worked.
- Checking only the main result list can miss restricted content in autocomplete or preview panels.

## Cleanup

- Delete both run-owned search records and remove them from the test index through normal fixture cleanup.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa hooks](/docs/agent-qa/guides/hooks.md)
- [agent-qa auth state](/docs/agent-qa/guides/auth-state.md)

- [Authorization and permission QA recipes](/agent-library/authorization.md)
- [Software factory QA library](/agent-library.md)
