trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.88k stars 77 forks source link

refactor: add SudoString and SudoPath #784

Closed japaric closed 10 months ago

japaric commented 11 months ago

these are versions of libstd's String and PathBuf that contain no null bytes and thus can be easily converted into CStr

SudoPath has the additional invariant that it is UTF-8 encoded. SudoPath is used to represent CWD which appears in the sudoers file. sudo-rs only accepts UTF-8 encoded sudoers files

closes #748

codecov[bot] commented 11 months ago

Codecov Report

Attention: 57 lines in your changes are missing coverage. Please review.

Comparison is base (d91d47e) 55.35% compared to head (f66a241) 55.65%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #784 +/- ## ========================================== + Coverage 55.35% 55.65% +0.29% ========================================== Files 72 74 +2 Lines 9833 9953 +120 ========================================== + Hits 5443 5539 +96 - Misses 4390 4414 +24 ``` | [Files](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety) | Coverage Δ | | |---|---|---| | [src/cli/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2NsaS9tb2QucnM=) | `92.85% <100.00%> (ø)` | | | [src/cli/tests.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2NsaS90ZXN0cy5ycw==) | `100.00% <100.00%> (ø)` | | | [src/common/context.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2NvbW1vbi9jb250ZXh0LnJz) | `84.09% <ø> (ø)` | | | [src/env/tests.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2Vudi90ZXN0cy5ycw==) | `99.07% <100.00%> (+<0.01%)` | :arrow_up: | | [src/su/cli.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1L2NsaS5ycw==) | `92.73% <100.00%> (-0.05%)` | :arrow_down: | | [src/sudoers/ast.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG9lcnMvYXN0LnJz) | `82.76% <100.00%> (ø)` | | | [src/sudoers/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG9lcnMvbW9kLnJz) | `73.02% <100.00%> (ø)` | | | [src/sudoers/policy.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG9lcnMvcG9saWN5LnJz) | `77.17% <100.00%> (ø)` | | | [src/sudoers/test/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG9lcnMvdGVzdC9tb2QucnM=) | `93.03% <100.00%> (ø)` | | | [src/sudoers/tokens.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG9lcnMvdG9rZW5zLnJz) | `96.47% <100.00%> (+0.04%)` | :arrow_up: | | ... and [11 more](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety) | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/784/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.