@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path to keystore not provided by user input") @Test public void testOnlySensitivePropertiesExtractedFromCredentialProvider() throws SecurityException { URL keystore = SiteConfigurationTest.class.getResource("/site-cfg.jceks"); assertNotNull(keystore); String credProvPath = "jceks: var overrides = Map.of(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), credProvPath); var config = new SiteConfiguration.Builder().noFile().withOverrides(overrides).build(); assertEquals("mysecret", config.get(Property.INSTANCE_SECRET)); assertNull(config.get("ignored.property")); assertEquals(Property.GENERAL_RPC_TIMEOUT.getDefaultValue(), config.get(Property.GENERAL_RPC_TIMEOUT.getKey())); }
@Override public String get(Property property) { String value = config.get(property.getKey()); if (value == null || !property.getType().isValidFormat(value)) { if (value != null) { log.error("Using default value for {} due to improperly formatted {}: {}", property.getKey(), property.getType(), value); } value = parent.get(property); } return value; }
SiteConfiguration extends AccumuloConfiguration { @Override public String get(Property property) { String value = config.get(property.getKey()); if (value == null || !property.getType().isValidFormat(value)) { if (value != null) { log.error("Using default value for {} due to improperly formatted {}: {}", property.getKey(), property.getType(), value); } value = parent.get(property); } return value; } }
SiteConfiguration extends AccumuloConfiguration { @Override public String get(Property property) { String value = config.get(property.getKey()); if (value == null || !property.getType().isValidFormat(value)) { if (value != null) { log.error("Using default value for {} due to improperly formatted {}: {}", property.getKey(), property.getType(), value); } value = parent.get(property); } return value; } private  SiteConfiguration(Map<String,String> config); }
SiteConfiguration extends AccumuloConfiguration { @Override public String get(Property property) { String value = config.get(property.getKey()); if (value == null || !property.getType().isValidFormat(value)) { if (value != null) { log.error("Using default value for {} due to improperly formatted {}: {}", property.getKey(), property.getType(), value); } value = parent.get(property); } return value; } private  SiteConfiguration(Map<String,String> config); static SiteConfiguration.OverridesOption fromEnv(); static SiteConfiguration.OverridesOption fromFile(File propertiesFileLocation); static SiteConfiguration auto(); @Override String get(Property property); @Override boolean isPropertySet(Property prop, boolean cacheAndWatch); @Override void getProperties(Map<String,String> props, Predicate<String> filter); void getProperties(Map<String,String> props, Predicate<String> filter,
      boolean useDefaults); }
SiteConfiguration extends AccumuloConfiguration { @Override public String get(Property property) { String value = config.get(property.getKey()); if (value == null || !property.getType().isValidFormat(value)) { if (value != null) { log.error("Using default value for {} due to improperly formatted {}: {}", property.getKey(), property.getType(), value); } value = parent.get(property); } return value; } private  SiteConfiguration(Map<String,String> config); static SiteConfiguration.OverridesOption fromEnv(); static SiteConfiguration.OverridesOption fromFile(File propertiesFileLocation); static SiteConfiguration auto(); @Override String get(Property property); @Override boolean isPropertySet(Property prop, boolean cacheAndWatch); @Override void getProperties(Map<String,String> props, Predicate<String> filter); void getProperties(Map<String,String> props, Predicate<String> filter,
      boolean useDefaults);  }