summaryrefslogtreecommitdiff
path: root/crates/fs-mistrust/src
Commit message (Collapse)AuthorAgeFilesLines
...
* fs-mistrust: Apply deferred cargo fmt.Gabriela Moldovan2024-08-081-1/+4
|
* fs-mistrust: Add a CheckedDir::metadata function.Gabriela Moldovan2024-08-081-1/+28
|
* fs-mistrust: Use Path::try_exists() instead of Path::exists().Gabriela Moldovan2024-07-301-2/+2
|
* fs-mistrust: Explain that Error might not be a permissions errorIan Jackson2024-07-101-0/+7
|
* fs-mistrust: Fix a formatting botchIan Jackson2024-07-101-2/+3
| | | | rustfmt didn't want to fix this, for some reason.
* Fix a footnote reference that Nightly complains aboutIan Jackson2024-07-081-1/+1
|
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Run maint/add_warning.Nick Mathewson2024-03-138-0/+8
|
* Fix typos in doc commentsTobias Stoeckmann2024-03-062-2/+2
|
* Fix typos in commentsTobias Stoeckmann2024-03-061-1/+1
|
* fs-mistrust: Introduce a fn display_lossyIan Jackson2024-03-051-2/+9
| | | | | We're going to tell clippy to forbid Path::display. But we can't have the PathExt from tor-basic-utils, here.
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* educe: Use std's default for enums where default variant is unitIan Jackson2024-02-122-10/+6
| | | | | | | | | | | | | Since Rust 1.66, std's default works properly for enums, provided that the default variant is a unit. Review all uses of `#[educe(default)]` on enums and replace them with std where possible, which is most of them. In 1.66 and later, std's `#[derive(Default)]` doesn't infer any generic bounds on the derived impl, where it's an enum - since the unit variant can always be constructed. So this change doesn't add any generic bounds and is not API-visible.
* fs_mistrust: Provide CheckedDir::make_secure_dirIan Jackson2024-01-291-0/+18
| | | | | | state_dir wants this, to descend into subdirectories. I think the implementation could be improved - see the TODO.
* fs_mistrust: Expose CheckedDir::verifierIan Jackson2024-01-251-2/+2
| | | | | | | | | I'm not sure why this isn't public. It seems like an obviously reasonable transformation. If I as author of !1927 had been an external contributor, I could have worked around the lack of .make_secure_directory() if .verifier() had existed. So I think exposing it would be useful.
* fs-mistrust: Explain where a Verifier comes fromIan Jackson2023-12-131-0/+2
|
* fs-mistrust: Add read_directory and remove_file to CheckedDir.Nick Mathewson2023-11-271-0/+142
| | | | Closes #1117.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-238-0/+8
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Run cargo +nightly fmt to format many let ... else ...Ian Jackson2023-07-241-4/+9
| | | | | | | | | | | rustfmt has grown opinions about how let ... else ... ought to be formatted. They don't always agree with our previous manual decisions. I think our policy is to always insist on rustfmt. When that version of rustfmt hits stable, our CI will start to fail for everyone. (Right now this discrepancy just causes trouble for contributors who are using nightly by default.)
* fs-mistrust: Run rustfmt to apply deferred formatting churnIan Jackson2023-07-141-10/+10
|
* fs-mistrust: In a test, simplify env var handlingIan Jackson2023-07-141-17/+10
|
* fs-mistrust: users: Use OsStr and OsString a lot lessIan Jackson2023-07-141-13/+23
| | | | | | | | We don't use OsString now except where it appears in our public API, or where we get it from std::env. Moving the `use` statements into the use sites enabled me to see that I had found all the places I wanted to change.
* fs-mistrust: Remove a now-unneeded suppressionIan Jackson2023-07-141-1/+0
| | | | This function is actually (properly) fallible now.
* fs-mistrust: forbid unsafe codeIan Jackson2023-07-141-0/+8
|
* fs-mistrust: Replace a direct libc call in a testIan Jackson2023-07-141-1/+1
|
* fs-mistruct: Abolish some now-unneeded mutsIan Jackson2023-07-141-26/+25
| | | | | MockPwdGrpProvider has internal mutability and is Sync, so its add functions take &self.
* fs-mistrust: Use pwd-grp's getgroups functionIan Jackson2023-07-141-24/+1
| | | | | This gets rid of some unsafe code here, with doubtful error handling, in favour of the unit-tested version in pwd-grp.
* fs-mistruct: switch from users to pwd-grpIan Jackson2023-07-141-41/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | users is unmaintained. pwd-grp is the crate I have just written to replace it. In this commit: Change the cargo dependency and imports. Replace the cacheing arrangements. users has a built-in cache; pwd-grp doesn't. Now, instead of cashing individual lookups, we cache the trusted user and trusted gid calculation results. This saves on some syscalls, and is also more convenient to write. (Mocking is still done via the dependency.) Many systematic consequential changes of details: * The entrypoint names to the library are different: pwd-grp uses the names of the corresponding Unix functions. * pwd-grp's returned structs are transparent, so we don't call accessors for .uid(), .name(), etc. * pwd-grp's methods are much more often fallible (returning io::Result<Option<...>) * We're using the non-UTF-8 pwd-grp API, which means we must use turbofish syntax in some places. * The mocking API is a bit different.
* fs-mistrust: Introduce tempoary PwdGrpProvider aliasIan Jackson2023-07-141-4/+8
| | | | | This allows us to change a number of trait bounds in advance, reducing noise in the next commit.
* fs-mistrust: impl Hash for TrustedUser and TrustedGroup (config)Ian Jackson2023-07-141-2/+2
|
* fs-mistrust: users: tests: Introduce mock_users etc.Ian Jackson2023-07-141-25/+36
| | | | | | | | | | Add some wrapper functions for convenience. The pwd-grp crate has a richer and more faithful, but not so convenient, way of creating dummy user/group entries. Also the type names are all going to change. Doing this now reduces churn.
* fs-mistrust: users: Make several functions fallibleIan Jackson2023-07-142-26/+41
| | | | | | | | | The actual underlying operations here *are* fallible. The `users` crate hides those errors in several cases. (Failures are very rare (at least unless NIS is involved), so this is not of much practical import, but it's going to be necessary when we use the more careful pwd-grp crate.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-108-0/+9
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* add opaque ErrorHint API, impl ErrorHint from BadPermissionsShady Katy2023-01-272-2/+2
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-278-0/+8
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-128-0/+67
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
* Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-239/+1
| | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* fix clippy::needless_borrowtrinity-1686a2022-09-101-15/+12
|
* Fix broken build and tests after arti!700.Alexander Færøy2022-08-311-3/+4
| | | | | | | | | | | | | This patch fixes a minor build error where we would call `compact_home()` on Windows instead of `anonymize_home()` on our PathBuf instance. Additionally we change how the `arti_conf` path is constructed such that we join the individual path components to ensure that no "/" ends up being present on Windows where path's are separated by "\". See: tpo/core/arti#555. See: tpo/core/arti!700.
* Merge branch 'compact_home_2' into 'main'Nick Mathewson2022-08-314-7/+179
|\ | | | | | | | | | | | | Represent the home directory as ${HOME} or %UserProfile% Closes #555 See merge request tpo/core/arti!700
| * Use anonymize_home() when displaying various messages.Nick Mathewson2022-08-312-8/+26
| | | | | | | | Closes #555
| * fs-mistrust: Add a `anonymize_home` extension fn for Path.Nick Mathewson2022-08-313-1/+155
| | | | | | | | | | | | This function transforms `/home/nickm/.config` to `${HOME}/.config/`, so that we can expose the username less in our logs.
* | Comment out docstring as it fails to compile on Windows.Alexander Færøy2022-08-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | This patch comments out a method call to `trust_group()` as this method is not available on all platforms that Arti builds on right now and thus fails to compile there. I have added a comment that the given call is not available on non-Unix like platforms. See: tpo/core/arti#557.
* | Disable 3 tests in fs-mistrust.Alexander Færøy2022-08-301-0/+3
| | | | | | | | | | | | | | | | This patch disables `readable_ok()`, `multiple_errors()`, and `check_contents()` as they all rely on permission issues on groups being detected properly which is not the case on Windows right now. See: tpo/core/arti#557.