dsh-secret-scan: Scan repository for secrets and sensitive information before commit and release

Introduction

When developing skills, modifying configurations, or integrating MCPs in DeepSeek Harness (DSH), you often leave API keys, tokens, private keys, or files like .env in your local repository. Relying solely on manual code reviews often leads to missed detections. By the time these secrets are pushed to a remote repository or open-sourced, the cost of rotation and cleanup becomes significantly higher. While there are many independent secret scanning tools in the community, when they are disconnected from the Harness workflow, it is difficult for Agents to provide an actionable remediation sequence based on a consistent set of rules during “pre-commit / pre-release” stages.

dsh-secret-scan (npm package name: @deepwhale-cn/dsh-secret-scan, GitHub: feely0208/dsh-secret-scan) is a skill plugin designed for DSH. Maintained by feely0208 and categorized as “admin-security” in the plugin directory, it utilizes a rule engine to find evidence within project paths. It integrates the remediation philosophy of “rotate first, clean up second, and consider rewriting history last” directly into the skill’s instructions, preventing the scenario where code is deleted but the leaked credentials are not invalidated.

What is this?

In short: A key and sensitive information scanning skill for DeepSeek Harness—designed to find things that shouldn’t appear in code or version control libraries before committing, releasing, or open-sourcing.

The README states that this is a relatively general component of the DeepWhale Security Guard series (not limited to mainland China scenarios), because “keys entering the repository” is a common problem for technical teams everywhere. The current package.json version is 0.2.0, licensed under MIT. The runtime environment requires Node.js >= 18 and DSH engine >=0.1.0-rc.6 <0.3.0.

What does it scan?

The skill handles “how to deal with it,” while the rule engine handles “whether it exists.” The CLI generates a report with a single command and supports viewing demo samples and the rule list:

dsh-secret-scan --root <project_path>   # Run a scan
dsh-secret-scan --demo             # View built-in demo samples
dsh-secret-scan --list-rules       # List rules and criteria

The seven rules listed in the README are as follows:

Rule What it checks Level
SECRET-PRIVATE-KEY PEM private key blocks (tags + actual key body following) Critical
SECRET-AWS-AKID AKIA + 16 characters High
SECRET-GITHUB-TOKEN gh[pousr]_ / github_pat_ High
SECRET-SLACK-TOKEN xox[baprs]- / xapp- High
SECRET-STRIPE-LIVE sk_live_ / rk_live_ High
SECRET-CREDENTIAL-LITERAL Variable names containing secret/token/password + high-entropy literals Medium
SECRET-STRIPE-PUBLISHABLE pk_live_ (Stripe officially states this can be public, so listed as a low level) Low

In addition to the table above, the skill description summarizes the scanning scope as: High-confidence tokens (Cloud Access Keys, GitHub/npm/Slack tokens, Google API Keys, etc.), private keys and certificates, credential files already tracked by git ls-files (such as .env, credentials.json, .npmrc), sensitive assignments in config files (relatively high false positive rate), and internal information such as intranet IPs and internal domains. The exit code is 1 if there are high-confidence hits, making it suitable for hooking into pre-commit hooks or CI.

Output and False Positives

The report does not record the original secret values by default: Regex only consumes prefixes or variable names. Evidence takes forms like AKIA, ghp_, secretAccessKey without the full key. PEM tags without the body, as well as references like process.env.SECRET, are not reported by design. Documentation example values (like your-api-key-here) and fake values containing example or dummy are filtered out.

By default, scan hits are masked (keeping only the first and last 4 characters); to view the full value, you must explicitly use --reveal. It is not recommended to write this output to files or paste it into chats.

Known boundaries: .pem, .key, .p12 file bodies might be missed if they are not read as text due to the extension list; however, private keys written in id_rsa or embedded in code/documentation will be hit, and the report will list “skipped files.”

Installation and Activation

Install to a specified profile according to the README:

dsh plugin --profile <profile> add @deepwhale-cn/dsh-secret-scan

After installation, the script path is injected into the skill body by the plugin registration, or you can use it via skill/scan.sh in the installation directory:

scan.sh --dir /path/to/repo          # Default masking
scan.sh --dir /path/to/repo --reveal # Print full keys, only for troubleshooting

Remediation Order (Skill-side Design)

The README emphasizes: Deleting code does not invalidate leaked keys—copies may still exist in history, remotes, CI logs and caches, shell history, and editor backups. The skill body suggests the following order:

  1. Rotate keys
  2. Clean up code
  3. Then decide whether to rewrite history

A reference for judgment: Whether the key has ever left the local machine.

Use Cases and Notes

Suitable for running a scan before local commits, before releases, or before a repository becomes public. Unlike the dsh-cn-compliance Class I plugin in the same series—this plugin looks at whether things that shouldn’t be there have been committed to version control, while compliance-focused plugins are more about public exposure surfaces.

DSH plugins access the project path you specify with the permissions of the current dsh process; please review the GitHub source code and MIT license before installation to ensure the rules and masking strategies meet your team’s requirements. Community directory page: https://www.skillhub.cn/plugins/feely0208/dsh-secret-scan ; Source code and documentation: https://github.com/feely0208/dsh-secret-scan .

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

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

Xiaoye