Skip to content

Fix invalid SSH key name error code - #6026

Merged
knolleary merged 1 commit into
node-red:mainfrom
NUAAwqy:taiyi/fix-invalid-ssh-key-name-6009
Oct 21, 2026
Merged

knolleary merged 1 commit into
node-red:mainfrom
NUAAwqy:taiyi/fix-invalid-ssh-key-name-6009

Conversation

@NUAAwqy

@NUAAwqy NUAAwqy commented Oct 19, 2026

Copy link
Copy Markdown
Contributor
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Fixes #6009.

When an SSH key name contains invalid characters, generateSSHKey creates an
Error object but assigns its code through an undefined variable. The request
therefore returns e is not defined with unexpected_error instead of the
intended invalid_key_name response. This change assigns the code to the
created error and adds a regression test for the public error contract.

Checklist

  • I have read the contribution guidelines.
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

Validation

  • The original module returns ReferenceError: e is not defined and no error
    code for name: "bad key".
  • The fixed module returns Invalid SSH Key name with
    code: "invalid_key_name".
  • Focused SSH storage suite: 17 passing.
  • ESLint on the changed source and test files: passing.
  • git diff --check: passing.

Prepared and tested with Codex assistance; no human review is claimed.

Preserve the intended validation error and code when a project SSH key name contains invalid characters.

Fixes node-red#6009

Prepared and tested with Codex assistance.

Signed-off-by: NUAAwqy <[email protected]>
@knolleary
knolleary merged commit 3551d56 into node-red:main Oct 21, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

Generating an SSH key with an invalid name returns "e is not defined" instead of "Invalid SSH Key name"

2 participants