From d2ba8e415e08188e9edee3667de51f74af30e66c Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 13 Dec 2024 14:05:34 +0100 Subject: [PATCH] test(common-utils): Test `EnvironmentVariableFilter` with empty deny list Signed-off-by: Sebastian Schuberth --- .../test/kotlin/EnvironmentVariableFilterTest.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utils/common/src/test/kotlin/EnvironmentVariableFilterTest.kt b/utils/common/src/test/kotlin/EnvironmentVariableFilterTest.kt index 4d0a3e0dc566b..19b91a6207e97 100644 --- a/utils/common/src/test/kotlin/EnvironmentVariableFilterTest.kt +++ b/utils/common/src/test/kotlin/EnvironmentVariableFilterTest.kt @@ -80,4 +80,18 @@ class EnvironmentVariableFilterTest : StringSpec({ environment should containExactly(filteredEnvironment) } + + "An empty deny list should not deny anything" { + EnvironmentVariableFilter.reset(denySubstrings = emptyList()) + + EnvironmentVariableFilter.DEFAULT_DENY_SUBSTRINGS.forAll { + EnvironmentVariableFilter.isAllowed(it) shouldBe true + } + + EnvironmentVariableFilter.DEFAULT_ALLOW_NAMES.forAll { + EnvironmentVariableFilter.isAllowed(it) shouldBe true + } + + EnvironmentVariableFilter.isAllowed("PATH") shouldBe true + } })