dsh-flutter-sandbox: Running Flutter and Dart in a workspace-write Sandbox

Introduction

In workspace-write mode, DeepSeek Harness (DSH) by default only allows commands to write to the current session workspace and /tmp. The Flutter and Dart toolchains write files to SDK cache, pub cache, Gradle directories, and other paths on every run—even flutter --version can fail due to a read-only filesystem. The community plugin dsh-flutter-sandbox (maintainer liyuqian, GitHub category admin-security) additionally opens commonly used writable directories for the Flutter/Dart ecosystem to the sandbox, while keeping all other paths protected.

What Is This

dsh-flutter-sandbox is a DSH plugin: it replaces the stock @deepseek-ai/dsh-sandbox-local provider bundled with dsh-base via a custom sandbox provider, allowing shell commands under workspace-write to also write to the Flutter SDK, PUB_CACHE, Dart/Flutter configuration, and Android build-related directories. The read-only and danger-full-access modes are unaffected; the model is informed in context about these additional writable paths.

Typical failure symptoms (without the plugin installed) look like:

update_engine_version.sh: line 71: .../flutter/bin/cache/engine.stamp.tmp: Read-only file system

Core Features

The plugin grants write permission to the following paths when the directories are detected to exist (everything else remains sandbox-protected):

Directory Reason
Flutter SDK ($FLUTTER_ROOT or resolved from flutter on PATH) Updates bin/cache on every run
$PUB_CACHE or ~/.pub-cache Package downloads
~/.dart-tool, ~/.dartServer Telemetry and analysis service caches
~/.flutter, $XDG_CONFIG_HOME/flutter (~/.config/flutter) Flutter settings
$GRADLE_USER_HOME or ~/.gradle, ~/.android Android builds

Implementation-wise, a bundle patch disables dsh-base’s sandbox line and inserts sandbox-flutter (which inherits from the stock provider). On each workspace-write invocation, the stock provider constructs the runner command, and the plugin inserts grants before the -- separator, based on the runner type:

  • bubblewrap (Linux): --bind <dir> <dir>
  • Landlock (Linux): --rw <dir>
  • Seatbelt (macOS): (allow file-write* (subpath "<dir>"))

Installation and Enablement

Install under the corresponding profile (the example in the docs uses the tui profile):

dsh plugin --profile tui add github:liyuqian/dsh-flutter-sandbox

For other profiles, replace tui with --profile web or your profile name. To uninstall:

dsh plugin --profile tui remove dsh-flutter-sandbox

The plugin runs with the permissions of the current dsh process; before installing, it is recommended to review the source code and MIT license on GitHub to evaluate whether it is suitable for your environment.

Configuration

No configuration changes are needed by default. To disable Flutter-related directories or add custom writable root paths, override the plugin line in the profile’s cordis.patch.yml (path: ~/.dsh/profiles/<profile>/cordis.patch.yml):

- id: sandbox-flutter
  config:
    flutter: true               # Enable the Flutter/Dart/Gradle/Android directories listed above
    extraWritableRoots:         # Additional absolute paths
      - /home/me/.cocoapods

The stock provider’s runnerCommand, runnerFailureSignatures, and probeTimeoutMs can also be configured here.

Typical Usage and Notes

  1. After installing the plugin, run flutter, dart pub, gradle, etc. as usual via shell in a DSH session; write operations initiated by these tools through the shell will hit the extended writable directories.
  2. Only shell commands benefit. DSH’s built-in file write/edit tools still validate writable paths separately and will not automatically open up the SDK or ~/.pub-cache; you still need to request permission through the normal process when needed.
  3. Windows is not supported. The ACL runner cannot append additional directories; restricted commands will explicitly error rather than silently executing without grants.
  4. Depends on the stock runner argument layout. If the dsh distribution changes its layout, the plugin will report unexpected sandbox argv layout and refuse to run in an unexpected state; the README notes it was tested on dsh 0.1.1-rc.2. The plugin version in package.json is 0.1.0, with a peer dependency on @deepseek-ai/dsh-sandbox-local >=0.1.1-rc.2.
  5. Pub workspaces. Running flutter pub get inside a workspace sub-package writes to the workspace root; DSH sessions should be launched from that root directory.

Development and Limitations Summary

The repository supports npm test to run tests (covering root directory discovery and grant insertion for each runner, without requiring a local dsh installation).

The DSH ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer. If you are using agents for Flutter projects in the Harness and sandbox write permissions are blocked by SDK and cache paths, dsh-flutter-sandbox is one way to fill in common write paths without switching to danger-full-access.

  • Directory page: https://www.skillhub.cn/plugins/liyuqian/dsh-flutter-sandbox
  • GitHub: https://github.com/liyuqian/dsh-flutter-sandbox
羽毛球分组比赛记分
小程序二维码

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

Xiaoye