Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sudo showing password in clear #998

Open
Cc618 opened this issue Jun 15, 2024 · 0 comments
Open

Sudo showing password in clear #998

Cc618 opened this issue Jun 15, 2024 · 0 comments

Comments

@Cc618
Copy link

Cc618 commented Jun 15, 2024

On Debian 12, Context.sudo shows the password in clear.

Task:

from invoke import task

@task
def test(c):
    c.run("whoami")
    c.sudo("whoami", pty=True)

Bug:

$ inv test
user
[sudo] password: <shows my password in clear>
Sorry, try again.
root
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/invoke/context.py", line 215, in _sudo
    return runner.run(cmd_str, watchers=watchers, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/invoke/runners.py", line 376, in run
    return self._run_body(command, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/invoke/runners.py", line 432, in _run_body
    return self.make_promise() if self._asynchronous else self._finish()
                                                          ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/invoke/runners.py", line 493, in _finish
    raise Failure(result, reason=watcher_errors[0])
invoke.exceptions.Failure: Command was not fully executed due to watcher error.
=== stdout ===
root

=== stderr ===
[sudo] password: Sorry, try again.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/inv", line 33, in <module>
    sys.exit(load_entry_point('invoke==2.0.0', 'console_scripts', 'inv')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/invoke/program.py", line 380, in run
    self.execute()
  File "/usr/lib/python3/dist-packages/invoke/program.py", line 565, in execute
    executor.execute(*self.tasks)
  File "/usr/lib/python3/dist-packages/invoke/executor.py", line 127, in execute
    result = call.task(*args, **call.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/invoke/tasks.py", line 115, in __call__
    result = self.body(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/tasks.py", line 7, in test
    c.sudo("whoami")
  File "/usr/lib/python3/dist-packages/invoke/context.py", line 170, in sudo
    return self._sudo(runner, command, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/invoke/context.py", line 227, in _sudo
    raise error
invoke.exceptions.AuthFailure: The password submitted to prompt '[sudo] password: ' was rejected.

Note that the command is executed correctly but we receive an AuthFailure

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

No branches or pull requests

1 participant