plugins/sudoers/lookup.c: fix NOTBEFORE to be able to deny#513
Merged
millert merged 1 commit intosudo-project:mainfrom Jan 13, 2026
Merged
plugins/sudoers/lookup.c: fix NOTBEFORE to be able to deny#513millert merged 1 commit intosudo-project:mainfrom
millert merged 1 commit intosudo-project:mainfrom
Conversation
If someone specifies both a NOTBEFORE and a NOTAFTER rule, the NOTAFTER rule always overrided the result of the NOTBEFORE. Let each of them be able to deny.
85e3d50 to
547d02d
Compare
Contributor
Author
|
It has been a regression/behavior change in sudo 1.9.15, commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If someone specifies both a NOTBEFORE and a NOTAFTER rule, the NOTAFTER rule always overrided the result of the NOTBEFORE. Let each of them be able to deny.
Example to demonstrate the issue: add something like this to sudoers:
root ALL=(ALL) NOTBEFORE=20270101000000 NOTAFTER=20280101000000 NOPASSWD: /usr/bin/id
(Feel free to modify "root" to your user.)
Run "sudo id", since we are not living in year 2027, my expectation would be a deny.
However what happens is that the notbefore statement's denial will be overwritten by the notafter rule, which accepts the command run.