Skip to main content
CriticalSecretsOWASP A07:2021CWE-798

How to fix: Typesense admin API key in source

Typesense admin keys grant full schema, document, and key-management control on the cluster.

Why it matters

An exposed Typesense admin key lets an attacker delete all collections, overwrite document data, generate new API keys for persistent access, and modify cluster configuration, a complete takeover of your search infrastructure.

Typesense admin keys grant full schema, document, and key-management control on the cluster.

How to fix it

  1. 1Generate new keys via the Typesense /keys endpoint using the current admin key
  2. 2Restart Typesense with a new --api-key to invalidate all existing keys
  3. 3Use search-only keys (actions: ["documents:search"]) in browser code

Code examples

Create search-only key for browser use

bash
# Create a scoped search-only key (safe to use in browsers)
curl -X POST 'http://localhost:8108/keys' \
  -H 'X-TYPESENSE-API-KEY: ADMIN_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"actions":["documents:search"],"collections":["products"],"description":"Search-only key"}'

Use search-only key in Next.js client

TypeScript
import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter';

// Use search-only key: safe to ship to browsers
const adapter = new TypesenseInstantSearchAdapter({
  server: {
    apiKey: process.env.NEXT_PUBLIC_TYPESENSE_SEARCH_KEY!,  // search-only
    nodes: [{ host: 'your-cluster.typesense.net', port: 443, protocol: 'https' }],
  },
  additionalSearchParameters: { query_by: 'name,description' },
});

References

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

See every secrets check

Questions

How severe is Typesense 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-typesense-admin-key, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Typesense 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.

Propose a checkHow a check is built

Scan your own site for typesense admin api 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: Typesense admin API key in source | VulnRadar