sandersyao/dsh-credentials-mysql0

@sandersyao/dsh-credentials-mysql

MySQL-backed credentials vault provider for the DeepSeek Harness (ctx.credentials)

AI 分析

核心用途是将 DSH 的敏感凭据持久化存储在 MySQL 数据库中。适合需要在分布式或多实例部署中安全、统一管理 API 密钥等凭据的系统管理员。

パッケージ
@sandersyao/dsh-credentials-mysql
バージョン
0.1.1
ライセンス
MIT
最終更新
2026/09/04

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:sandersyao/dsh-credentials-mysql

ドキュメント

README 全文を読む ↗

Install & usage

import { MysqlCredentialProvider } from '@sandersyao/dsh-credentials-mysql'

await ctx.plugin(MysqlCredentialProvider, {
  connection: { tablePrefix: process.env.CREDENTIALS_TABLE_PREFIX },
})
// ctx.credentials is now backed by the MySQL vault.

Configuration

Credentials, table prefix and the encryption key come from environment variables / a .env file (see .env.example). Independent CREDENTIALS_* win; they fall back to the shared MYSQL_* — reuse the same connection when co-existing with dsh-session-persistence-mysql, or configure independently. The plugin Config is fully optional — environment is the source of truth for credentials (never hard-code a password).

EnvFallbackDefaultPurpose
CREDENTIALS_HOSTMYSQL_HOST127.0.0.1MySQL host.
CREDENTIALS_PORTMYSQL_PORT3306Port.
CREDENTIALS_USERMYSQL_USER— (required)Least-privilege DB user.
CREDENTIALS_PASSWORDMYSQL_PASSWORD— (required)Password.
CREDENTIALS_DATABASEMYSQL_DATABASE— (required)Target database.
CREDENTIALS_TABLE_PREFIXMYSQL_TABLE_PREFIX— (required)Table prefix; validated against ^[A-Za-z0-9_]+$; base names distinct from session tables to avoid collision.
CREDENTIALS_ENCRYPTION_KEYENCRYPTION_KEY(empty)Field-encryption key; empty = plaintext (startup warning).
CREDENTIALS_SSL_REQUIREDMYSQL_SSL_REQUIREDfalseReserved for TLS enforcement (deferred).
CREDENTIALS_POOL_SIZEMYSQL_POOL_SIZE10Pool sizing.
CREDENTIALS_SCHEMA_AUTO_MIGRATEMYSQL_SCHEMA_AUTO_MIGRATEtrueAuto-migrate schema on startup; false only validates.

Test isolation. Automated tests (vitest) run against a separate database to avoid touching the production one: CREDENTIALS_TEST_DATABASE (default test) overrides CREDENTIALS_DATABASE during tests, and MYSQL_ROOT_PASSWORD is used only by the test harness to create/grant the test DB. See docs/MANUAL_TEST_PLAN.md.