Class: RemLint::Rules::WorldWritableScript

Inherits:
RemLint::Rule show all
Defined in:
lib/remlint/rules/world_writable_script.rb

Overview

A reminder file anyone can write to.

Remind refuses a world-writable script outright, and disables RUN for one it does not own -- because a reminder file is a program, and a program anybody can edit will eventually run something somebody else wrote. The check is in src/files.c (CheckSafety).

This is the only rule that looks at a file rather than at its contents, and the only one that can fail on a file that is textually perfect. It earns its place because the failure mode is a cron job that stops working, or worse does not, and the mode is invisible in every editor.

Group-writable is reported separately and more quietly: Remind allows it, but it means the file's safety rests on the group's membership.

Constant Summary collapse

WORLD_WRITABLE =
0o002
GROUP_WRITABLE =
0o020

Constants inherited from RemLint::Rule

RemLint::Rule::REGISTRY

Instance Attribute Summary

Attributes inherited from RemLint::Rule

#config, #document, #offenses

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RemLint::Rule

all, enabled_by_default?, find, inherited, #initialize, rule_name, #rule_name, #run

Constructor Details

This class inherits a constructor from RemLint::Rule

Class Method Details

.default_severityObject



25
26
27
# File 'lib/remlint/rules/world_writable_script.rb', line 25

def self.default_severity
  "error"
end

.descriptionObject



29
30
31
# File 'lib/remlint/rules/world_writable_script.rb', line 29

def self.description
  "A reminder file that is world-writable, which Remind refuses to read."
end

Instance Method Details

#checkObject



33
34
35
36
37
38
39
# File 'lib/remlint/rules/world_writable_script.rb', line 33

def check
  mode = mode_of(document.path)

  if mode
    report(mode)
  end
end