dsh-bulwark: Security Guidelines and Path Interception for DSH Plugins

Introduction

The core philosophy of DSH is “Everything is a plugin.” When developing with Agents, developers face two common risks: first, the Agent might attempt to bypass established security rules; second, the Agent might execute operations that modify sensitive paths or uninstall critical security plugins. The dsh-bulwark plugin is designed to address these two issues.

What is dsh-bulwark

dsh-bulwark is a DSH plugin maintained by Hashing2030. It ensures environment security through two mechanisms: first, it injects a rules segment into the systemPrompt to restrict the Agent’s behavior; second, it intercepts modifications to protected paths and the uninstallation of protected plugins at the tool invocation layer.

Core Features

dsh-bulwark provides the following core capabilities:

  • Rules Injection: Writes a configurable rules segment into the systemPrompt, with the position derived from a central sequence table.
  • Path Protection: Intercepts write, delete, and move operations on paths within protectedPaths. This includes relative path resolution, redirection, and modifications initiated via dd / truncate / tee, or inline scripts in python / node.
  • Plugin Uninstall Protection: Uninstall or delete commands matching keywords in protectedRemovalPatterns are uniformly intercepted.
  • Configuration Hot Reload: Monitors the configuration file; changes take effect without requiring a restart.
  • Escape Hatch: Provides an environment variable that allows the plugin to be completely disabled in emergencies.

Installation and Activation

To install the plugin, use the official command:

dsh plugin add github:Hashing2030/dsh-bulwark

After executing the installation command, restart DSH to activate the plugin.

Configuration and Usage

The plugin configuration file is located at $DSH_HOME/dsh-bulwark/config.json. If DSH_HOME is not set, the default is ~/.dsh.

On the first startup, the console may output:
[dsh-bulwark:config] watcher unavailable, config changes need a restart: ENOENT...
This is not an error; it indicates that the configuration file has not been created yet and hot reload is not enabled. Once the configuration file is created, this message will disappear automatically.

It is recommended to manage configurations using scripts rather than manually editing the JSON file. Navigate to the plugin installation directory (replace the path according to your actual profile):

cd ~/.dsh/profiles/web/node_modules/dsh-bulwark

Common commands are as follows:

# Add a protected path
./scripts/protect.sh add /path/to/protect

# View the list of protected paths
./scripts/protect.sh list

# Remove a protected path
./scripts/protect.sh remove /path/to/protect

# Test if a specific command will be intercepted
./scripts/protect.sh test "rm -rf /path/to/protect/foo"

# Modify rule content
./scripts/protect.sh set-rules "[dsh-bulwark Rules] New rule content"

Escape Hatch

If you need to temporarily disable dsh-bulwark completely, you can set an environment variable when starting DSH:

DSH_FORTRESS_DISABLE=1 dsh web

Clearing this environment variable or restarting will restore protection. Note that FORTRESS in the variable name is a legacy from the project’s old name (dsh-fortress); it is retained to avoid breaking existing configurations.

Notes

  • The plugin runs with the privileges of the current DSH process. It is recommended to review the source code and license (MIT) before installation.
  • In the default configuration, protectedPaths is empty; you need to manually add paths to be protected via the CLI scripts mentioned above.
羽毛球分组比赛记分
小程序二维码

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

Xiaoye