StackStorm / StackStorm/st2

Fix PEM formatting bug when loading private SSH keys in _get_pkey_object

Open
#6,338 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

Summary

When providing RSA private keys (especially in single-line format or missing proper PEM line breaks), the _get_pkey_object method fails with paramiko.SSHException, even for valid keys.

Environment
  • StackStorm version: 3.8.1
  • Affected component: st2common/st2common/runners/paramiko_ssh.py key parsing
  • Python version: 3.8
  • OS: Ubuntu 24.04.1
Steps to Reproduce
  1. Use an inline RSA private key with no line breaks, such as from an environment variable or API POST.
  2. Execute an SSH action.

Contributor guide

Open the contributing guide

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.

Research direction

Start in st2common/st2common/runners/paramiko_ssh.py at _get_pkey_object and reproduce the failure with the inline RSA private key format described in the issue. Trace the key parsing path and verify that valid keys without PEM line breaks load successfully when an SSH action is executed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.