sudo-project / sudo

Utility to execute a command as another user
https://www.sudo.ws
Other
1.17k stars 213 forks source link

cvtsudoers outputs invalid JSON #369

Closed es-fabricemarie closed 5 months ago

es-fabricemarie commented 5 months ago

Using the following sudoers file in /etc/sudoers.d/test3:

user0   ALL = CHROOT=/var/www CWD=/htdocs /bin/ksh

Using the command:

cvtsudoers --defaults=all --output-format=JSON --input-format=SUDOERS --output=- /etc/sudoers.d/test3

We get the following invalid JSON output:

{
    "User_Specs": [
        {
            "User_List": [
                { "username": "user0" }
            ],
            "Host_List": [
                { "hostname": "ALL" }
            ],
            "Cmnd_Specs": [
                {
                    "Options": [
                        "runchroot": "/var/www",
                        "runcwd": "/htdocs"
                    ],
                    "Commands": [
                        { "command": "/bin/ksh" }
                    ]
                }
            ]
        }
    ]
}

The invalid part is here:

"Options": [
    "runchroot": "/var/www",
    "runcwd": "/htdocs"
],
millert commented 5 months ago

Thanks for the report, this is fixed by 26ce75110f5b5f7120b561aa136e65639261d407