Files
dacli/src
sswandClaude 2c6e92d3e9 fix(security): P4 — spawn over execSync, token 0600, env-only crypto key
Per audit §8 / H2 / H3 / M4:
- form/create.ts AI-relogin: execSync(`...--password=123456...`) → spawnSync
  array form (no shell → no command injection via cliEntry/appCode); creds from
  config DEFAULT_ACCOUNT/DEFAULT_PASSWORD (env-overridable), no inline literal
- config.ts saveToken: token.json 0600 + dir 0700 + chmod fallback for existing
  0644 files (token holds bearer, was world-readable)
- crypto.ts: drop hardcoded FALLBACK_KEY ('EY8...'); missing key → throw (refuse
  to encrypt with weak key under AES-ECB) instead of silent weak fallback
- @types/pg already installed in P1 (kb SQL client no longer any-typed)

Verified: tsc 0; crypto still loads key from web/.env (96-char hex, no throw →
login intact in container); vitest unit 336 pass (blindspot_guards quarantined).

Co-Authored-By: Claude <[email protected]>
2026-07-24 10:42:51 +08:00
..