Potentially dangerous settings are being assigned to a file. Either the group or world levels are being given read or write access to a file. This might allow unintended users to access private information.
1require "fileutils"
2
3def open_file_permission_noncompliant(filename)
4
5 # Noncompliant: sets file world writable.
6 FileUtils.chmod 0222, filename
7end
1def open_file_permission_compliant(filename)
2
3 # Compliant: restricts group/world access.
4 FileUtils.chmod 0700, filename
5end