Skip to content

Commit

Permalink
[WFCORE-6503]: Adding configuration for YAML file size.
Browse files Browse the repository at this point in the history
Signed-off-by: Emmanuel Hugonnet <[email protected]>
  • Loading branch information
ehsavoie committed Mar 21, 2024
1 parent ed19e2f commit fac75cb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
public class YamlConfigurationExtension implements ConfigurationExtension {

private static final String CONFIGURATION_ROOT_KEY = "wildfly-configuration";
private static final String YAML_CODEPOINT_LIMIT = "org.wildfly.configuration.extension.yaml.codepoint.limit";

private static final String YAML_CONFIG = "--yaml";
private static final String SHORT_YAML_CONFIG = "-y";
Expand Down Expand Up @@ -104,7 +105,12 @@ private void load() {
for (Path file : files) {
if (file != null && Files.exists(file) && Files.isRegularFile(file)) {
Map<String, Object> yamlConfig = Collections.emptyMap();
Yaml yaml = new Yaml(new OperationConstructor(new LoaderOptions()));
LoaderOptions loadingConfig = new LoaderOptions();
//Default to 3MB
loadingConfig.setCodePointLimit(
Integer.parseInt(
WildFlySecurityManager.getPropertyPrivileged(YAML_CODEPOINT_LIMIT, "3145728")));
Yaml yaml = new Yaml(new OperationConstructor(loadingConfig));
try (InputStream inputStream = Files.newInputStream(file)) {
yamlConfig = yaml.load(inputStream);
} catch (IOException ioex) {
Expand Down

0 comments on commit fac75cb

Please sign in to comment.