Skip to content

Security: sipcapture/homer

docs/SECURITY.md

Security hardening (11.0.282+)

Homer 11.0.282–11.0.284 closes three coordinator security issues. 11.0.313 hardens the node HTTP /query API and blocks DuckDB external scanners. This page summarizes operator impact and how upgrades stay compatible with existing installs.

Summary

Issue Risk (before) Fix Typical upgrade impact
Empty coordinator.jwt.secret Protected API routes were unauthenticated JWT middleware always enforced; empty secret → auto-generated persisted secret Installs with explicit JWT env/config: no change. Installs with empty secret: API now requires login or Auth-Token
Shipped JWT placeholder change-this-to-a-secure-random-string-in-production Anyone who can reach the coordinator can forge an admin token Placeholder (and your-secret-token-here) is ignored; a random secret is generated and persisted. Official Compose no longer sets it Installs that set their own secret: no change. Installs still using the public string: sessions signed with it stop working
Example JWT placeholder change-me-in-production Same forgery, through the example generator and examples/homer-modular.json (11.0.385, GHSA-j74q-m2gx-fx2f) That string is ignored too. homer system --generate-example-config and the modular example leave the secret empty Installs with their own secret: no change. Installs still using change-me-in-production: sessions signed with it stop working
Default admin sipcapture Predictable first-login password No compose hash; random bcrypt at first boot; JWT must_change_password until a new password is set Existing users row with sipcapture hash: login works, then the UI/API require a password change
POST /api/v4/statistics/query rawquery Unvalidated SQL passthrough Same ValidateRawSQL rules as /api/v4/query Legitimate SELECT / WITH / SHOW queries: no change
Node POST /query (port+1) Unauthenticated arbitrary DuckDB SQL / file read ValidateRawSQL always; Bearer auth when flight_server.auth_token set; auto-token on non-loopback bind All-in-one with default 0.0.0.0: token auto-persisted; coordinator local node gets token automatically
sqlite_scan / external scanners Authenticated bypass of SQL denylist Blocked in ValidateRawSQL Legitimate lake SELECTs: no change
sniff_csv, unlisted readers, FROM 'path' Authenticated file read past the function denylist Reader routines blocked by name shape (read_, sniff_, parquet_, http_, iceberg_, delta_, st_read, *_scan, *_attach) plus getenv / duckdb_secrets; string literals in table position rejected Legitimate lake SELECTs: no change
Raw SQL that gets past ValidateRawSQL Each new DuckDB reader or path trick reopened host file access Node query DuckDB runs with enable_external_access = false; only lake paths, catalog files and the spill directory are allowed Standalone nodes: no change for lake queries. All-in-one: reads move to the node DuckDB; search_buffer rows are copied in for each search. Tiered all-in-one (storage_policy) still reads on the writer DuckDB. Opt out with node.duckdb_sandbox: false
Node POST /vacuum expire_older_than SQL injection into ducklake_expire_snapshots Duration is parsed and rendered as integer seconds 1 hour, 7 days, Go durations (1h): no change. Other values: 400
Agent subscription writes and DELETE /api/v4/alerts Any logged-in user could change capture-agent registrations or wipe stored alerts POST/PUT/DELETE /api/v4/agents/subscriptions and DELETE /api/v4/alerts require admin. GET stays authenticated. POST /api/v4/alerts stays authenticated so Grafana webhooks keep working Admin sessions and admin Auth-Token (user_group: admin): no change. Non-admin callers of those writes: 403
HEP mutual_tls with empty cacert TLS and HTTPS ingest accepted any client Those receivers refuse to start until cacert is set mutual_tls off, or on with a CA file: no change. mutual_tls on and cacert empty: that receiver does not listen

GitHub Security Advisories: GHSA-rqcc-94gv-wjm9, GHSA-6xp5-7rcx-xfgx, GHSA-f46q-3v67-fmm4, GHSA-rm5w-rqr7-2h54, GHSA-4687-q698-mccv, GHSA-263f-5xrw-c34r, GHSA-c5mq-r27x-v29v, GHSA-q7c2-m23h-43g9, GHSA-9crr-mrfj-hjxr, GHSA-9r5f-8f6c-8pff, GHSA-2v9j-m2v3-x9qr.


JWT secret (coordinator.jwt.secret)

Before: When the signing secret was empty, JWT middleware was not registered and handlers skipped validation — every protected route was open.

After:

  1. Non-empty secret in config or env — unchanged (recommended for production).
  2. Empty secret — on coordinator startup Homer generates a random secret, writes /.homer_jwt_secret beside coordinator.settings_db_path (mode 0600), and reuses it on restart so sessions stay valid.
  3. Protected routes under /api/v1, /api/v3, and /api/v4 always require authentication (JWT cookie/Bearer, or valid Auth-Token when api_settings.enable_token_access is true).
"coordinator": {
  "settings_db_path": "/var/lib/homer/homer_settings.duckdb",
  "jwt": {
    "secret": "use-a-long-random-string-at-least-32-bytes",
    "expire_hours": 24
  }
}

Environment: HOMER_COORDINATOR_JWT_SECRET.

