File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/pytest-simcore/src/pytest_simcore Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ def pytest_addoption(parser: pytest.Parser):
2828
2929
3030@pytest .fixture (scope = "session" )
31- def external_envfile_dict (request : pytest .FixtureRequest ) -> EnvVarsDict :
31+ def external_envfile_dict (
32+ request : pytest .FixtureRequest , osparc_simcore_root_dir : Path
33+ ) -> EnvVarsDict :
3234 """
3335 If a file under test folder prefixed with `.env-secret` is present,
3436 then this fixture captures it.
@@ -46,9 +48,15 @@ def external_envfile_dict(request: pytest.FixtureRequest) -> EnvVarsDict:
4648 assert envfile .exists ()
4749 assert envfile .is_file ()
4850
49- if not any (term in envfile .name .lower () for term in ("ignore" , "secret" )):
51+ envfile = envfile .resolve ()
52+ osparc_simcore_root_dir = osparc_simcore_root_dir .resolve ()
53+
54+ if osparc_simcore_root_dir in envfile .parents and not any (
55+ term in envfile .name .lower () for term in ("ignore" , "secret" )
56+ ):
5057 _logger .warning (
51- "🚨 CAUTION: The provided envfile '%s' might be pushed in this repository. Please rename it with `secret` or `ignore`" ,
58+ "🚨 CAUTION: The file '%s' from '--external-envfile' may be versioned and exposed publicly. "
59+ "Add 'secret' or 'ignore' to the filename to exclude it automatically." ,
5260 envfile .name ,
5361 )
5462
You can’t perform that action at this time.
0 commit comments