dsh-fleet-audit: Credential hygiene audit plugin for DSH multi-agent machines

Introduction

Machines running DSH usually have multiple agents working, and credentials exist in more than one location: url.*.insteadOf in ~/.gitconfig, ~/.netrc, ~/.npmrc, .git/config in each project, or casually written .env files may all contain tokens. Once Git embeds https://oauth2:<token>@host into a remote URL, any execution of git remote -v could write the secret into logs, chat history, or CI output. Manually checking each one one by one is time-consuming and prone to omissions.

The dsh-fleet-audit introduced below is a read-only diagnostic tool: it scans the permission bits of local credential files and embedded credentials in git remotes, outputting the results in a de-identified manner. It does not modify files, make network requests, or save state; it only reports.

What is it

dsh-fleet-audit is a community plugin for DSH, designed for fleet machine hygiene auditing. It checks three things: credential file permissions, embedded credentials in git remotes, and provider token prefix literals. As described in the README, it is read-only, has zero dependencies, and is deterministic: the same input always produces the same output.

The repository is YaoleWu/dsh-fleet-audit and falls under the admin-security category. A note: the installation command and license attribution in the README body are written as LeslieWylie, which is inconsistent with the repository owner. It is recommended to check this on GitHub yourself before installing. The README also clarifies that this is an independent community plugin and has no affiliation with DeepSeek or its DSH repository.

Installation and Usage

The local verification method provided by the README is to first add the local path:

dsh plugin --profile web add /path/to/dsh-fleet-audit

The installation method after release, as per the README, is:

dsh plugin --profile web add dsh-fleet-audit

Or via GitHub:

dsh plugin --profile web add github:LeslieWylie/dsh-fleet-audit

Note that the owner name in the last line comes from the original README and is inconsistent with the repository URL owner; please confirm you are pointing to the correct repository before executing.

After installation, restart dsh web, and then simply command it to “Audit local credential hygiene / run fleet_audit”.

Core Features

  1. Credential file permissions. Lists common credential files, including ~/.gitconfig, ~/.netrc, ~/.npmrc, ~/.env, and ~/.ssh/, tightening expected permissions to 600 or 700. Any file readable by the group or other users is marked as tooOpen.

  2. Embedded credentials in git remotes. Scans ~/.gitconfig and .git/config in specified directories to identify formats like https://user:pass@host, https://oauth2:TOKEN@host, or usernames with tokens. The credential portion in the output URLs is replaced with ***. The README states this guarantees byte-by-byte protection against leaking the original text, and the tests also assert that the output JSON does not contain the original secrets.

  3. Provider token prefix literals. Identifies common prefixes such as github, github-fine-grained, gitlab, gitlab-ci, slack, aws, openai, and jwt, reporting only the “Type × Count” without outputting specific values. This feature can be disabled via a parameter.

Tool Parameters

The tool parameters are the switches and boundaries for the three checks above:

Parameter Type Description
roots string[] Recursive scan directories for .git/config (optional; defaults to only ~/.gitconfig)
files string[] Absolute paths of additional credential files to check permissions for
scanSecrets boolean Whether to scan token prefix literals (default true)
maxGitConfigs number Upper limit for git config scanning (default 200, max 2000)
maxDepth number Directory recursion depth (default 5, max 20)

When only interested in a specific project’s remotes, simply add the project directory to roots. Credential files not on the list need to be explicitly specified using files.

Output Example

The output is a single JSON object where summary provides the totals and checks is divided into three groups. Below is the example from the README (de-identified):

{
  "ok": true,
  "summary": { "files": 5, "tooOpen": 1, "gitLeaks": 2, "secretFiles": 1, "issues": 4, "scannedGitConfigs": 12 },
  "checks": {
    "credentialFiles": [
      { "path": "/Users/alice/.gitconfig", "exists": true, "mode": "644", "tooOpen": true }
    ],
    "gitRemoteLeaks": [
      { "file": "/Users/alice/code/proj/.git/config", "host": "gitlab.example.com", "maskedUrl": "https://***:***@gitlab.example.com/group/proj.git" }
    ],
    "secrets": [
      { "file": "/Users/alice/.gitconfig", "providers": [ { "provider": "github", "count": 1 } ] }
    ]
  },
  "note": "Read-only audit; secret-like values are masked in the output. Fix permissions with chmod 600 and rotate any exposed credentials."
}

The note field directly suggests how to fix the issues: use chmod 600 for permissions and rotate any exposed credentials. The plugin itself will not perform these actions for you.

Security Boundaries and Known Limitations

The security boundaries are clearly defined: it is read-only; it does not write files, start processes, access the network, or save state. Limits are set for the number of git configs and recursion depth, making the scan scale controllable.

Limitations to be aware of:

  1. Only scans text-based configuration files; encrypted storage, system keychains, and binary files are out of scope.
  2. Token prefix identification uses heuristic rules and may miss non-standard prefixes or produce false positives, requiring manual review.
  3. The default credential list is fixed; other paths must be explicitly specified using roots / files.
  4. After discovering a leak, you must execute chmod 600 and rotate the keys yourself.

Use Cases and Considerations

It is suitable for regular health checks on development machines running multiple agents, CI runners, or shared workstations, especially in multi-user environments where managed credential solutions cannot be used. It provides a snapshot and does not replace credential management tools; it also cannot guarantee that no other forms of keys exist in your agent configuration.

A reminder: the plugin runs with the permissions of the current dsh process, so what it can read depends on what this process can access. Before installing, please review the source code to check the scan scope and output logic, and confirm the license is acceptable (marked as MIT in the README).

The rollback method is also a plugin command. Since the plugin is read-only and stateless, uninstalling it does not affect user data:

dsh plugin --profile <p> remove dsh-fleet-audit
# or delete this line from dsh.profile.bundles

Summary

The value of dsh-fleet-audit lies in converging the three issues of “where are credentials scattered, who can read them, and do they contain keys” into a single, read-only, de-identified scan. It has low entry costs and no residual footprint upon exit. To try it yourself, first review the source code and then install.

Directory Page: https://www.skillhub.cn/plugins/YaoleWu/dsh-fleet-audit
GitHub: https://github.com/YaoleWu/dsh-fleet-audit

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye