AstrBot-Desktop/docs/dependency-review.md
YokiiroBW 353a439b41
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
docs(p00): record spike results and unresolved boundaries
2026-07-18 21:00:49 +08:00

12 KiB

P00 Dependency Review

Date: 2026-07-18

This review covers direct dependencies introduced for the isolated P00 Spikes. Versions are pinned in package.json, pnpm-lock.yaml, Cargo.toml, and Cargo.lock. ?Maintained? below means the selected release line is current enough to resolve, compile, lint, test, and build on the audited toolchain; it is not a promise of future upstream maintenance.

Frontend and desktop dependencies

Dependency Purpose Maintenance and alternatives Native compile Permission or attack-surface effect
React, React DOM Minimal status UI and future interaction layer Active release line; alternatives would replace the mandated React baseline No Browser-side rendering only
Zod Runtime validation for frontend-facing typed data Active release line; manual validators are possible but easier to drift No Reduces acceptance of malformed data
Tauri API and CLI Mandated Tauri 2 application runtime and build tooling Active Tauri 2 release line; changing it would violate the baseline Rust build for the desktop binary Adds only configured Tauri core capabilities; no shell or broad filesystem plugin is enabled
Vite and React plugin Development server and production web bundle Active release line; alternative bundlers are unnecessary for P00 esbuild binaries are dependency-managed Development/build-time surface only
TypeScript and type packages Static frontend typing Active release line; no equivalent is needed under the mandated stack No Build-time only
ESLint, TypeScript ESLint, React lint plugins Static correctness and hook checks Active release lines; alternatives provide similar checks No Build-time only
Prettier Deterministic formatting Active release line; alternatives would add no P00 value No Build-time only
Vitest, Testing Library, jsdom Frontend unit and component tests Active release lines; Jest is an alternative with more configuration Some transitive optional binaries may be platform-specific Test-only; no release capability
Playwright Test Browser smoke testing Active release line; WebDriver alternatives are less aligned with the existing test Browser executable is external to the app Test-only; browsers are not shipped with the desktop binary

Rust runtime dependencies

Dependency group Purpose Maintenance and alternatives Native compile Permission or attack-surface effect
tauri, tauri-build, tauri-plugin-single-instance Desktop lifecycle, tray, IPC bootstrap, single instance Mandated and on the Tauri 2 line; no framework substitution approved Yes Native window/tray lifecycle only; capabilities remain explicit
reqwest with rustls, eventsource-stream, futures-util REST and SSE clients Current release lines; manual HTTP/SSE parsing would increase risk Rustls is compiled in Rust Outbound HTTP(S) to configured gateways; redirects are disabled
tokio, tokio-util Independent async connections, cancellation, timers Current release lines; required by the selected HTTP/server ecosystem No external native library Concurrency only; no new OS permission
secrecy, zeroize Reduce accidental secret exposure and clear owned buffers Current small crates; custom wrappers are possible but easier to misuse No Narrows secret exposure
rusqlite with bundled SQLite Disposable schema/isolation Spike and future local storage Current release line; system SQLite would reduce reproducibility Yes, bundled SQLite C code Local database files only; credentials remain excluded
windows Typed Windows Credential Manager, UIA, GDI, Event Log, process, and port APIs Official Microsoft projection; direct FFI is the higher-risk alternative Links Windows system libraries Adds only explicitly selected Win32 API feature sets; no input injection, registry write, or shell API
sysinfo Read-only process metadata fallback Current release line; direct Win32-only implementation is an alternative Platform-specific Rust code Read-only process inspection
png In-memory encoding of one explicitly selected window Current focused crate; Windows Imaging Component is an alternative No external library No disk write; bounded pixel allocation
quick-xml Bounded Event Log XML parsing Current release line; manual parsing is unsafe No Parses only returned event XML
regex Local redaction and bounded format checks Widely maintained; manual scanners are possible but error-prone No Reduces disclosure risk
serde, serde_json, toml, yaml-rust2 Typed protocol and bounded configuration fixtures Active ecosystem crates; handwritten parsers are higher risk No Parsing only; file access remains separately authorized
sha2 File transaction verification Current cryptographic primitive crate; platform hashing APIs are an alternative No Read-only hashing of authorized fixture data
uuid, time, url Identifiers, timestamps, and URL validation Active ecosystem crates; custom implementations would increase ambiguity No Validation and metadata only
thiserror, tracing, tracing-subscriber Structured errors and sanitized diagnostics Active ecosystem crates; standard-library-only alternatives are more verbose No Logs must still pass redaction rules

Protocol and Mock-only dependencies

Dependency Purpose Maintenance and alternatives Native compile Permission or attack-surface effect
schemars Export checked JSON Schema from canonical Rust types Active release line; handwritten schema is the drift-prone alternative No Build/test tooling only
ts-rs Export TypeScript protocol types Active release line; handwritten duplication is the alternative No Build/test tooling only
axum, async-stream, clap Loopback-only dual Mock Gateway and CLI Active release lines; custom HTTP server code is riskier No external native library Mock refuses non-loopback bind addresses and is not a release dependency
tempfile Disposable database, log, and file-transaction fixtures Active release line; manual temp naming is less safe No Test-only generated paths

Review outcome

  • No dependency exposes arbitrary PowerShell, CMD, shell, keyboard, mouse, registry-write, or unrestricted filesystem execution.
  • Native compilation is limited to the mandated Tauri/Windows stack and bundled SQLite.
  • Mock and test dependencies do not enter the release dependency graph.
  • Dependency updates require lockfile review, the full P00 check set, and a repeat of affected Windows Spikes.