Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public Object get(final Properties properties) {
*/
public Boolean getBoolean(final Properties properties) {
final String valueFromProperties = String.valueOf(get(properties));
return valueFromProperties.equals("1") || valueFromProperties.equals("true");
return valueFromProperties.equals("1") || valueFromProperties.equalsIgnoreCase("true");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

public final class ArrowFlightConnectionConfigImplTest {

Expand Down Expand Up @@ -71,6 +72,22 @@ public void testGetProperty(
arrowFlightConnectionConfigFunction.apply(arrowFlightConnectionConfig), is(expected));
}

@ParameterizedTest
@ValueSource(strings = {"true", "TRUE", "True", "tRuE", "1"})
public void testUseEncryptionAcceptsTruthyValuesCaseInsensitively(String value) {
// A connection string value like "TRUE" must enable TLS. Parsing it as false would
// silently downgrade the connection to plaintext and leak credentials.
properties.put(USE_ENCRYPTION.camelName(), value);
assertThat(arrowFlightConnectionConfig.useEncryption(), is(true));
}

@ParameterizedTest
@ValueSource(strings = {"false", "FALSE", "0", ""})
public void testUseEncryptionRejectsFalsyValues(String value) {
properties.put(USE_ENCRYPTION.camelName(), value);
assertThat(arrowFlightConnectionConfig.useEncryption(), is(false));
}

public static Stream<Arguments> provideParameters() {
int port = RANDOM.nextInt(Short.toUnsignedInt(Short.MAX_VALUE));
boolean useEncryption = RANDOM.nextBoolean();
Expand Down
Loading