Skip to content

Commit

Permalink
Add root specs security protection
Browse files Browse the repository at this point in the history
  • Loading branch information
j8r committed Sep 8, 2019
1 parent 4282d77 commit 728cec6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
require "spec"
require "../src/logger"

{% if !flag?(:allow_root) %}
if LibC.getgid == 0
abort <<-E
Running specs as root is not recommended, unless in a test VM/container.
They will interact with your system, with a risk to break it.
Use the `-D allow_root` flag to allow specs to run as root.
E
end
{% end %}

DPPM_CONFIG_FILE = File.expand_path __DIR__ + "/../config.con"
SAMPLES_DIR = __DIR__ + "/samples"
# Comment to debug
Expand Down

0 comments on commit 728cec6

Please sign in to comment.