In Files

Parent

Methods

Class Index [+]

Quicksearch

Dir

Public Class Methods

assert_secure(path) click to toggle source

assert_secure checks that if a path exists it has minimally writable permissions. If not, it prints an error and exits. It only works on POSIX systems. Patches for other systems are welcome.

     # File lib/inline.rb, line 868
868:   def self.assert_secure(path)
869:     mode = File.stat(path).mode
870:     unless ((mode % 01000) & 0022) == 0 then
871:       if $TESTING then
872:         raise SecurityError, "Directory #{path} is insecure"
873:       else
874:         abort "#{path} is insecure (#{'%o' % mode}). It may not be group or world writable. Exiting."
875:       end
876:     end
877:   rescue Errno::ENOENT
878:     # If it ain't there, it's certainly secure
879:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.