Skip to content

Commit ddde304

Browse files
nikhil2611Copilot
andauthored
CHEF-34831: Security scan packaging fixes and dependency updates (#342)
* CHEF-35087: Isolate security scan packaging and dependency fixes Signed-off-by: nikhil2611 <ngupta@progress.com> * Rename cleanup_lint_roller.rb to cleanup_gem_lockfiles.rb The script handles multiple gems (lint_roller, stackprof-webnav, chef-cli), so the filename should reflect its generic purpose. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: nikhil2611 <ngupta@progress.com> * removing chef-cli from list of lock file removal Signed-off-by: nikhil2611 <ngupta@progress.com> --------- Signed-off-by: nikhil2611 <ngupta@progress.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0bbe68a commit ddde304

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

chef-cli.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Gem::Specification.new do |gem|
4545
gem.add_dependency "minitar", "~> 1.0"
4646
gem.add_dependency "chef", ">= 18.0", "< 20.0"
4747
gem.add_dependency "solve", "> 2.0", "< 5.0"
48-
gem.add_dependency "addressable", ">= 2.3.5", "< 2.9"
48+
gem.add_dependency "addressable", ">= 2.9.0", "< 3.0"
4949
gem.add_dependency "cookbook-omnifetch", "~> 0.5"
5050
gem.add_dependency "diff-lcs", "~> 1.6" # Newer verions of chef-client require diff-lcs ~> 1.6
5151
gem.add_dependency "pastel", "~> 0.7" # used for policyfile differ

habitat/plan.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function Invoke-Build {
5757
gem install chef-cli-*.gem --no-document
5858

5959
Write-BuildLine " ** Cleaning up lint_roller Gemfile.lock"
60-
ruby ./cleanup_lint_roller.rb
60+
ruby ./cleanup_gem_lockfiles.rb
6161
ruby ./post-bundle-install.rb
6262

6363
If ($lastexitcode -ne 0) { Exit $lastexitcode }
@@ -110,4 +110,7 @@ function Invoke-After {
110110
# Remove the byproducts of compiling gems with extensions
111111
Get-ChildItem $pkg_prefix/vendor/gems -Include @("gem_make.out", "mkmf.log", "Makefile") -File -Recurse `
112112
| Remove-Item -Force
113+
# Remove .github directories from vendored gems to avoid CVE false positives
114+
Get-ChildItem $pkg_prefix/vendor/gems -Filter ".github" -Directory -Recurse `
115+
| Remove-Item -Recurse -Force
113116
}

habitat/plan.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ do_build() {
4545
bundle install
4646
gem build chef-cli.gemspec
4747
gem install rspec-core -v '~> 3.12.3'
48-
ruby ./cleanup_lint_roller.rb
48+
ruby ./cleanup_gem_lockfiles.rb
4949
ruby ./post-bundle-install.rb
5050
}
5151
do_install() {
@@ -93,6 +93,12 @@ EOF
9393
chmod -v 755 "$bin"
9494
}
9595

96+
do_after() {
97+
build_line "Removing .github directories from vendored gems..."
98+
find "$pkg_prefix/vendor/gems" -type d -name ".github" \
99+
| while read github_dir; do rm -rf "$github_dir"; done
100+
}
101+
96102

97103
do_strip() {
98104
return 0

0 commit comments

Comments
 (0)