Repository navigation
Conversation
4450532 to
d0b996a
Compare
|
Thank you for your interest in paramiko. Per discussion with bitprophet, the paramiko project is operating under a blanket policy rejecting AI-generated contributions of all kinds. The text of all issue and PR descriptions, and all code in PRs, comment-suggestions, etc. must be human-written. Direct attributions of AI authorship fall under the policy straightforwardly. In the absence of direct attribution, evaluation of AI authorship is ultimately a judgment call. Closing this PR due to inferred AI authorship. |
|
Uh-huh It was a 2-file commit ... I mean even using AI for that is a joke. |
|
Thanks for following up, @bhavyup. Apologies for evaluating your PRs as AI; it is a judgment call a lot of the time, and I know I'm going to get it wrong periodically. And yes, I've seen some really small commits that were even still pretty clearly AI-written. A single-commit, multi-file PR isn't something I usually see from human authors, especially with subsequent changes applied by force-push instead of just adding additional commits. The fix does make sense, only passing the correct portion to Are there any constraints on the validity of the contents of the preamble, or can it be any arbitrary text? (If the former, then should we consider validating?) Separately, more generally - how did you come across paramiko? Were you trying to use it and encountered this? |
|
Thanks @bskinn for reopening this and I get the AI part. You did it with right mindset! For the follow-up question. Answering it directly: no, the preamble does not need validation, and adding validation would be the wrong fix here. Let's tackle why? (sorry if it's too long):
That distinction matters for your question. There is no preamble format in the RFC that paramiko could validate against. If I invented one, for example only plain sentences, or only Validation would also add no security here. The preamble is ignored, it is not executed, it is not used as key material, and it does not decide the key type. The THE FIX: The outer loader, Because of that slice, preamble content cannot affect parsing, except for one unavoidable rule, which I cover below. CURRENT TEST COVERAGE: The PR adds one test, It prepends two lines to the test RSA key:
That test alone is not exhaustive, and it is not foolproof. It does not separately cover blank lines, a multi-line bag-attributes block, an EC PEM key, an encrypted traditional PEM key with preamble, or a fake [IMPORTANT] The fake BEGIN case This is the one edge where "arbitrary text" needs qualification. Paramiko's But an exact fake
I do not think preamble validation solves this. Validation cannot tell whether a TEST PROPOSAL To make the generality concrete instead of just arguing it, I can add the following as a separate follow-up commit, if you would like them:
I would deliberately not add an exact fake Please let me know if you want the additional tests added, or if you would prefer a different shape for the fake |
|
As for the general part, I did use paramiko to get the SSH tooling I use to reach my PC over Tailscale for myself and my AI Agents. Though my main work was based on Ed25519 OpenSSH key, not an RSA PEM key with a preamble, and the OpenSSH path was already sliced correctly anyway, so I did not encounter the bug this way. Since then, I've had eyes on many other issues too apart from the two I worked on. Did some work on them too but I did not push or open PRs since multiple PRs in a short time with no maintainer's permission/guidance would just flag me more into BOT Category. |
Closes #1641.
PKey._read_private_key()correctly skips preamble lines to locate the-----BEGINtag, but then passed the entire file (preamble included) to_read_private_key_pem(), which assumes line 0 isBEGIN. The preamble lines were fed into the base64 decoder, failing with "base64 decoding error".This passes only the lines from
BEGINonward to_read_private_key_pem(), so preamble lines are excluded before header parsing and base64 decoding.Changes:
paramiko/pkey.py: slicelines[begin:end]in_read_private_keyfor the PEM pathtests/pkey.py: test loading a PEM key with preamble lines (including aKey: valuestyle line to cover header parsing)All 58 tests in
tests/pkey.pypass.