dev-mode key pair and healthcheck without a config file read a variable that is not UTF-8 as unset

Open Beginner friendly
#1,350 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Two readers treat non-UTF-8 environment values as unset: the non_empty closure in resolve_with in crates/server/src/dev_credentials.rs, and the std::env::var calls in resolve_target in crates/app/src/cmd_healthcheck.rs. Start with the disable switch EXTENDDB_DEV_DISABLE_EXAMPLE_CREDENTIAL, which already refuses such a value with a message naming it, and compare. Done when a non-UTF-8 value in either reader produces an error that names the variable, with the existing error paths left intact.

Written by the indexing model from the issue text.

Description

bug

What happens

Two readers of ExtendDB variables read the process environment with their own code instead of the configuration loader. Both treat a value that is not UTF-8 as unset, and no message says that the value is not UTF-8. For an EXTENDDB__ variable, the configuration loader refuses such a value with an error that names it (#977).

Measured on 21 November 2026 with the dev-mode SQLite binary (--features sqlite-memory,dev-mode) of the fix for #977. Each case ran twice and gave the same answer both times.

The dev-mode key pair

A dev-mode build reads EXTENDDB_DEV_ACCESS_KEY_ID and EXTENDDB_DEV_SECRET_ACCESS_KEY as unset when their values are not UTF-8.

env $'EXTENDDB_DEV_ACCESS_KEY_ID=\xff' $'EXTENDDB_DEV_SECRET_ACCESS_KEY=\xfe' extenddb serve --foreground --port 18991

At 20:53 UTC, both runs served /health, and a ListTables signed with the documented example pair got HTTP 200. The startup output named only the example pair under "Sign requests with".

With only EXTENDDB_DEV_ACCESS_KEY_ID not UTF-8 and EXTENDDB_DEV_SECRET_ACCESS_KEY=abc, both runs at 20:58 UTC exited 1 with this message. The message says that the access key variable is not set:

Error: EXTENDDB_DEV_SECRET_ACCESS_KEY is set but EXTENDDB_DEV_ACCESS_KEY_ID is not; set both to seed an additional dev credential, or neither.

resolve_with in crates/server/src/dev_credentials.rs reads each variable of the pair through the non_empty closure. The closure maps a value that is not UTF-8 to None (.and_then(|v| v.into_string().ok())). The disable switch EXTENDDB_DEV_DISABLE_EXAMPLE_CREDENTIAL refuses such a value with a message that names it.

Healthcheck without a config file

With no config file, resolve_target in crates/app/src/cmd_healthcheck.rs reads EXTENDDB__SERVER__PORT and EXTENDDB__SERVER__BIND_ADDR with std::env::var. It treats Err(_) as unset. std::env::var also returns Err for a value that is not UTF-8. Its comment says that it reports a bad port instead of using the default port.

extenddb healthcheck --config <a path that does not exist>, with nothing on port 18443, at 20:52 UTC:

Environment Answer
EXTENDDB__SERVER__PORT=abc exit 1, healthcheck failed: EXTENDDB__SERVER__PORT 'abc' is not a valid port: invalid digit found in string
EXTENDDB__SERVER__PORT holds the byte 0xFF exit 1, healthcheck failed: Cannot connect to 127.0.0.1:18443: Connection refused (os error 111)
EXTENDDB__SERVER__BIND_ADDR holds the byte 0xFF exit 1, the same Cannot connect to 127.0.0.1:18443

The byte 0xFF in the port gives the answer of an unset port. The probe goes to the default port, and the message does not name the variable.

On main, any variable that is not UTF-8 stops serve with a panic before it reads the key pair (#977). Neither reader changes in the fix for #977.

Expected

Each reader refuses a value that is not UTF-8 with a message that names the variable, as the disable switch and the configuration loader do.

Dominant language
Rust
Stars
517
Forks
60
Avg merge
3d 21h
Merged PRs (30d)
116

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ExtendDB/extenddb

All issues in ExtendDB/extenddb

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.