Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #381 from kf8a/reduce-permissions-on-sys-config
Browse files Browse the repository at this point in the history
set the permissions to 0o0600 on sys.config
  • Loading branch information
bitwalker committed Jul 27, 2016
2 parents 2c254f6 + fe17edd commit 1f7c2e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mix/tasks/release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ defmodule Mix.Tasks.Release do
File.mkdir_p!(dest |> Path.dirname)
# Write the config to disk
dest |> Utils.write_term(merged)
# tighten permissions on sys.config to owner read/write
dest |> File.chmod(0o0600)
# Continue..
config
end
Expand Down
5 changes: 5 additions & 0 deletions test/utils_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
defmodule UtilsTest do
use ExUnit.Case, async: true
use Bitwise, only_operators: true

import ExUnit.CaptureIO

import PathHelpers
Expand Down Expand Up @@ -94,6 +96,9 @@ defmodule UtilsTest do
assert :ok = res
some_val = Keyword.get(List.first(sysconfig_content), :test) |> Keyword.get(:some_val)
assert 101 = some_val
sys_config_rel_path = Path.join([File.cwd!, "rel", "test", "releases", "0.0.1", "sys.config"])
{:ok, info } = File.stat(sys_config_rel_path)
assert (info.mode &&& 0o0777) == 0o600
#end)
end
end
Expand Down

0 comments on commit 1f7c2e5

Please sign in to comment.