Linux sudo raises UnexpectedExit instead of AuthFailure on incorrect password
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- authentication, cli
Hướng nghiên cứu
Start with the Linux sudo path in invoke/context.py, especially _sudo, then trace the runner behavior named in invoke/runners.py through _finish. Compare the incorrect-password result with the macOS behavior; done means invoke.sudo raises AuthFailure rather than UnexpectedExit for the reported Linux case.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
On Linux, invoke.sudo raises UnexpectedExit instead of AuthFailure on incorrect password.
>>> import invoke
>>> invoke.sudo("ls", password="a")
[sudo] password: Sorry, try again.
[sudo] password: Sorry, try again.
[sudo] password: sudo: 3 incorrect password attempts
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/nelson/foo/.venv/lib/python3.7/site-packages/invoke/__init__.py", line 68, in sudo
return Context().sudo(command, **kwargs)
File "/home/nelson/foo/.venv/lib/python3.7/site-packages/invoke/context.py", line 170, in sudo
return self._sudo(runner, command, **kwargs)
File "/home/nelson/foo/.venv/lib/python3.7/site-packages/invoke/context.py", line 215, in _sudo
return runner.run(cmd_str, watchers=watchers, **kwargs)
File "/home/nelson/foo/.venv/lib/python3.7/site-packages/invoke/runners.py", line 376, in run
return self._run_body(command, **kwargs)
File "/home/nelson/foo/.venv/lib/python3.7/site-packages/invoke/runners.py", line 432, in _run_body
return self.make_promise() if self._asynchronous else self._finish()
File "/home/nelson/foo/.venv/lib/python3.7/site-packages/invoke/runners.py", line 499, in _finish
raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!
Command: "sudo -S -p '[sudo] password: ' ls"
Exit code: 1
Stdout: already printed
Stderr: already printed
Version info
invoke: 2.0.0 (also tested on 1.7.1)
OS: Ubuntu 20.04.5 LTS
Python: 3.7.13 (also tested on 3.8.13 and 3.10.5)
I tested this on macOS and it raises AuthFailure as expected.
- Ngôn ngữ chính
- Python
- Star
- 4.8k
- Fork
- 412
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pyinvoke/invoke
-
[Security] Shell injection via Context.cd() path argument — metacharacters not escaped (CWE-78) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Tất cả issue của pyinvoke/invoke
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
stephrobert/dsoxlab#238 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
sublimehq/package_control#1780 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
nwg-piotr/nwg-displays#145 ·