Skip to content

Accept Robot Framework Secret values in connection and login keywords - #490

Open
boluwatifeajayi wants to merge 1 commit into
MarketSquare:masterfrom
boluwatifeajayi:feat/robot-secret-support
Open

boluwatifeajayi wants to merge 1 commit into
MarketSquare:masterfrom
boluwatifeajayi:feat/robot-secret-support

Conversation

@boluwatifeajayi

Copy link
Copy Markdown

Fixes #486.

Robot Framework 7.4 added robot.api.types.Secret. SSHLibrary passed these objects straight to paramiko, so Open Connection ${HOST} with a secret host tried to resolve the string form of the object as a hostname, and the only way around it was ${PASSWORD.value}, which puts the real value back into the logs.

This adds a small _reveal() helper that returns value.value for a Secret and leaves anything else untouched, and uses it for the arguments the issue lists: host in Open Connection, username and password in Login, and username, keyfile and password in Login With Public Key. The import of Secret is guarded, so Robot Framework versions before 7.4 (the package still allows 5.0 and up) keep working as before. The keyword docs mention it.

I checked it with a small robot suite that builds the secrets with Evaluate. Before the change Open Connection fails with gaierror: nodename nor servname provided because the Secret object is used as the hostname, and after it the library connects to the real host. I also added utest/test_secret.py with pytest tests for the helper and the three keywords using a mocked client, they run with PYTHONPATH=src pytest utest on Robot Framework 7.4 or newer and skip on older versions. I did not run the acceptance tests since they need the SSH docker setup.

Open Connection (host), Login (username, password) and Login With Public
Key (username, keyfile, password) now unwrap robot.api.types.Secret
arguments, so users no longer have to pass ${PASSWORD.value} and expose
the value. Older Robot Framework versions without Secret are unaffected.

Fixes MarketSquare#486
Copilot AI balanced review requested due to automatic review settings October 19, 2026 06:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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.

Support Robot Framework Secret type in SSHLibrary keywords

2 participants