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

MGMT-16587: Migrate from dockertest to testcontainers to mitigate CVE-2024-21626 #6109

Merged
merged 1 commit into from Mar 26, 2024

Conversation

paul-maidment
Copy link
Contributor

This PR is to address CVE-2024-21626 which is ultimately caused by a vulnerable dependency on runc < 1.1.12 The dockertest library that is used for instantiation of a database container in some of our unit tests appears to use a vulnerable version of this library. The dockertest project has not had much activity in the last 12 months.

This PR migrates away from Dockertest by removing the library and all code that uses it, replacing this instead with an implementation to use TestContainers-Go. TestContainers is a much more supported and updated library with more maintainers and has up to date dependencies, including a non vulnerable version of runc.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 25, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 25, 2024

@paul-maidment: This pull request references MGMT-16587 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.16.0" version, but no target version was set.

In response to this:

This PR is to address CVE-2024-21626 which is ultimately caused by a vulnerable dependency on runc < 1.1.12 The dockertest library that is used for instantiation of a database container in some of our unit tests appears to use a vulnerable version of this library. The dockertest project has not had much activity in the last 12 months.

This PR migrates away from Dockertest by removing the library and all code that uses it, replacing this instead with an implementation to use TestContainers-Go. TestContainers is a much more supported and updated library with more maintainers and has up to date dependencies, including a non vulnerable version of runc.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. api-review Categorizes an issue or PR as actively needing an API review. labels Mar 25, 2024
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 25, 2024
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 36 lines in your changes are missing coverage. Please review.

Project coverage is 68.29%. Comparing base (53cac19) to head (c6246aa).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6109      +/-   ##
==========================================
- Coverage   68.32%   68.29%   -0.03%     
==========================================
  Files         241      242       +1     
  Lines       35779    35781       +2     
==========================================
- Hits        24445    24436       -9     
- Misses       9211     9218       +7     
- Partials     2123     2127       +4     
Files Coverage Δ
internal/common/common_unitest_db.go 20.34% <0.00%> (+2.19%) ⬆️
internal/common/testcontainers_db_context.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

…-2024-21626

This PR is to address CVE-2024-21626 which is ultimately caused by a vulnerable dependency on runc < 1.1.12
The dockertest library that is used for instantiation of a database container in some of our unit tests appears to use a vulnerable version of this library.
The dockertest project has not had much activity in the last 12 months.

This PR migrates away from Dockertest by removing the library and all code that uses it, replacing this instead with an implementation to use TestContainers-Go.
TestContainers is a much more supported and updated library with more maintainers and has up to date dependencies, including a non vulnerable version of runc.
@danmanor
Copy link
Contributor

/lgtm

@danmanor
Copy link
Contributor

@paul-maidment Nice !

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 26, 2024
Copy link

openshift-ci bot commented Mar 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danmanor, paul-maidment

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [danmanor,paul-maidment]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented Mar 26, 2024

@paul-maidment: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit cf7218d into openshift:master Mar 26, 2024
14 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-agent-installer-api-server-container-v4.16.0-202403261317.p0.gcf7218d.assembly.stream.el8 for distgit ose-agent-installer-api-server.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants