capistrano-secure-permissions 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61162a6f257134a19631b9450fe6dcf53e415037
4
- data.tar.gz: a770f3a0595676e402882b03e68f91ccd8d5b0aa
3
+ metadata.gz: 4d04ac83ff009a67d9344c79aaa65ceb30df544f
4
+ data.tar.gz: 58e630cf73831fb1fdc3d29f44bb2dad886d2e37
5
5
  SHA512:
6
- metadata.gz: 9a3b387cc3dab20d0a3c79aa5ec0a2747df95e491c0129da4c96596e338998bb03221cf5493076f9f9230ced983e4ff1d0ceec04549573102b36a123a1beb627
7
- data.tar.gz: fa28095fba247d52b21d7a440acc8a3021c15f6cc24d5eeae5897c07a8eb4e13f4dd01d333718215147f92a8bb2adfa7fbf73ce6a50660bc4b105ed1cdf33c0d
6
+ metadata.gz: 59cda97ac2c3362347b96c159fef6a1fa213700a7a1838150f447610bf596a242b06b1a1eee7837b5e12336fa725af5a402edace6a973ffc816310064e40a739
7
+ data.tar.gz: ce07c047574a95f733cc14c22d7dfafacc4a6e0be08132f8d6cbcb1c15773e05e5e592423eedf68ea202763df926b15ceb156005856737b6b1159fe08e75c004
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: capistrano-secure-permissions 2.0.1 ruby lib
5
+ # stub: capistrano-secure-permissions 2.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "capistrano-secure-permissions"
9
- s.version = "2.0.1"
9
+ s.version = "2.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -34,19 +34,22 @@ namespace :secure_permissions do
34
34
  # Public is writable by app_user by default, so exclude that one.
35
35
  # To avoid going through the files twice.
36
36
  writable_dirs = fetch(:writable_dirs, fetch(:linked_dirs)).
37
- reject { |dir| dir.start_with?('public/') }.
38
- map { |dir| shared_path.join(dir) }
37
+ reject { |dir| dir.start_with?('public/') }
39
38
  # All of shared readable by app_user.
40
- readable_dirs = shared_path.children().map(&:basename) - writable_dirs
39
+ # Try to subtract the writable_dirs, to avoid going through them twice.
40
+ # But won't subtract public/system for instance... :(
41
+ readable_dirs = within(shared_path) { capture(:ls, '-A').lines.map(&:chomp) } - writable_dirs
41
42
 
42
43
  execute :setfacl, '-m', "u:#{web_user}:x,d:u:#{web_user}:x,u:#{app_user}:rx,d:u:#{app_user}:rx", shared_path
43
- execute :setfacl, '-R', '-m', "u:#{app_user}:rx,d:u:#{app_user}:rx", *readable_dirs
44
- # Set permissions for files in public, readable by web_user and writable by app_user.
45
- # Also make sure that deploy_user retains access, to the files that app_user creates.
46
- execute :setfacl, '-R', '-m', "u:#{web_user}:rx,u:#{app_user}:rwx,u:#{deploy_user}:rwx,d:u:#{deploy_user}:rwx,d:u:#{web_user}:rx,d:u:#{app_user}:rwx", shared_path.join('public')
47
- # Allow app_user access to writable_dirs in shared
48
- # Also make sure that deploy_user retains access, to the files that app_user creates.
49
- execute :setfacl, '-R', '-m', "u:#{app_user}:rwx,d:u:#{app_user}:rwx", *writable_dirs
44
+ within shared_path do
45
+ execute :setfacl, '-R', '-m', "u:#{app_user}:rx,d:u:#{app_user}:rx", *readable_dirs
46
+ # Set permissions for files in public, readable by web_user and writable by app_user.
47
+ # Also make sure that deploy_user retains access, to the files that app_user creates.
48
+ execute :setfacl, '-R', '-m', "u:#{web_user}:rx,u:#{app_user}:rwx,u:#{deploy_user}:rwx,d:u:#{deploy_user}:rwx,d:u:#{web_user}:rx,d:u:#{app_user}:rwx", 'public'
49
+ # Allow app_user access to writable_dirs in shared
50
+ # Also make sure that deploy_user retains access, to the files that app_user creates.
51
+ execute :setfacl, '-R', '-m', "u:#{app_user}:rwx,d:u:#{app_user}:rwx", *writable_dirs
52
+ end
50
53
  end
51
54
  end
52
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-secure-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rune Schjellerup Philosof