Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Papercut fix: null bytes starting whitespace in sudoers files #751

Merged
merged 4 commits into from
Sep 5, 2023

Conversation

squell
Copy link
Collaborator

@squell squell commented Sep 5, 2023

This is perhaps best reviewed commit by commit.

  • First commit unignores the compliance tests
  • Second commit fixes the spot where the "illegal escape" error was hidden (which made it harder to find the bug)
  • Third commit changes the error into the correct one (escape character is now hardcoded \, no need for a sentinel)
  • Fourth commit seems a bit unrelated, but changes the contract of accept_if, which was the only function for which you could rely on an Err result to not have consumed input (which accept_escaped then followed incorrectly) to prevent similar mistakes in the future.

@squell squell linked an issue Sep 5, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Number of dependencies and binary size impact report

Metric main PR #751 Delta
Direct dependencies 3 3 -
Total dependencies 4 4 -
Binary size 1 MiB 1023.9 KiB -0.5%
Text size 597.6 KiB 593.6 KiB -0.7%
Dependencies diff
 └─ sudo-rs [v0.2.0]
    ├─ glob [v0.3.1]
    ├─ libc [v0.2.147]
    └─ log [v0.4.20]

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02% 🎉

Comparison is base (0ac6fa8) 54.86% compared to head (aaf4b7d) 54.88%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #751      +/-   ##
==========================================
+ Coverage   54.86%   54.88%   +0.02%     
==========================================
  Files          71       71              
  Lines        9731     9736       +5     
==========================================
+ Hits         5339     5344       +5     
  Misses       4392     4392              
Files Changed Coverage Δ
src/sudoers/tokens.rs 96.42% <ø> (ø)
src/sudoers/ast.rs 82.76% <100.00%> (ø)
src/sudoers/basic_parser.rs 94.73% <100.00%> (+0.02%) ⬆️
src/sudoers/test/mod.rs 92.82% <100.00%> (+0.07%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

rnijveld
rnijveld previously approved these changes Sep 5, 2023
@squell squell disabled auto-merge September 5, 2023 09:42
@squell squell marked this pull request as draft September 5, 2023 09:54
@squell squell added this pull request to the merge queue Sep 5, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Sep 5, 2023
@rnijveld rnijveld added this pull request to the merge queue Sep 5, 2023
Merged via the queue into main with commit 7ba72d7 Sep 5, 2023
16 checks passed
@squell squell deleted the fix-null-chars branch September 21, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sudoers: null byte terminated username not treated as a syntax error
2 participants