Skip to content

Conversation

@rohit-kb
Copy link
Contributor

@rohit-kb rohit-kb commented Jan 9, 2023

What changes were proposed in this pull request?

Finding and replacing Constructor() class of snakeyaml with SafeConstructor() due to CVE-2022-1471

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-7760

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohit-kb
Copy link
Contributor Author

rohit-kb commented Jan 9, 2023

thanks @adoroszlai, just want to know a little about the role of SafeConstructor instance in Yaml object creations.

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rohit-kb for updating the patch.

options.setPrettyFlow(true);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.FLOW);
Yaml yaml = new Yaml(options);
Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()), new Representer(options), options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/DatanodeIdYaml.java
 62: Line is longer than 80 characters (found 102).

https://github.com/rohit-kb/ozone/actions/runs/3882072979/jobs/6621789972#step:6:427


try {
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this causes test failures:

 Tests run: 5, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.268 s <<< FAILURE! - in org.apache.hadoop.hdds.scm.net.TestYamlSchemaLoader

https://github.com/rohit-kb/ozone/actions/runs/3882072979/jobs/6621790406#step:6:584

Can you please check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review, looking into it

@adoroszlai adoroszlai changed the title HDDS-7760. snakeyaml workaround due to CVE-2022-1471 HDDS-7760. Let ContainerDataConstructor extend SafeConstructor Jan 11, 2023
@adoroszlai adoroszlai merged commit d56acae into apache:master Jan 11, 2023
@rohit-kb rohit-kb deleted the snakeyaml_upgrade branch January 12, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants