Skip to content

chore: read the Orama search API key from env, not a hard-coded value #27

Description

@homer6

lib/data/index.ts guards on the search env vars but then ignores NEXT_PUBLIC_ORAMA_API_KEY and uses a hard-coded c1_… key:

// lib/data/index.ts
if (!process.env.NEXT_PUBLIC_ORAMA_PROJECT_ID || !process.env.NEXT_PUBLIC_ORAMA_API_KEY) {
  throw new Error('Orama project ID and API key must be set in environment variables.')
}
const config = {
  projectId: process.env.NEXT_PUBLIC_ORAMA_PROJECT_ID,
  apiKey: 'c1_… (hard-coded — value redacted here)',   // <- should be process.env.NEXT_PUBLIC_ORAMA_API_KEY
}

Impact

  • The key is a read-only, client-embedded public search key (it ships in the browser bundle by design), so this is not a security leak — but the code checks the env var and then doesn't use it, which is inconsistent and a maintainability smell (rotating the key means a code change, not an env change).

How it surfaced

Building a Docker image of the docs site for the orama-cloud-v1-operator self-host — the build needs NEXT_PUBLIC_ORAMA_* at prerender, and NEXT_PUBLIC_ORAMA_API_KEY is checked-but-unused.

Fix

Use process.env.NEXT_PUBLIC_ORAMA_API_KEY for config.apiKey (keep the guard).

Metadata

Metadata

Assignees

Labels

p4Low — nice to have, backlog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions