Skip to content

Conversation

@nikhil2611
Copy link
Contributor

Summary

This PR implements a cross-platform solution to upgrade the resolv gem from version 0.2.1 to 0.2.3 during the omnibus build process by removing the default gemspec and installing the newer version.

Changes Made

  • Added platform-specific handling for Windows vs Linux/macOS in post-bundle-install.rb
  • Windows: Uses Gem.path.each to check all gem locations (handles omnibus-toolchain and chef-workstation embedded paths)
  • Linux/macOS: Uses regex extraction from gem info output to locate default gemspec
  • Removes resolv 0.2.1 default gemspec from all detected locations
  • Installs resolv 0.2.3 to embedded path using --install-dir flag
  • Added --no-document flag to optimize build time

Testing

  • Verified on Windows build - gemspec removed from omnibus-toolchain and resolv 0.2.3 installed to chef-workstation embedded path
  • Cross-platform logic supports Windows (mswin/mingw/windows), macOS (darwin), and Linux (Ubuntu, Amazon Linux, RHEL, etc.)
  • Build logs confirm successful operation across all platforms

Files Modified

  • components/gems/post-bundle-install.rb - Added default gem conflict handling for resolv with platform-specific gemspec removal logic

Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
- Remove resolv 0.2.1 default gemspec from all gem paths before installing 0.2.3
- Handles Windows multiple Ruby gem locations (user + embedded)
- Cross-platform compatible (Linux, macOS, Windows)
- Prevents gem conflict issues in final chef-workstation package

Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
- Use chef's simpler regex pattern to extract default gem path
- Remove platform-specific Windows/Linux branches
- Remove explicit --install-dir flag (relies on gem_home)
- Keep resolv 0.2.3 installation as specified
- Add CVE-2025-24294 documentation comment
- Proven to work on Windows per chef PR #15459

Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
…atform support

- Add platform-specific handling for Windows vs Linux/macOS
- Windows: Check all gem paths (omnibus-toolchain and embedded) for removal
- Linux/macOS: Extract default gem path from gem info output via regex
- Remove resolv 0.2.1 default gemspec from all locations
- Install resolv 0.2.3 to embedded path with --install-dir flag
- Add --no-document flag to optimize build time
- Fixes CVE-2025-24294 security vulnerability in resolv 0.2.1

Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
Copilot AI review requested due to automatic review settings December 10, 2025 07:15
@nikhil2611 nikhil2611 requested review from a team as code owners December 10, 2025 07:15
@netlify
Copy link

netlify bot commented Dec 10, 2025

👷 Deploy Preview for chef-workstation processing.

Name Link
🔨 Latest commit ca6c0ba
🔍 Latest deploy log https://app.netlify.com/projects/chef-workstation/deploys/693934015ef52b00083e6e42

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades the resolv gem from version 0.2.1 to 0.2.3 to address CVE-2025-24294 by implementing a cross-platform solution that removes the default gemspec and installs the newer version during the omnibus build process.

Key changes:

  • Refactored hardcoded resolv gem handling into a configurable hash structure for managing default gem conflicts
  • Implemented platform-specific gemspec removal logic (Windows uses Gem.path iteration, Linux/macOS uses regex extraction)
  • Added --install-dir and --no-document flags to optimize installation

Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
- Remove trailing whitespace
- Replace 'or' with '||' operator
- Use raise() method call instead of raise string

Signed-off-by: nikhil2611 <nikhilgupta2102@gmail.com>
Copilot AI review requested due to automatic review settings December 10, 2025 08:49
@sonarqubecloud
Copy link

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

@nikhil2611 nikhil2611 added the Expeditor: Skip All Used to skip all merge_actions. label Dec 10, 2025
@nikhil2611 nikhil2611 merged commit 7e68f45 into main Dec 10, 2025
34 of 35 checks passed
@nikhil2611 nikhil2611 deleted the nikhil/fixing-resolv-windows branch December 10, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Expeditor: Skip All Used to skip all merge_actions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants