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

Vulnerability Fix #197

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Vulnerability Fix #197

merged 2 commits into from
Feb 6, 2024

Conversation

Jdubrick
Copy link
Contributor

@Jdubrick Jdubrick commented Feb 5, 2024

Please specify the area for this PR
Vulnerability fixes

What does does this PR do / why we need it:
This PR aims to add a fix that ensures no malicious files can be added to an archive.tar file that is being read. Currently the filepath.Join and filepath.Clean functions are not properly accounting for paths added in a relative fashion (ie. "../../filename") and only properly cleans file paths that start with a leading slash. This fix adds that leading slash to all filepaths (relative or absolute) before the cleaning process, this ensures that no filepath can leave the confines of its parent by escaping out. The cleaning process removes any redundant double slashes that may arise because we are prepending the leading slash.

Which issue(s) this PR fixes:

No public issue

PR acceptance criteria:

  • Test Coverage
    • Are your changes sufficiently tested, and are any applicable test cases added or updated to cover your changes?

Documentation (WIP)

How to test changes / Special notes to the reviewer:

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2024
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (35722ec) 35.58% compared to head (10b01bc) 35.58%.
Report is 2 commits behind head on main.

❗ Current head 10b01bc differs from pull request most recent head c58fc85. Consider uploading reports for the commit c58fc85 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #197   +/-   ##
=======================================
  Coverage   35.58%   35.58%           
=======================================
  Files           7        7           
  Lines        1360     1360           
=======================================
  Hits          484      484           
  Misses        829      829           
  Partials       47       47           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@michael-valdron michael-valdron left a comment

Choose a reason for hiding this comment

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

With this fix, we should try removing the following line to enforce the safety of this with gosec: https://github.com/Jdubrick/registry-support/blob/10b01bc136bd082f59b1ac0c91797f4065792d7b/registry-library/library/util.go#L125

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Copy link
Member

@michael-valdron michael-valdron left a comment

Choose a reason for hiding this comment

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

/lgtm

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

openshift-ci bot commented Feb 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jdubrick, michael-valdron

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 [Jdubrick,michael-valdron]

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

@Jdubrick Jdubrick merged commit 0e44b9c into devfile:main Feb 6, 2024
8 checks passed
@cebarks
Copy link

cebarks commented Feb 21, 2024

This has been assigned CVE-2024-1485 by Red Hat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
3 participants