Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Runner/Process.hpp
diff options
context:
space:
mode:
authorLeitwolf2026-11-06 09:34:16 +0300
committerGitHub2026-11-06 09:34:16 +0300
commitf7b935972ae17dfab13195a51f3d1f3b89d77c48 (patch)
tree99c4d53afb06eb1f2479392bdf56d9bc95621166 /src/Progmasoft/Runner/Process.hpp
parent268698be92962247a21a86dda4de2d4267adcf8f (diff)
parentad3633ea59ec491c9694a10307beb7d7189db744 (diff)
downloadcatch3-f7b935972ae17dfab13195a51f3d1f3b89d77c48.tar.gz
Merge pull request #37 from Progmasoft/fix/child-environment
Withhold secret-looking variables from the processes the runner starts
Diffstat (limited to 'src/Progmasoft/Runner/Process.hpp')
-rw-r--r--src/Progmasoft/Runner/Process.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Progmasoft/Runner/Process.hpp b/src/Progmasoft/Runner/Process.hpp
index 733bdbf7..3e0a1dd2 100644
--- a/src/Progmasoft/Runner/Process.hpp
+++ b/src/Progmasoft/Runner/Process.hpp
@@ -121,6 +121,9 @@ namespace Progmasoft::Catch3::Runner
std::vector<std::string> arguments;
/// Variables added to, or replacing, those of this process.
std::vector<std::pair<std::string, std::string>> environment;
+ /// Variables of this process the child keeps although their names
+ /// look like secrets; see `IsSecretVariable`.
+ std::vector<std::string> keptEnvironment;
/// The working directory; empty keeps the current one.
std::filesystem::path workingDirectory;
bool searchPath = false;
@@ -230,6 +233,12 @@ namespace Progmasoft::Catch3::Runner
[[nodiscard]] unsigned
HardwareThreads() noexcept;
+ /// Whether a variable of this name holds a secret that a child does not
+ /// inherit: its name contains, in any case, TOKEN, SECRET, PASSWORD,
+ /// PASSWD, CREDENTIAL, API_KEY, APIKEY, PRIVATE_KEY or ACCESS_KEY.
+ [[nodiscard]] bool
+ IsSecretVariable(std::string_view name);
+
/// The value of an environment variable; empty when it is not set.
[[nodiscard]] std::string
ReadEnvironment(const char *name);