git_acl_shell 1.0.3 → 1.0.4
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 +4 -4
- data/lib/git_acl_shell/shell.rb +6 -3
- data/lib/git_acl_shell/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f377dfc78d6d578f7c0bdaa110094aa77cd9d7f
|
4
|
+
data.tar.gz: 046e5c856cfbd616e5e95f3ecb0dfe58a6ca44cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6ee25445985f157d918aac8472755367487945fb132ad52d753392d3132cb0b283101292dd9021e778e780432123395798a32dcd26d23be8dd7a2cd549c8df1
|
7
|
+
data.tar.gz: 730d3c56d604e04116f89d01881758970c1d0916f431c8b3e30ebcf18b1ddb190c2d6b28e959014746349b4ead8b0a79cfdb529c7291eaa805fdbe4954d49064
|
data/lib/git_acl_shell/shell.rb
CHANGED
@@ -6,6 +6,9 @@ module GitAclShell
|
|
6
6
|
# See https://git-scm.com/docs/git-shell#_commands
|
7
7
|
# (git push) (git fetch) (git archive)
|
8
8
|
COMMAND_WHITELIST = %w(git-receive-pack git-upload-pack git-upload-archive).freeze
|
9
|
+
NO_SHELL_ACCESS_MESSAGE = ENV['git_acl_shell_no_shell_access_message'] || "You've succesfully authenticated, but shell access is not available."
|
10
|
+
ACCESS_DENIED_MESSAGE = ENV['git_acl_shell_access_denied_message'] || "You've successfully authenticated, but you don't have access to this repo."
|
11
|
+
COMMAND_DENIED_MESSAGE = ENV['git_acl_shell_command_denied_message'] || "You've successfully authenticated, but the only allowed commands are #{COMMAND_WHITELIST.join(', ')}."
|
9
12
|
|
10
13
|
def initialize(key_id, acl:, directory:, kernel: Kernel, stderr: $stderr)
|
11
14
|
@key_id = key_id
|
@@ -17,7 +20,7 @@ module GitAclShell
|
|
17
20
|
|
18
21
|
def exec(command)
|
19
22
|
if command.nil?
|
20
|
-
@stderr.puts(
|
23
|
+
@stderr.puts(NO_SHELL_ACCESS_MESSAGE)
|
21
24
|
return false
|
22
25
|
end
|
23
26
|
|
@@ -40,11 +43,11 @@ module GitAclShell
|
|
40
43
|
@kernel.exec(*args)
|
41
44
|
true
|
42
45
|
else
|
43
|
-
@stderr.puts(
|
46
|
+
@stderr.puts(ACCESS_DENIED_MESSAGE)
|
44
47
|
false
|
45
48
|
end
|
46
49
|
else
|
47
|
-
@stderr.puts(
|
50
|
+
@stderr.puts(COMMAND_DENIED_MESSAGE)
|
48
51
|
false
|
49
52
|
end
|
50
53
|
end
|