Repository navigation
fix(core): only restore config files to places Repot scans - #108
Merged
Merged
Conversation
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
An opened
repot.jsononly checked that a config-file target was relative and had no... A hostile file from someone else could therefore carry an item (with its contents) that the restore script writes to~/.ssh/authorized_keys,~/Library/LaunchAgents/x.plistor~/.config/autostart/x.desktop. These are places Repot itself never writes. Now a config-file or shell-plugin target is accepted only if the item's provider produces it on a scan. Any other item is skipped and counted, the same way other unsafe items already are (the app and CLI already reportskipped_items). Spec §10 (and §15 for the one limit), plan 11 Global Constraints. The same hole is described in #107 (plan 16, SSH). Itsssh::is_config_targetfits into the same dispatcher.Type
Changes
pub(crate) fn is_config_target(rel), built from the same constants its scan uses (now named constants instead of inline literals):git:CONFIG_FILES(.gitconfig,.config/git/config),DEFAULT_IGNORE(.config/git/ignore), plus a customcore.excludesFileonly if it sits directly in home or.config/git/and its name containsignore.shell:RC_FILES(the 7 startup files it scans), PowerShell profile viaTargetPath::PowerShellProfile. Plugins useis_plugin_target: one folder directly under.oh-my-zsh/custom/{plugins,themes}/(OMZ_KINDS,plugin_target).vscode(VS Code and Cursor):USER_FILES(settings.json,keybindings.json) and one file inSNIPPETS_DIR.jetbrains: one file with the right extension in aSETTINGS_DIRSfolder, oroptions/+OPTION_FILES.snapshot::is_scanned_config_target(provider, target)pairs each provider with its target kind (git/shell→ home,shell→ PowerShell profile,vscode→ editor user folder,jetbrains→ IDE folder). Every other provider/kind pair is rejected. Shell plugins must also come from theshellprovider.snapshot_test.rs):skips_config_files_aimed_where_repot_never_writes: 28 hostile items are skipped (.ssh/authorized_keysfrom git and shell,Library/LaunchAgents/x.plist,.config/autostart/{x,ignore}.desktop, a git item targeting.zshrc, cross-provider and cross-kind targets, editor/IDE files Repot doesn't read, nested or out-of-place plugin folders, an unknown provider). 8 legitimate edge targets still load.every_place_a_real_scan_writes_loads_from_the_file: on macOS and Windows FakeEnvs, the realGit,ShellProvider,VsCodeandJetBrainsproviders scan every file they know (27 config files + 2 plugins each, including a custom excludesFile). The export →repot.json→ open path skips nothing, and re-exporting gives the same bundle.provider: "jetbrains". It used to reuse the.zshrcitem's provider. The committed fixturev1-basic.jsonis untouched and still loads with 0 skipped.Checks
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspacepnpm --filter @repot/desktop typecheck/test/build--example scan/--example export, ortauri dev)Also ran:
pnpm --filter @repot/desktop testandbuild(no frontend change; typecheck not run),pnpm check, and the CI example testscargo test -p repot-core --example e2e_export --example smoke_export --example cross_os_e2e --example render_samples. Not run: the real app or CLI on this Mac. Windows is covered only by the FakeEnv test.Spec and generated files
scan.json,snapshots/,icons/) (none changed)Boundaries
repot-coredoes not depend on Tauri and does no network callsEnv; tests useFakeEnvand fixtures, not real toolsKnown limit (spec §15): a
core.excludesFileelsewhere (e.g.~/dotfiles/gitignore) is still exported from a scan, but that item is skipped when the file is opened again.