OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[security]: Fresh install ships with accepted placeholder root_api_key — no forced rotation, no warning

Open livechenjt-prog opened this issue 4 months ago • 1 comments

Bug Description

Fresh OpenViking server installs ship with root_api_key set to a short placeholder value (in our case a 13-character string like sk-ope...-key). The server accepts that placeholder as a valid credential — every ROOT-scoped Admin API endpoint works with it out of the box, and there is no first-run warning, no forced rotation, and no obvious [security]-flagged notice in the quickstart docs.

This is a footgun. Anyone who follows the quickstart and puts the server on a reachable interface (even localhost + a reverse proxy) has an effectively unauthenticated ROOT surface until they happen to notice.

Environment

  • OpenViking version: 0.4.4 (found originally); still reproducible on 0.4.7 with a clean install
  • ~/.openviking/ov.conf autogenerated by openviking-server init
  • auth_mode: api_key

Steps to Reproduce

  1. openviking-server init (or equivalent first-run setup) on a fresh box
  2. grep root_api_key ~/.openviking/ov.conf → returns a short placeholder value that looks like sk-ope…-key
  3. curl -H "Authorization: Bearer <placeholder>" http://localhost:1933/api/v1/observer/system → 200 OK
  4. No warning printed at server start, no CLI banner, no doc callout

Expected

At least one of, ideally all:

  1. Server refuses to start when root_api_key matches the shipped placeholder (fail-closed), with a clear message telling the user to rotate it (e.g. openssl rand -hex 32)
  2. openviking-server init generates a real random key at install time instead of using a placeholder
  3. If (1) is too aggressive, at minimum log a red-flagged warning on every start until the key is rotated, and document the exact rotation command in the quickstart

Actual

  • Placeholder key is treated as production-grade credential
  • No warning at start
  • Docs at docs.openviking.ai don't call this out as a required first step

Fix We Applied Locally

# on our server
NEW=$(openssl rand -hex 32 | sed 's/^/sk-ov-/')
sed -i "s|^root_api_key.*|root_api_key = $NEW|" ~/.openviking/ov.conf
sed -i "s|^root_api_key.*|root_api_key = $NEW|" ~/.openviking/ovcli.conf   # note: two files
systemctl restart openviking

70-character key, verified via GET back-read to the Admin API. Working since 2026-07-02.

Additional Context

  • Related to #1604 (observer endpoints access control) — our fix and #1604 are complementary: #1604 narrows what a leaked key can do, this issue prevents the key from being trivially guessable in the first place
  • Related to #1722 (root_api_key not honored in trusted mode) — different bug, same config surface; both suggest the auth config path needs a hardening pass
  • The fact that the same key must be written into two files (ov.conf and ovcli.conf) is itself a minor footgun — see our separate docs issue

Falsification Signal

If newer versions already generate a unique key at init time and reject the placeholder, please point at the commit and we'll close.

Severity

We'd call this Medium-High for anyone running OV outside a fully sandboxed network. The Admin API includes destructive operations (reindex, drop, etc.), so a leaked ROOT key is not a small blast radius.

livechenjt-prog avatar Jul 10 '26 08:07 livechenjt-prog

Thanks for reporting this security concern and for including a clear falsification signal.

Current main no longer ships a placeholder root_api_key: the default is None, and the examples do not contain a fixed root key. When first-run setup selects a non-local binding, the setup wizard requires a key and can generate a 64-character random value with secrets.token_hex(32). This behavior and its tests landed in #2952.

This addresses fresh initialization; existing configuration files are not silently rotated. Closing this as completed for the reported fresh-install behavior.

qin-ctx avatar Jul 14 '26 03:07 qin-ctx