trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.9k stars 79 forks source link

Implement the `--validate` flag #612

Closed rnijveld closed 1 year ago

rnijveld commented 1 year ago

This PR implements the validate flag, fixing #395

Aside from that there are a few changes to the sudo pipeline to allow for easier composability, maybe even (in the future) reusing large parts for su. I still think that the run and run_validate look an awful lot like each other, but did not want to spend any more time on refactoring them right now. I've also derived Debug on the Output struct in the validation framework, that allowed me some easy debugging of a failing test.

github-actions[bot] commented 1 year ago

Number of dependencies and binary size impact report

Metric main PR #612 Delta
Direct dependencies 5 5 -
Total dependencies 10 10 -
Binary size 976.3 KiB 985 KiB +0.9%
Text size 566.9 KiB 569.9 KiB +0.5%
Dependencies diff ```diff └─ sudo-rs [v0.2.0-dev.20230627] ├─ glob [v0.3.1] ├─ libc [v0.2.147] ├─ log [v0.4.19] ├─ signal-hook [v0.3.15] | ├─ libc [v0.2.147] | ├─ signal-hook-registry [v1.4.1] | | └─ libc [v0.2.147] | └─ cc [v1.0.79] └─ signal-hook-registry [v1.4.1] ```
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 84.36% and project coverage change: -0.35 :warning:

Comparison is base (3b01636) 86.20% compared to head (427fd82) 85.85%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #612 +/- ## ========================================== - Coverage 86.20% 85.85% -0.35% ========================================== Files 62 62 Lines 8341 8440 +99 ========================================== + Hits 7190 7246 +56 - Misses 1151 1194 +43 ``` | [Impacted Files](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety) | Coverage Δ | | |---|---|---| | [src/pam/error.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3BhbS9lcnJvci5ycw==) | `80.31% <0.00%> (-2.62%)` | :arrow_down: | | [src/sudo/pipeline.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG8vcGlwZWxpbmUucnM=) | `84.00% <79.38%> (-9.45%)` | :arrow_down: | | [src/system/timestamp.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N5c3RlbS90aW1lc3RhbXAucnM=) | `89.80% <80.95%> (-0.42%)` | :arrow_down: | | [src/pam/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3BhbS9tb2QucnM=) | `91.18% <91.66%> (+0.95%)` | :arrow_up: | | [src/sudo/pam.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG8vcGFtLnJz) | `96.03% <92.85%> (+7.71%)` | :arrow_up: | | [src/sudo/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG8vbW9kLnJz) | `79.12% <100.00%> (+1.59%)` | :arrow_up: | | [src/sudoers/policy.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N1ZG9lcnMvcG9saWN5LnJz) | `93.40% <100.00%> (+0.54%)` | :arrow_up: | ... and [6 files with indirect coverage changes](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/612/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: Do you have feedback about the report comment? Let us know in this issue.