Skip to main content
CriticalSecretsOWASP A07:2021CWE-798

How to fix: Meilisearch master key in source

The Meilisearch master key grants full control: index/document CRUD, tenant creation, and key issuance.

Why it matters

An exposed Meilisearch master key gives an attacker complete control over your search engine: deleting all indexes, corrupting search data, creating API keys for persistent access, and reading all indexed documents including any PII in the search corpus.

The Meilisearch master key grants full control: index/document CRUD, tenant creation, and key issuance.

How to fix it

  1. 1Restart Meilisearch with a new master key (set MEILI_MASTER_KEY env var)
  2. 2Create a scoped search-only API key for browser use: POST /keys with searchRoutes only
  3. 3Create a scoped indexing API key for server-side indexing operations

Code examples

Create scoped keys: never use master key in app code

bash
# Create a search-only key for browser use (safe to expose)
curl -X POST 'http://localhost:7700/keys' \
  -H 'Authorization: Bearer MASTER_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"actions":["search"],"indexes":["products"],"expiresAt":null}'

# Create an indexing key for server-side use only
curl -X POST 'http://localhost:7700/keys' \
  -H 'Authorization: Bearer MASTER_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"actions":["documents.add","documents.delete"],"indexes":["products"],"expiresAt":null}'

References

Detected automatically by VulnRadar. The check id is secret-meilisearch-master-key, stable across every scan so you can filter or diff on it.

See every secrets check

Questions

How severe is Meilisearch master key in source?
VulnRadar rates this critical severity in the secrets category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id secret-meilisearch-master-key, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Meilisearch master key in source map to?
It maps to CWE-798. In the OWASP Top 10 it falls under A07:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for meilisearch master key in source

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Meilisearch master key in source | VulnRadar