Skip to content

test(sudo): cover native grant validation and expiry - #17307

Open
statick88 wants to merge 2 commits into
omacom:omabot/pr-16111from
statick88:test/passwordless-native-validation
Open

statick88 wants to merge 2 commits into
omacom:omabot/pr-16111from
statick88:test/passwordless-native-validation

Conversation

@statick88

@statick88 statick88 commented Nov 2, 2026 •

Copy link
Copy Markdown

Summary

Refs #16223 and its native credential-validation coverage request.

  • Add opt-in disposable Docker coverage using real sudo and the actual passwordless grant publisher, revocation action, and expiry callback.
  • Verify mixed password-requiring policy, cold sudo -n -v, command authorization, revocation, native NOTAFTER, and isolation from a second account.
  • Document the local-image prerequisites and isolation controls. No production command, migration, or host sudo policy changes.

Dependency and scope

This complementary PR targets omabot/pr-16111, the head branch of #16223, rather than quattro. Its diff is only the coverage follow-up: 3 files, 145 additions. It does not duplicate the production fix or close #16223. Maintainers can integrate this commit into #16223; it is not an independent replacement for that PR.

Verification

  • Native integration: PASS with sudo 1.8.31 in a preloaded local Docker image. An independent verifier also ran it successfully.
  • Negative control: a disposable copy without the account-scoped verifypw = any default still allowed sudo -n /usr/bin/true, while sudo -n -v refused with sudo: a password is required. The unmodified publisher passed validation.
  • Expiry: while an expired rule remains, this sudo version can return success for validation even though actual command execution is refused. The test checks command refusal at the deadline, then invokes the real __expire action and requires both validation and command execution to refuse, without clearing credentials between active use and expiry.
  • Bash syntax and git diff --check: PASS.
  • Independent functional verification: PASS for the requested native coverage.
  • Initial 139-line candidate (a2b282c5b): four-lens native review approved; exact acknowledgement completed for review-04e17d535718a34c. Three non-blocking advisories concern duplicate opt-in checking, positional dummy identities, and timeout status handling. That approval is not presented as a new native approval of the later test-only correction below.

The native launcher disables networking and pulls, mounts the checkout read-only, uses a read-only container root plus bounded tmpfs state, clears the environment, drops all but identity-switching/audit capabilities, and sets CPU, memory, PID, file-size and wall-clock limits. It never mounts host accounts, sudoers files, credential caches, or the Docker socket inside the container.

Review follow-up: includedir compatibility and busy-host expiry

Commit 7f90def19 addresses the two P2 comments on the initial head:

  • Accept both #includedir and @includedir, including trailing whitespace, while preserving legacy syntax and rejecting the wrong directory. The old recognizer failed the @/whitespace probe; the correction passes. This is parser coverage, not a claim that the local sudo 1.8.31 image exercised a native @includedir policy.
  • Allow 15 seconds for grant setup and active checks, then wait once until the chosen absolute deadline. Skip sleeping if that deadline has already passed; do not poll. A scratch-only wrapper delayed real visudo calls: the old 3-second hook failed at active command authorization, while the corrected hook passed the same native scenario.

Final delayed native integration, plain native integration, before/equal/past-deadline wait probes, Bash syntax and diff checks passed. The follow-up changes only the test helper (9 additions, 3 deletions), not production policy or sandbox privileges. No additional independent verifier was required by its risk-gated assessment plan. Native assessment could not determine a tier because of the ambient untracked scratch declaration; no new native approval of this correction is claimed.

Known verification limits — not a green full-suite claim

These limits were explicitly accepted before submission:

  • nopasswd-sudo-expiry-test.sh in the constrained root container fails status must inspect policy without authentication. A single run at the pinned Let sudo -v validate against the passwordless sudo grant #16223 base reproduced byte-identical output and exit status. The existing mock fixture assumes a non-root account; this is not caused by the new native hook.
  • passwordless-grant-lifecycle-test.sh stops because the local image's older systemd-tmpfiles does not support --inline. That file and the production scripts are unchanged from the base; later package-scriptlet checks were not reached.
  • ShellCheck was unavailable. No dependency installation was performed.
  • No graphical or full desktop suite was run: this change touches no UI, shared test runner, or production helper.

Risk: security-sensitive test setup, confined to disposable dummy-account sudo policy. No merge is requested or performed automatically.

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; both previous findings are fixed and no new actionable issue was found.

Summary

Adds opt-in Docker coverage for real sudo grant validation, revocation, expiry, and account isolation.

  • The expiry suite can check sudo grants against real sudo in a disposable container.

Reviews (2) · Last reviewed commit: "test(sudo): handle include syntax and de..." · Reviewed by Greptile

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.

1 participant