Skip to content

Secrets: a turn that withholds a key fails every bash call (DSH_SECRETS_WITHHELD is not declared to shell-env) #653

Closed

Description

@Birfy

Environment

main at a5a887b (after #652, which fixed #651), DSH 0.2.0-rc.2. Not in a release yet: v0.2.3 (#650) predates #652.

Steps to reproduce

  1. Save GITHUB_TOKEN with scope all.
  2. Share a Bot with anyone (a grant, or a room with another person), then let it run a turn that withholds the key: its own scheduled turn, a turn started by someone else's line, or a turn with no recorded verdict.
  3. The Bot calls bash.

Actual

resolveEnv (core/src/host/secrets.js:537-562) returns DSH_SECRETS_WITHHELD, but attachShellEnv (core/src/host/secrets.js:578-582) declares only the DSH_SECRET_<NAME> keys. DSH's ShellEnvRegistry.collect (@deepseek-ai/dsh-shell-env 0.2.0-rc.2, packages/shell/shell-env/src/index.ts, the Object.hasOwn(contributor.variables, key) check) throws bash env contributor "ds-bot-secrets" returned undeclared key "DSH_SECRETS_WITHHELD". dsh-tool-bash calls collect before it runs anything, so every bash call in that turn fails, not only the key lookup. That is worse than the empty $DSH_SECRET_GITHUB_TOKEN that #651 set out to explain.

The #651 tests did not catch it because the test bench's shellEnv mock (core/test/secrets.test.js, start()) called resolve directly and never checked the declared keys.

Expected

A turn that withholds a key still runs its shell, with DSH_SECRETS_WITHHELD=NAME:reason set and no value.

Where it sits

  • core/src/host/secrets.js:578-582: the variables given to sub.shellEnv.register
  • core/src/host/secrets.js:560: values[WITHHELD_VAR] = ...

Suggested direction

Declare WITHHELD_VAR in the contribution, and make the bench mock enforce DSH's declared-key contract (LESSONS 2026-10-18: a mock has to have the real shape).

Related: #601 (keys withheld on some turns of shared Bots, needs-human) and #651. This issue is not about that policy; it is about the bash call crashing.

Activity

  1. added
    bug
    area:security
    agent-pr
    agent-working
    area:automation
    on Oct 22, 2026
  2. added a commit that references this issue on Oct 22, 2026
    ee1739e
  3. removed
    agent-working
    agent-pr
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:automationarea:securitybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions