How to fix: Algolia admin API key in source
Algolia admin keys (long base64 strings) grant full search-index control.
Why it matters
An exposed Algolia admin key grants full control over all search indices: creating, deleting, and overwriting index data, creating new API keys, and accessing all records in every index. An attacker can corrupt search results site-wide or exfiltrate all indexed content.
Algolia admin keys (long base64 strings) grant full search-index control.
How to fix it
- 1Never expose the admin key to client code; use the search-only API key in browsers
- 2Rotate the admin key in Algolia Dashboard → Settings → API Keys
- 3Use Algolia's virtual API keys with per-user restrictions for authenticated search
Code examples
Correct: search-only key in client, admin key server-side
// Client component: use the search-only key
import algoliasearch from 'algoliasearch';
const client = algoliasearch(
process.env.NEXT_PUBLIC_ALGOLIA_APP_ID!,
process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_KEY! // search-only, safe in browser
);
// Server-only: use the admin key for indexing
// import { algoliasearch } from 'algoliasearch';
// const adminClient = algoliasearch(appId, process.env.ALGOLIA_ADMIN_KEY!);References
Detected automatically by VulnRadar. The check id is secret-algolia-admin-key, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is Algolia admin API 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-algolia-admin-key, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Algolia admin API 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.