sandersyao/dsh-credentials-mysql0

@sandersyao/dsh-credentials-mysql

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

包名
@sandersyao/dsh-credentials-mysql
版本
0.1.1
许可证
MIT
最近更新
2026年9月4日

安装

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

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.