Skip to content

simlock config prints gateway.token and alert secrets in plain text #1097

Closed

Description

@leonardoxr

What happened

simlock config prints the daemon's config as written, secrets included: gateway.token (the worker's join token), and each gateway.alerts.destinations[] entry's url and secret. simlock config get gateway does the same for one key.

A coding agent ran simlock config on a worker to check a setting. The join token landed in its tool output, which is the agent's transcript. Since then we forbid agents to run simlock config at all.

This is deliberate today. config.get is admin-role and returns the config as written (src/core/config.ts:416), and only the startup log line and daemon.started go through redactConfig (src/core/config.ts:481). The reasoning is that the output is as sensitive as config.json. For an agent that isn't true: a transcript is kept, synced and shared far more widely than a 0600 file.

What you expected

simlock config and simlock config get print [redacted] in place of every secret by default, the way redactConfig already does for the log. Seeing the real value takes an explicit flag, such as --show-secrets. config.get over the socket and HTTP could redact the same way, so no frontend prints a secret by accident.

How to reproduce

  1. On a worker, simlock config set gateway.token <a join token>.
  2. simlock config
  3. The output contains the token in plain text. simlock config get gateway.token prints it too.

Environment

Simlock 0.4.0, worker joined to a gateway, macOS. Current main (795733b) behaves the same: src/cli/commands/config.ts writes client.getConfig() unchanged.

Logs and evidence

The leaked value is a secret, so it isn't reproduced here.

Written by an agent.

Activity

  1. V3RON commented on Oct 31, 2026

    @V3RON
    Contributor

    Maintainer decision: secrets are hidden by default.

    • simlock config and simlock config get <key> print [redacted] in place of every secret: gateway.token, and each gateway.alerts.destinations[] entry's url and secret. The masking is the same as redactConfig already does for the log.
    • config.get over the socket and HTTP redacts the same way by default, so no frontend prints a secret by accident.
    • --show-secrets on the CLI (showSecrets: true on config.get, admin role as today) returns the real values.

    Written by an agent.

  2. added
    bug:new
    on Oct 31, 2026
  3. self-assigned this
    on Oct 31, 2026
  4. V3RON commented on Oct 31, 2026

    @V3RON
    Contributor

    Reproduction

    Confirmed on main (bcedd2f), worker and gateway. The expectation is the maintainer's decision above.

    e2e/config-secrets.test.ts › "simlock config and config get print [redacted] for gateway.token and every alert destination's url and secret, and --show-secrets prints the real values", branch bug/1097-repro.

    pnpm test:e2e e2e/config-secrets.test.ts
    AssertionError: expected { …(8) } to deeply equal { workerConfig: '[redacted]', …(7) }
    +   "workerConfig": "slk_250B-…",      (real join token)
    +   "gatewayConfig": [{ "url": "http://127.0.0.1:9/hooks/ops-secret-path", "secret": "ops-signing-secret", … }, …]
    +   "workerGetShown": "exit 2: … Unknown option '--show-secrets' …"
    

    Root cause

    Decision, not a defect. Both config.get handlers return the live config unredacted: src/daemon/dispatcher.ts:835 and src/gateway/dispatcher.ts:375. The CLI prints the answer as is (src/cli/commands/config.ts:20, :32). ADR 0035 §6 says so ("config.get keeps answering admins with the config as written"), and it still binds ("Accepted — not yet implemented"). The maintainer's comment changes it, so §6 needs a superseding ADR before or with the fix. HTTP and MCP have no config.get route or tool today. Only the socket and the uplink carry it.

    Simplest fix

    One PR. A local prototype passed the test and broke only the test under Risk.

    • config.get input: z.object({ showSecrets: z.boolean().optional() }), and bump DAEMON_PROTOCOL_VERSION.
    • Both handlers: input.showSecrets === true ? config : redactConfig(config).
    • getConfig(input = {}) in simlock-client. Add --show-secrets to config and config get.
    • Update the config.ts:416 comment, EVENTS.md:146 and the config section of reference/cli.mdx.

    Alternatives rejected

    • Redact only in the CLI: socket clients and the gateway's view of a worker would still get the secrets.
    • Delete the secret keys instead of masking them: then "unset" and "set" look the same, unlike redactConfig.

    Risk

    • src/daemon/main.test.ts:526 asserts "config.get still returns it". Invert it. Nothing else needs the secrets: config set reads config.json directly, the gateway's worker view keeps only downloads and lease (src/contract/worker-view.ts:110), and the console and MCP never call config.get.
    • The gateway handler holds the contract type GatewayConfig, not core Config, so redactConfig needs a type it accepts.

    Written by an agent.

  5. removed their assignment
    on Oct 31, 2026
  6. V3RON commented on Oct 31, 2026

    @V3RON
    Contributor

    Maintainer decision on the triage's ADR question: no new ADR. The fix PR amends ADR 0035 §6 in place, so that config.get redacts secrets by default and showSecrets: true returns the config as written. The fix follows the triage's proposed fix.

    Written by an agent.

  7. added
    bug:ready
    and removed
    bug:new
    on Oct 31, 2026
  8. self-assigned this
    on Oct 31, 2026
  9. added a commit that references this issue on Oct 31, 2026
    6557335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions