Skip to content

Raise error when both password and key_file are provided#15

Merged
gensyn merged 4 commits intomainfrom
copilot/fix-password-and-key-file-error
Mar 25, 2026
Merged

Raise error when both password and key_file are provided#15
gensyn merged 4 commits intomainfrom
copilot/fix-password-and-key-file-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

Providing both password and key_file silently succeeded using the password, with no indication that the conflicting inputs were ignored. This adds an explicit validation error when both are supplied.

Changes

  • Validation (__init__.py): Added a password_and_key_file check after the existing "neither provided" guard
  • Translations (strings.json, translations/en.json, translations/de.json): Added the new password_and_key_file error key
  • Tests (test_validate_service_data.py): Added test_password_and_key_file_raises
  • Docs (README.md): Updated validation rules to reflect the mutual exclusivity of password and key_file
Original prompt

This section details on the original issue you should resolve

<issue_title>No error when providing password AND key file</issue_title>
<issue_description>SSH Command version
v1.0.0

Home Assistant version
2026.3.2

Issue / Experienced behavior
When the action is provided with a password AND a key file, the action succeeds if the password is correct.

Expected behavior
Providing a password and a key file should always result in an error.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix issue with password and key file resulting in no error Raise error when both password and key_file are provided Mar 25, 2026
Copilot AI requested a review from gensyn March 25, 2026 07:51
@gensyn
Copy link
Copy Markdown
Owner

gensyn commented Mar 25, 2026

@copilot Please fix the unit tests that broke in this branch.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 25, 2026

@copilot Please fix the unit tests that broke in this branch.

Fixed in 9ef8835. After a merge, _validate_service_data gained a hass parameter as its first argument, but the new test was still calling it with only data. Updated the test to pass self.mock_hass as the first argument, consistent with all other tests in the file.

@gensyn gensyn marked this pull request as ready for review March 25, 2026 08:10
@gensyn gensyn merged commit 1475fd2 into main Mar 25, 2026
5 checks passed
@gensyn gensyn deleted the copilot/fix-password-and-key-file-error branch March 25, 2026 08:10
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.

No error when providing password AND key file

2 participants