microsoft / microsoft/sudo

Add `--` instead of performing a short-circuit upon detecting a script-block.

Open
#38 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Task
Dominant language
Rust
Stars
5.9k
Forks
180
Avg merge
1d 7h
Merged PRs (30d)
2

Description

Description of the new feature / enhancement

Enhance sudo to recognize and support script blocks prefixed with --. Currently, the script will short-circuit and execute script blocks directly, leading to perhaps unexpected behavior. By introducing support for the -- prefix, users can clearly indicate when a following argument is a script block.

Scenario when this would be used?

One scenario where adding support for the -- argument for script blocks would be useful is when users need to pass a script block as an argument to the sudo command within a command line environment.

With the -- argument implemented, users can specify script blocks explicitly, ensuring that they are processed correctly by sudo. This can be particularly useful in automation scenarios, scripting tasks, or when invoking sudo from other scripts or tools where passing script blocks as arguments is necessary. Call it free will if you may.

Supporting information
  • Sudo Manual -> Sudo

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Sudo manual linked in the issue and trace the command-line handling for script blocks and the current short-circuit behavior. Determine how a -- prefix should distinguish an explicitly supplied script block. Done means the command accepts that form and no longer executes the script block through the current short-circuit path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.