Skip to content
Closed
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
9 changes: 5 additions & 4 deletions src/java/org/apache/cassandra/db/virtual/SettingsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,16 @@ else if (value instanceof Collection)
else if (value instanceof Map)
{
Map<String, Object> map = new HashMap<>();
for (Map.Entry<String, Object> entry : ((Map<String, Object>) value).entrySet())
for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet())
{
String key = String.valueOf(entry.getKey());
// this is done on best-effort basis as we do not have names in parameters
// inherently under control as this is what a user is responsible for
// when dealing with custom implementations
if (entry.getKey().endsWith("_password") || entry.getKey().equals("password"))
map.put(entry.getKey(), Redacted.REDACTED_STRING);
if (key.endsWith("_password") || key.equals("password"))
map.put(key, Redacted.REDACTED_STRING);
else
map.put(entry.getKey(), entry.getValue());
map.put(key, entry.getValue());
}

return tryConstructJson(map);
Expand Down
12 changes: 12 additions & 0 deletions test/unit/org/apache/cassandra/db/virtual/SettingsTableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.distributed.shared.WithProperties;
import org.apache.cassandra.security.SSLFactory;
import org.apache.cassandra.service.StartupChecks.StartupCheckType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.introspector.Property;
Expand Down Expand Up @@ -135,6 +136,17 @@ public void testSelectEmpty() throws Throwable
assertRowsNet(executeNet(q));
}

@Test
public void testStartupChecksWithEnumKeys() throws Throwable
{
Map<String, Object> checkDataResurrection = new LinkedHashMap<>();
checkDataResurrection.put("enabled", true);
config.startup_checks.put(StartupCheckType.check_data_resurrection, checkDataResurrection);

check("startup_checks", "{check_data_resurrection={enabled=true}}");
Assert.assertFalse(executeNet("SELECT * FROM vts.settings").all().isEmpty());
}

@Test
public void testSelectOverride() throws Throwable
{
Expand Down