Docker Compose (examples/docker/docker-compose.yaml) does not set HOMER_COORDINATOR_JWT_SECRET. Homer generates a random key and persists .homer_jwt_secret. The old public values change-this-to-a-secure-random-string-in-production (11.0.364+, GHSA-9crr-mrfj-hjxr) and change-me-in-production (11.0.385, GHSA-j74q-m2gx-fx2f) are ignored. The node placeholder your-secret-token-here is ignored the same way; a non-loopback bind persists .homer_node_auth_token. Set your own long random values when you want to pin them.


Bootstrap admin password (coordinator.auth)

Before: Internal auth normalization injected a fixed SHA-256 hash for cleartext password sipcapture.

After:

Config First startup (no users row) Existing users row
Explicit admin_password_hash or env Uses configured hash Unchanged if row already has a password
Empty hash Random password generated; logged once at startup Unchanged if row already has a password
Docker examples Hash omitted; random password in coordinator logs Existing sipcapture hash in users: login then forced password change

How to read the Docker password (fresh volume):

docker compose -f examples/docker/docker-compose.yaml logs homer 2>&1 | grep bootstrap_password
# or: docker logs <homer-container> 2>&1 | grep bootstrap_password

The warning looks like generated one-time bootstrap admin password with field bootstrap_password. It is printed only on first insert of the admin row, not on later restarts. See examples/docker/README.md.

Legacy SHA-256 rows from migrated homer-app users still authenticate. The well-known sipcapture digest still logs in, but the session is limited to GET/PATCH /api/v4/me and logout until the password is changed. --reset-admin-password still refuses that digest as a new hash.

Wizard: empty admin password field → random password (bcrypt in JSON) shown once after save.

Recovery: homer --config-path … --reset-admin-password still requires explicit admin_password_hash (SHA-256 hex) in config or env.

See AUTH_LDAP_AND_OAUTH.md and COORDINATOR.md.


Statistics SQL (POST /api/v4/statistics/query)

Before: rawquery in the request body was passed to FlightSQL without validation.

After: Each rawquery is validated with the same rules as POST /api/v4/query:

  • Allowed statement starts: SELECT, WITH, SHOW, DESCRIBE, EXPLAIN, PRAGMA
  • No semicolons (multi-statement blocked)
  • Blocked DML/DDL keywords and dangerous functions (token-aware: keywords inside string literals / Call-IDs are ignored; real CALL / DELETE identifiers remain blocked)
  • External scanners blocked: sqlite_scan, postgres_scan, mysql_scan, iceberg_scan, delta_scan, spatial_scan (11.0.313+)
  • File and network readers are blocked by name shape, not only by an exact list (11.0.362+, GHSA-c5mq-r27x-v29v): a call whose name starts with read_, sniff_, parquet_, http_, iceberg_, delta_, or st_read, or ends with _scan or _attach. That covers sniff_csv, parquet_scan, read_json_objects, arrow_scan, sqlite_attach, and the same class of routine. getenv and duckdb_secrets are blocked too.
  • A string literal used as a table is rejected (SELECT * FROM 'file.parquet', including parenthesized, comma-joined, escape-string, and dollar-quoted forms). DuckDB replacement scans open that path as a file. String literals in WHERE, VALUES, and select-list expressions are unchanged.

Invalid SQL returns 400 with SQL validation failed. Grafana-style read-only panels using single SELECT statements continue to work.

See LINE_PROTOCOL.md (Statistics API section).


Node DuckDB sandbox

ValidateRawSQL is a denylist: it has to know every DuckDB routine and syntax that opens a file. The sandbox is the second layer. DuckDB itself refuses the access, whatever SQL reaches it.

When the node opens its query DuckDB (startup and every catalog reconnect), it loads its extensions, creates secrets and attaches the volumes, then:

  1. turns off extension autoinstall, autoload and community extensions;
  2. sets allowed_directories to every volume path, the DATA_PATH stored in each catalog, and the spill temp_directory;
  3. sets allowed_paths to the SQLite catalog files (catalog.sqlite, -wal, -shm), never their directory, since homer_settings.duckdb often sits next to them;
  4. sets enable_external_access = false.

From then on read_text('/etc/passwd'), FROM '/path', COPY ... TO, ATTACH, INSTALL/LOAD, EXPORT DATABASE and URLs outside the lake fail with a DuckDB permission error. DuckDB does not let SQL turn external access back on, or widen the allow lists or temp_directory, while the instance runs.

Fallback: right after applying it, the node reads each lake's catalog and one row of one table. If DuckDB denies that, or DuckDB does not recognise a remote volume prefix (its httpfs / azure extension is not loaded), the node reopens DuckDB without the sandbox and logs Node: DuckDB sandbox could not be applied. Search keeps working; please report the log line.

Scope: this covers the node's own DuckDB, which serves raw SQL, FlightSQL and /query. The writer's DuckDB and the tiering DuckDB need full file access for flush, tier moves and maintenance, so they are never sandboxed.

