Skip to content

Commit 39c2359

Browse files
committed
@sanderegg review: add user prompt
1 parent 25150b6 commit 39c2359

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/pytest-simcore/src/pytest_simcore/environment_configs.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,23 @@ def external_envfile_dict(
5858
term in envfile.name.lower() for term in ("ignore", "secret")
5959
):
6060
_logger.warning(
61-
"🚨 CAUTION: The file '%s' from '--external-envfile' may be versioned and exposed publicly. "
62-
"Add 'secret' or 'ignore' to the filename to exclude it automatically.",
61+
"🚨 CAUTION: The external envfile '%s' may contain sensitive data and could be accidentally versioned. "
62+
"To prevent this, include the words 'secret' or 'ignore' in the filename.",
6363
envfile.name,
6464
)
6565

6666
envs = load_dotenv(envfile)
6767

68+
if envs:
69+
response = input(
70+
f"🚨 CAUTION: You are about to run tests using environment variables loaded from '{envfile}'.\n"
71+
"This may cause tests to interact with or modify real external systems (e.g., production or staging environments).\n"
72+
"Proceeding could result in data loss or unintended side effects.\n"
73+
"Are you sure you want to continue? [y/N]: "
74+
)
75+
if response.strip().lower() not in ("y", "yes"):
76+
pytest.exit("Aborted by user due to external envfile usage.")
77+
6878
return envs
6979

7080

0 commit comments

Comments
 (0)