Skip to content
dsh.fish
Bundle

dsh-tui-secret-guard

Blocks high-confidence secrets before dsh-TUI sends them to a model.

Source
icyaaaww
License
MIT
Updated
Updated 10 hours ago

Readme

# dsh-TUI Secret Guard

A small dsh-TUI ecosystem plugin that prevents high-confidence credentials from being sent to a model. It scans locally, never stores prompt content, and reports only credential categories.

## Why it helps

Pasting a `.env` fragment, deployment command, or debugging log into an agent is an easy way to disclose a live key. Secret Guard blocks known provider tokens, private-key headers, and credential-like assignments before delivery. The normal path uses `tui.dsh/v1alpha1#DecisionEvents`, so rejected text is not written to the session. Its compatibility fallback rejects the latest user message at `agent/pre-step`, before the model request.

## Install

```sh
dsh plugin --profile dsh-tui add ./dsh-tui-secret-guard
```

Decision interception is default-deny in Community v0.15. Grant the declared permission in `~/.dsh-tui/extension-grants.json`:

```json
{
  "grants": {
    "community.dsh-tui.secret-guard": [
      {
        "name": "session.input.intercept",
        "scope": "tui/input"
      }
    ]
  }
}
```

The grant is live-reloaded by dsh-TUI. The plugin requests no storage, message-observation, network, filesystem, or command permission.

## Configuration

```yaml
enabled: true
genericAssignments: true
minGenericLength: 24
showStatus: true
```

- `genericAssignments` detects values assigned to names such as `API_KEY`, `CLIENT_SECRET`, `ACCESS_TOKEN`, and `PASSWORD`.
- `minGenericLength` controls only generic assignments. Provider-specific formats retain their own strict lengths.
- `showStatus` displays `secret guard: armed` and a process-local blocked count. It does not persist counters or content.

Placeholders including `${ENV_NAME}`, `YOUR_API_KEY`, `redacted`, and masked values are ignored. A blocked prompt must be edited and submitted again; automatic redaction is intentionally avoided because silently changing code or credentials can produce misleading model output.

## Protocol compliance

`dsh-plugin.json` targets manifest `0.15`, declares the optional DecisionEvents contract, requests the exact `tui/input` scope, and documents its fallback. Validate it against [dsh-ecosystem-spec](https://github.com/T-Auto/dsh-ecosystem-spec):

```sh
npm run validate:manifest -- --manifest /absolute/path/to/dsh-plugin.json --grant session.input.intercept
```

Before publishing, add the final repository and artifact digest to `dsh-plugin.json` so a Verified claim can bind the released tarball.

## Development

```sh
npm install
npm test
npm run pack:check
```

Install

dsh plugin --profile web add github:icyaaaww/dsh-tui-secret-guard

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source