Skip to content

Commit

Permalink
Restrict write permissions to installing user
Browse files Browse the repository at this point in the history
For several reasons we use C:/RubyXXX direcory by default but not C:/Program Files.
See: oneclick/rubyinstaller#135

Using an install path under C:/ inherits write permissions for everyone, which is compromizes security in a multi user environment.
As a countermeasure this commit restricts write permissions to the installing user.
  • Loading branch information
larskanis committed Nov 26, 2022
1 parent bb8cc1a commit a583bc7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recipes/installer-inno/rubyinstaller.iss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ Root: <%= regroot %>; Subkey: Software\Classes\<%= rubyname %>File\shell\open\co
<% end %>
<% end %>

; The default permissions on C:/RubyXXX is inherited from C:/ and allows write access to any user.
; This allows everyone to install gems, which is convenient but compromizes security.
; To mitigate we enable full access for the creator and read-only for other users.
; InnoSetup allows to add permissions only, but not to remove them.
; So use Innosetup to add described permissions and icacls to disable unwanted inheritance.
[Dirs]
Name: {app}; Permissions: creatorowner-full users-readexec
[Run]
Filename: "icacls.exe"; Parameters: "{app} /inheritancelevel:r "; WorkingDir: "{app}"; Description: "Changing Directory Permissions"; StatusMsg: "Changing Directory Permissions"; Flags: runhidden

[Icons]
Name: {autoprograms}\{#InstallerName}\{cm:InteractiveRubyTitle}; Filename: {app}\bin\irb.<%= package.rubyver2 < '3.1' ? "cmd" : "bat" %>; IconFilename: {app}\bin\ruby.exe
Name: {autoprograms}\{#InstallerName}\{cm:DocumentationTitle}\{cm:APIReferenceTitle,{#RubyVersion}}; Filename: {app}\share\doc\ruby\html\index.html; IconFilename: {app}\share\doc\ruby\html\images\ruby-doc.ico; Components: rdoc
Expand Down

0 comments on commit a583bc7

Please sign in to comment.