All-in-one: when the writer and node run in one process, the node reads the lake on its own sandboxed DuckDB, the same way a standalone node does. The writer's DuckDB is used only for /exec (PCAP import, bound parameters) and to copy the memory buffers out. This needs:

  • node.ducklake.lake_name equal to storage.ducklake.lake_name;
  • a default volume in node.ducklake.volumes on the same catalog as storage.ducklake.catalog_path;
  • storage.ducklake.storage_policy.enable false.

The startup log shows Node: all-in-one reads use the node's sandboxed DuckDB. If a condition is not met, or the sandbox fell back, the node reads on the writer's DuckDB as before and logs Node: all-in-one reads use the writer DuckDB, which is not sandboxed with the reason. Only the SQL validator applies then.

search_buffer keeps working. The memory buffers live in the writer's DuckDB, so before a search that reads them the node copies them out with a fixed query of its own: COPY (SELECT * FROM mem_hep_proto_<table>_a|b [WHERE timestamp in the search range]) TO a parquet file in the node spill directory, which the sandbox allows. The search then runs on the copies in the node DuckDB, and the copies and the file are removed afterwards. Searches that read the buffers run one at a time. User SQL never runs on the writer's DuckDB. If a copy fails, the search returns lake rows only and logs Node: could not copy writer buffers. FlightSQL does not include unflushed rows in this mode.

Opt out: node.duckdb_sandbox: false or HOMER_NODE_DUCKDB_SANDBOX=false.


Node HTTP /query (11.0.313+)

Before: The node HTTP API on flight_server.port + 1 (default 50052) accepted POST /query with no authentication and no SQL validation, so an unauthenticated client could run arbitrary DuckDB SQL (including read_text('/etc/passwd') and full lake dumps).

After:

  1. Every /query body is validated with ValidateRawSQL (same rules as coordinator raw SQL).
  2. When node.flight_server.auth_token is non-empty, /query and /vacuum require Authorization: Bearer <token>. /health stays open for probes.
  3. If auth_token is empty and flight_server.host is not loopback (default 0.0.0.0), Homer generates a random token, persists .homer_node_auth_token beside the DuckLake catalog (mode 0600), and enables Bearer auth. Loopback-only binds (127.0.0.1 / ::1 / localhost) may keep an empty token.
  4. The coordinator sends coordinator.nodes[].token as Bearer on /query. Same-process local nodes with empty token inherit node.flight_server.auth_token automatically.
  5. POST /vacuum accepts expire_older_than only as a duration (1 hour, 7 days, or a Go duration such as 1h). The value is converted to integer seconds and passed as INTERVAL '<n> seconds'. A quote, semicolon, or other SQL fragment returns 400 and is not executed (11.0.363+, GHSA-q7c2-m23h-43g9).
"node": {
  "flight_server": {
    "host": "127.0.0.1",
    "port": 50051,
    "auth_token": "change-me-node-http"
  }
},
"coordinator": {
  "nodes": [
    {
      "name": "local",
      "host": "127.0.0.1",
      "port": 50051,
      "token": "change-me-node-http"
    }
  ]
}

Recommendation: bind flight_server.host to 127.0.0.1 when the node is only used by a co-located coordinator, and set an explicit auth_token / nodes[].token in production. Firewall port+1 from untrusted networks.

The live HEP WebSocket /stream on the same HTTP port is still intended for private networks (see HEP_STREAM.md); prefer not exposing it publicly.


HEP mutual TLS (mutual_tls + cacert)

Before: ingest.tls, ingest.https, and the legacy SERVER_SETTINGS.TLS_SERVER applied client-certificate checks only when mutual_tls and cacert were both set. mutual_tls: true with an empty cacert left ClientAuth at NoClientCert, so the listener completed handshakes with no client certificate. HEP ingest has no other authentication on these ports.

After (11.0.384): The same receivers return an error and do not listen (GHSA-2v9j-m2v3-x9qr). Set cacert to the CA that signs client certificates. mutual_tls: false is unchanged. The legacy HTTPS receiver already refused this combination.


Upgrade checklist

  1. Review JWT — If you never set coordinator.jwt.secret, after upgrade check coordinator logs for jwt_secret_file or set an explicit secret in config.
  2. Review admin access — If you relied on open API without JWT, enable Auth-Token tokens or use UI login.
  3. Docker / explicit env — set HOMER_COORDINATOR_JWT_SECRET yourself if you want a pinned key. Official Compose leaves it unset, so Homer generates .homer_jwt_secret. A copy that still has change-this-to-a-secure-random-string-in-production, change-me-in-production, or your-secret-token-here does not keep those values. HOMER_COORDINATOR_AUTH_ADMIN_PASSWORD_HASH (as in examples/docker/) is unchanged.
  4. Automation — Scripts calling protected endpoints need Authorization: Bearer … or Auth-Token after upgrade if JWT was previously empty.
  5. Node /query — After 11.0.313, check logs for auth_token_file / Bearer requirement; set matching coordinator.nodes[].token for remote nodes; prefer loopback bind for local-only nodes.
  6. HEP mutual TLS — If mutual_tls is true, cacert must point at a CA file. An empty cacert stops that TLS or HTTPS receiver from listening.

See also

Learn more about advisories related to sipcapture/homer in the GitHub Advisory Database