Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Handling of double quotes in command arguments

Open
#182 9 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
cli, security

Research direction

Start by reading the sudoers manual section on command arguments and the parser or matching code that handles quoted arguments; the issue does not name specific files or tests. Reproduce the two examples from the report on a current version and trace how quoted and empty arguments are matched. Done means the allowed commands match the documented quoting rules, with regression tests covering both examples.

Written by the indexing model from the issue text.

Description

As far as I understand from the manual, double quotes can be used to escape special characters in any context and they should always be balanced (or escaped with a \). When it comes to command-line arguments though, I observe the following behaviour (on version 1.9.9 and prior; apologies I'm not able to test on the latest version):

The following entry:

   test ALL = NOPASSWD: /bin/ls " foo"

results in user test being able to run these two commands:

   sudo ls '" foo"'
   sudo ls '"' 'foo"'

but not what is expected:

   sudo ls ' foo'

and the following entry:

   test ALL = NOPASSWD: /bin/ls ""

results in user test being able to run both:

   sudo ls '""'
   sudo ls
Dominant language
C
Stars
1.7k
Forks
306
Avg merge
1d 2h
Merged PRs (30d)
22

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from sudo-project/sudo

All issues in sudo-project/sudo

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.