Skip to content

Commit a05c3b4

Browse files
committed
Remove world writable from files in OOD packaged gems (#4717)
* Remove world writable files from OOD packaged gems Fixes #4712 * Also remove global write for deb packages * Add debugging * Exclude links from the check * Move debugging output into actual check
1 parent 35dbcd8 commit a05c3b4

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

packaging/deb/rules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ override_dh_auto_install:
4848
# install gems
4949
mkdir -p $(DESTDIR)/opt/ood/gems
5050
mv $(GEM_HOME)/* $(DESTDIR)/opt/ood/gems
51+
chmod -R o-w $(DESTDIR)/opt/ood/gems
5152

5253
# make some directories
5354
mkdir -p "$(APACHE_DIR)/public/maintenance"

packaging/rpm/ondemand.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ touch %{_localstatedir}/www/ood/apps/sys/myjobs/tmp/restart.txt
338338
%{_tmpfilesdir}/ondemand-nginx.conf
339339

340340
%files -n %{gems_name}
341+
%defattr(644, root, root, 755)
341342
%{gem_home}/*
342343

343344
%files -n ondemand-gems

spec/e2e/00_package_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,8 @@
107107
it { is_expected.to be_owned_by('root') }
108108
it { is_expected.to be_grouped_into('root') }
109109
end
110+
111+
describe command("find #{ood_gems_path} -perm /002 ! -type l -exec ls -la {} \\;") do
112+
its(:stdout) { is_expected.to be_empty }
113+
end
110114
end

spec/e2e/e2e_helper.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ def apache_log_dir
105105
"/var/log/#{apache_service.split('-').first}"
106106
end
107107

108+
def ood_gems_path
109+
case host_inventory['platform']
110+
when 'redhat'
111+
return '/opt/ood/ondemand/root/usr/share/gems'
112+
when 'ubuntu', 'debian'
113+
return '/opt/ood/gems'
114+
end
115+
end
116+
108117
def install_packages(packages)
109118
on hosts, "#{packager} install -y #{packages.join(' ')}"
110119
end

0 commit comments

Comments
 (0)