jj/cli
Yuya Nishihara ded48ff6e7 local_working_copy: do not create file or write in directory named .jj or .git
I originally considered adding deny-list-based implementation, but the Windows
compatibility rules are super confusing and I don't have a machine to find out
possible aliases. This patch instead adds directory equivalence tests.

In order to test file entity equivalence, we first need to create a file or
directory of the requested name. It's harmless to create an empty .jj or .git
directory, but materializing .git file or symlink can temporarily set up RCE
situation. That's why new empty file is created to test the path validity. We
might want to add some optimization for safe names (e.g. ASCII, not contain
"git" or "jj", not contain "~", etc.)

That being said, I'm not pretty sure if .git/.jj in sub directory must be
checked. It's not safe to cd into the directory and run "jj", but the same
thing can be said to other tools such as "cargo". Perhaps, our minimum
requirement is to protect our metadata (= the root .jj and .git) directories.

Despite the crate name (and internal use of std::fs::File),
same_file::is_same_file() can test equivalence of directories. This is
documented and tested, so I've removed my custom implementation, which was
slightly simpler but lacks Windows support.
2024-11-06 15:03:41 -08:00
..
examples revset: allow iterators to return evaluation errors 2024-10-18 17:09:35 -04:00
src repo_path: add stub for checked to_fs_path(), rename unchecked functions 2024-11-06 15:03:41 -08:00
testing style: inline variables into format strings 2024-10-04 22:29:13 +02:00
tests local_working_copy: do not create file or write in directory named .jj or .git 2024-11-06 15:03:41 -08:00
build.rs build: fix cargo publish by symlinking cli/docs->docs 2024-11-05 17:37:14 -08:00
Cargo.toml build: fix cargo publish by symlinking cli/docs->docs 2024-11-05 17:37:14 -08:00
docs build: fix cargo publish by symlinking cli/docs->docs 2024-11-05 17:37:14 -08:00
LICENSE