fix(opensearch): grant the search indexer cluster-level indices:data/read/mget

Merged
KH
7d ago
+5-3

Problem

OpenSearch checks _mget at the cluster level, the same way it checks _bulk. The documented relayhistory_indexer role grants indices:data/read/mget* only on the index pattern. That role appears in terraform/modules/aws/search/README.md and in the FGAC remedy printed by diagnose-install.py. With it, the indexer's tombstone check (packages/pipeline/src/search-index/opensearch.ts, deletedOnly, which runs after a _bulk version conflict) is refused.

Seen on the 2026.11.22 AA rehearsal on EKS, where the role was created from the documented body:

"message":"search index failed","stage":"search-index","session_id":"e2e-…-session","error_code":"unavailable","retryable":false,"error_detail":"http_403:security_exception"

The error repeated on each consumer tick for erased sessions. I reproduced it with a no-op signed probe sent as the indexer's own Pod Identity role:

POST relayhistory-transcript-events/_mget  -> 403 no permissions for [indices:data/read/mget] and User [name=arn:aws:iam::…:role/pippen/runtime/…-search-indexer, …]
POST relayhistory-transcript-events/_search, /_refresh, /_delete_by_query -> 200

First-time indexing is unaffected: a fresh session indexed 4/4 docs.

Fix

  • Add indices:data/read/mget to the role's cluster_permissions in the terraform search README and in the diagnose-install remedy.
  • Explain in the README why the indexer needs it.
  • Pin it in test_diagnose_install.py.

Not verified

  • The amended role has not been applied to a live domain yet. I didn't change the rehearsal domain's security config. To verify, re-PUT the role on pippen-sbx-aa-search and confirm the _mget probe returns 200 and the erased-session search index failed lines stop.
  • diagnose-install --only search only probes GET /_cluster/health, so it reported PASS on this install. It can't catch a missing cluster-level _mget.

On hold (merge-train:hold) until Khaliq reviews.

šŸ¤– Generated with Claude Code


Open in [code]smith Ā· Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Grants the search indexer cluster-level indices:data/read/mget so its tombstone check after a _bulk version conflict no longer returns 403.

  • OpenSearch authorizes _mget at cluster level, like _bulk; the documented relayhistory_indexer role only granted it on the index pattern, so erasing a session made its search-index stage fail with http_403:security_exception on every consumer tick.
  • Adds the permission to cluster_permissions in the terraform search README and in the diagnose-install.py FGAC remedy, and pins it in test_diagnose_install.py.

Migration

  • Re-PUT the role on existing domains from the amended role body to clear the 403s; first-time indexing is unaffected.