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

sudoers: null byte terminated username not treated as a syntax error #749

Closed
japaric opened this issue Sep 4, 2023 · 1 comment · Fixed by #751
Closed

sudoers: null byte terminated username not treated as a syntax error #749

japaric opened this issue Sep 4, 2023 · 1 comment · Fixed by #751
Assignees
Labels
non-compliant used to track failing compliance tests

Comments

@japaric
Copy link
Collaborator

japaric commented Sep 4, 2023

relevant test

#[test]
fn null_byte_terminated_username() -> Result<()> {
let env = Env("ferris\0 ALL=(ALL:ALL) NOPASSWD: ALL")
.user("ferris")
.build()?;
let output = Command::new("sudo")
.arg("true")
.as_user("ferris")
.output(&env)?;
assert!(!output.status().success());
assert_contains!(output.stderr(), "syntax error");
Ok(())
}

ogsudo rejects the sudoers file and does not allow the user to run sudo. sudo-rs lets the user run sudo

@japaric japaric added the non-compliant used to track failing compliance tests label Sep 4, 2023
@squell squell self-assigned this Sep 5, 2023
@squell
Copy link
Collaborator

squell commented Sep 5, 2023

There is an interplay between two issues here:

  • a commit that addressed this (and also changes the sentinel value to a more type-safe solution) was never pushed for some reason
  • the illegal escape sequence error is suppressed, seems like that happens in the whitespace parser

This is a nice bug, harmless but interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-compliant used to track failing compliance tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants