fix(init): harden npx execution and config writer safety#614
Merged
horza-bora merged 1 commit intomainfrom Feb 24, 2026
Merged
Conversation
Add package name allowlist for doctor health checks: - PARETOOLS_PACKAGES set of known-good @paretools/* packages - validateServerPackage() checks args against allowlist before npx - Warns on unknown @paretools/* packages (typosquatting risk) - Non-paretools servers pass through without warning Add .bak backup creation for config file modifications: - FileSystem interface gains backupFile() method - mergeConfig() creates backup before any config write - MergeResult.backupPath tracks backup location - CLI prints backup path when config is modified Tests cover both features: - validateServerPackage: known, unknown, non-paretools, empty args - formatReport: warning display in doctor report - mergeConfig backup: creation, absence, content preservation, TOML and YAML formats Fixes #612 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
horza-bora
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #612
validateServerPackage()validates@paretools/*package names innpxargs againstPARETOOLS_PACKAGESallowlist before spawning. Unknown@paretools/*packages trigger a typosquatting warning in the doctor report. Non-paretools servers (user's own) pass through without warning..bakbackup creation for config writers:mergeConfig()creates a.bakbackup of existing config files before any modification, protecting against data loss from malformed file merges. Backup path is tracked inMergeResultand printed in CLI output.Test plan
pnpm --filter @paretools/init testpasses (122 tests, 14 files)tsc --noEmitpasses with no new errorsprettier --checkpasses on all modified files@paretools/initpatch bumpGenerated with Claude Code