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 865
865:   def self.assert_secure(path)
866:     mode = File.stat(path).mode
867:     unless ((mode % 01000) & 0022) == 0 then
868:       if $TESTING then
869:         raise SecurityError, "Directory #{path} is insecure"
870:       else
871:         abort "#{path} is insecure (#{'%o' % mode}). It may not be group or world writable. Exiting."
872:       end
873:     end
874:   rescue Errno::ENOENT
875:     # If it ain't there, it's certainly secure
876:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.