dsh-file-shield: A DeepSeek Harness Plugin for Shielding File Access

In DeepSeek Harness (DSH), agents frequently access the file system to execute tasks. If files contain sensitive words or违规内容, the provider’s content moderation mechanism may directly reject requests (HTTP 400). Once this content enters the conversation history, every subsequent request will carry it, causing the entire session to be blocked. The dsh-file-shield plugin prevents sensitive content from entering conversations at the source by intercepting access to specified files or directories before tool execution.

Features and Principles

dsh-file-shield is a plugin maintained by Yazzyk. It blocks agents from reading, editing, searching, and writing to specified files or directories. When an agent attempts to access a blocked path, the tool call is rejected before execution, and the model receives a permission error instead of the file content.

  • Interception point: The plugin intervenes at the tools/pre-execute stage, returning deny, which causes the tool body not to execute.
  • Error feedback: The model receives an error like Error: Access to "/path/to/file" is blocked by deployment policy.
  • Shell command handling: The plugin performs static analysis on shell command text, parsing path arguments for interception. It supports intercepting workdir and command parameters for bash and pwsh tools, and filters blocked paths from search results.
  • Output filtering: For tools like grep and glob, the plugin removes paths matching rules from results and only returns unblocked content.

Limitations

  • Shell obfuscation: The plugin defends through static analysis of command text and cannot intercept all obfuscation methods. For example, operations exploiting semantic differences such as variable concatenation (cat $p), base64 -d, and command substitution ($(...)) may bypass static checks.
  • Host-side reads: Does not intercept host-side read operations that do not go through the tool layer, such as skill loading and @file references.
  • Case sensitivity: The default matchCase is false. For case-insensitive file systems, short relative rules may cause false positives.
  • Extra tools: File-reading tools not recognized by this plugin need to be supported by configuring extraPathArgs and extraCommandArgs.

Installation

Use the official installation command to add the plugin to the specified profile:

dsh plugin --profile <profile> add github:Yazzyk/dsh-file-shield

Configuration

Web GUI Configuration

  1. Navigate to the Plugins page in the Web GUI.
  2. Click Installed.
  3. Find dsh-file-shield and enter its configuration page.
  4. Select files or directories on the page, or directly enter paths and glob patterns.
  5. Click Save, and the rules will be written to the profile’s config.deny field.

cordis.patch.yml Configuration

You can also configure deny rule lists in the profile’s cordis.patch.yml. Glob patterns (such as **/*.pem) or literal paths are supported.

- insert:
    - id: file-shield
      name: dsh-file-shield
      config:
        deny:
          - '**/.env'
          - '**/.env.*'
          - '**/*.pem'
          - '~/.dsh/.credentials.yaml'
        matchCase: false
Field Default Value Description
deny [] List of rules. An empty list means no content is blocked.
matchCase false Whether to match case-sensitively.
extraPathArgs {} Specify path parameter names for custom file-reading tools from other plugins.
extraCommandArgs {} Specify command parameter names for custom shell tools from other plugins.

This plugin follows the MIT license. The DSH ecosystem emphasizes “everything is a plugin”, and this plugin is a community contribution.

  • GitHub Repository: https://github.com/Yazzyk/dsh-file-shield
  • Community Directory: https://www.skillhub.cn/plugins/Yazzyk/dsh-file-shield
羽毛球分组比赛记分
小程序二维码

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

Xiaoye