Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update snakeyaml dependency to resolve CVEs #480

Merged
merged 6 commits into from
Sep 25, 2022
Merged

Update snakeyaml dependency to resolve CVEs #480

merged 6 commits into from
Sep 25, 2022

Conversation

mamccorm
Copy link

@mamccorm mamccorm commented Sep 22, 2022

Fixes: #479

There are a number of vulnerabilities in snakeyaml, which we inherit from our dependency on snakeyaml, namely:

Most of these have been resolved in snakeyaml v1.32 or 1.31.

The changes in this PR are to upgrade to the latest snakeyaml library to avail of the fix.

Local testing:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for plugin-management-parent-pom 2.12.10-SNAPSHOT:
[INFO]
[INFO] plugin-management-parent-pom ....................... SUCCESS [  5.837 s]
[INFO] plugin-management-library .......................... SUCCESS [01:38 min]
[INFO] plugin-management-cli .............................. SUCCESS [ 11.598 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:56 min
[INFO] Finished at: 2022-09-22T13:10:49+01:00
[INFO] ------------------------------------------------------------------------
  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@MarkEWaite
Copy link
Contributor

MarkEWaite commented Sep 22, 2022

I don't think this change will resolve the issue that you're trying to resolve.

I think that you want the plugin installation manager tool to include snakeyaml 1.31 or even better, snakeyaml 1.32. The changes you've made will adjust the tests, but won't change the version of snakeyaml that is packaged as a transitive dependency of the Jackson dataformat library.

The maven dependency tree shows:

[INFO] -------< io.jenkins.plugin-management:plugin-management-library >-------
[INFO] Building plugin-management-library 2.12.10-SNAPSHOT                [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.3.0:tree (default-cli) @ plugin-management-library ---
[INFO] io.jenkins.plugin-management:plugin-management-library:jar:2.12.10-SNAPSHOT
[INFO] +- org.jenkins-ci:version-number:jar:1.10:compile
[INFO] +- commons-io:commons-io:jar:2.11.0:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile
...
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.13.4:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] |  +- org.yaml:snakeyaml:jar:1.31:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile

I think that means that a new dependency on snakeyaml will need to be added to the plugin-management-library/pom.xml file.

@timja timja added the chore Project maintenance label Sep 22, 2022
@mamccorm
Copy link
Author

Thanks @MarkEWaite. Still finding my way at contributions so my apologies. Added the v1.32 dependency to the bom.xml

@timja
Copy link
Member

timja commented Sep 22, 2022

This should be in a dependencyManagement block in the https://github.com/jenkinsci/plugin-installation-manager-tool/blob/master/plugin-management-library/pom.xml file

With a TODO comment to remove it when jackson-dataformat-yaml is updated and includes a newer version.
and the TODO should also go next to

@MarkEWaite
Copy link
Contributor

I confirmed that the snakeyaml version bundled in plugin installation manager tool when built with this pull request is 1.32 as expected.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

I would prefer that the two changes to test data be reverted because they are not needed for the objective of this pull request and they check that we retain compatibility with older releases.

However, I'm also OK if the decision is to update the test data.

@@ -298,7 +298,7 @@ public void verifyDownloads_smoke() throws Exception {

// Second cycle, with plugin update and new plugin installation
Plugin trileadAPI = new Plugin("trilead-api", "1.0.13", null, null);
Plugin snakeYamlAPI = new Plugin("snakeyaml-api", "1.27.0", null, null);
Plugin snakeYamlAPI = new Plugin("snakeyaml-api", "1.31-84.ve43da_fb_49d0b", null, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this setting can be retained to continue testing that behavior remains compatible even for older releases.

Suggested change
Plugin snakeYamlAPI = new Plugin("snakeyaml-api", "1.31-84.ve43da_fb_49d0b", null, null);
Plugin snakeYamlAPI = new Plugin("snakeyaml-api", "1.27.0", null, null);

Copy link
Member

Choose a reason for hiding this comment

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

I think fine to update some firewalls may get angry at vulnerable deps getting downloaded although could also be left

@@ -46,7 +46,7 @@ role-strategy:2.16
run-condition:1.3
scm-api:2.6.3
security-inspector:0.5
snakeyaml-api:1.26.4
snakeyaml-api:1.31-84.ve43da_fb_49d0b
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this data value can be retained to continue testing that behavior remains compatible even for older releases.

Suggested change
snakeyaml-api:1.31-84.ve43da_fb_49d0b
snakeyaml-api:1.26.4

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

I'm approving this because my comments are non-blocking. I plan to merge it within 24 hours unless someone raises an objection.

Thanks for the pull request!

@timja
Copy link
Member

timja commented Sep 23, 2022

@MarkEWaite I would like #480 (comment) addressed

@timja
Copy link
Member

timja commented Sep 23, 2022

i.e. I don't think it should be in the root pom it should be in the library

@MarkEWaite
Copy link
Contributor

i.e. I don't think it should be in the root pom it should be in the library

Sorry that I missed that the dependency management entry was in the wrong directory. Agreed. Thanks for catching that!

Declare the dependency as narrowly as possible
@MarkEWaite
Copy link
Contributor

I pushed ec27c39 too soon. That change is not correct. It still bundles snakeyaml 1.31 in the jar file. Will need more investigation.

The Jackson dataformat library depends on snakeyaml 1.31.  The snakeyaml
1.31 library has a vulnerability that is resolved in snakeyaml 1.32.
Include snakeyaml 1.32 as an explicit dependency until Jackson dataformat
is updated to use a newer snakeyaml library.
@MarkEWaite
Copy link
Contributor

Pushed 6239603 after verifying that the snakeyaml version included in the library is now 1.32. I'm open to suggestions of better ways to do it...

@timja
Copy link
Member

timja commented Sep 23, 2022

sure it'll do for now

@MarkEWaite MarkEWaite changed the title Update snakeyaml-api-plugin dependency to resolve CVEs Update snakeyaml dependency to resolve CVEs Sep 25, 2022
@MarkEWaite MarkEWaite added bug Something isn't working and removed chore Project maintenance labels Sep 25, 2022
@MarkEWaite
Copy link
Contributor

@timja I've labeled this as a "bug" rather than "chore". I think we're ready to merge and release with this change. Any objections if I merge it?

@timja
Copy link
Member

timja commented Sep 25, 2022

@timja I've labeled this as a "bug" rather than "chore". I think we're ready to merge and release with this change. Any objections if I merge it?

no objections

@MarkEWaite MarkEWaite merged commit 5563515 into jenkinsci:master Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade snakeyaml dependency to address various CVEs
3 participants