-
Notifications
You must be signed in to change notification settings - Fork 135
feat: add Secret support (Closes #4269) #4640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,10 @@ | |
| from time import sleep | ||
| from typing import TYPE_CHECKING, Any | ||
|
|
||
| from robot import version as robot_version | ||
|
|
||
| if robot_version.get_version() >= "7.4": | ||
| from robot.api.types import Secret | ||
| from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError | ||
| from robot.utils import timestr_to_secs | ||
|
|
||
|
|
@@ -249,7 +253,9 @@ def resolve_secret(self, secret_variable: Any, arg_name: str) -> str: | |
| "Use special variable syntax ($var instead of ${var}) " | ||
| "to prevent variable values from being spoiled." | ||
| ) | ||
| return secret | ||
| if robot_version.get_version() < "7.4": | ||
| return secret | ||
| return secret.value if isinstance(secret, Secret) else secret | ||
|
Comment on lines
+256
to
+258
|
||
|
|
||
| def decrypt_with_crypto_library(self, secret): | ||
| if not isinstance(secret, str) or not re.match(r"^crypt:(.*)", secret): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robot_version.get_version()is being compared to the string "7.4". Lexicographic string comparison will mis-detect versions like 7.10.x and 10.x (e.g., "10.0" < "7.4"), which would disableSecretsupport on newer Robot Framework versions. Use a robust check instead (e.g., try/except importingrobot.api.types.Secret, or parse the version into numeric parts before comparing).