swayfx/sway/commands
Jerzi Kaminsky 2ad8850398 Handle symlinks as IPC security targets
- When policies are allocated, the ipc target path goes
  through symlink resolution. The result is used as
  the canonical for matching pids to policies at runtime.
  In particular, this matches up with the target of
  the `/proc/<pid>/exe`.
- There's a possible race condition if this isn't done
  correctly, read below.

Originally, validate_ipc_target() always tried to resolve
its argument for symlinks, and returned a parogram target string
if it validates. This created a possible race condition with
security implications. The problem is that get_feature_policy()
first independently resolved the policy target in order to check
whether a policy already exists. If it didn't find any, it called
alloc_feature_policy() which called validate_ipc_target() which
resolved the policy target again. In the time between the two
checks, the symlink could be altered, and a lucky attacker could
fool the program into thinking that a policy doesn't exist
for a target, and then switch the symlink to point at another file.
At the very least this could allow him to create two policies
for the same program target, and possibly to bypass security
by associating the permissions for one target with another,
or force default permissions to apply to a target for which
a more specific rule has been configured. So we don't that.

Instead, the policy target is resolved once and that result is
used for the rest of the lookup/creation process.
2017-04-16 17:09:53 +03:00
..
bar UnGNUify the codebase 2017-03-10 23:41:24 -05:00
input UnGNUify the codebase 2017-03-10 23:41:24 -05:00
assign.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
bar.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
bind.c Handle allocation failure in commands 2016-12-15 19:01:40 -05:00
border.c Improve criteria handling 2017-04-05 22:07:23 -06:00
client.c merge in latest commits 2016-09-02 14:11:48 -05:00
commands.c Read configs from /etc/sway/security.d/* 2017-02-20 07:51:31 -05:00
debuglog.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
default_border.c Merge branch 'master' of git://github.com/SirCmpwn/sway into new-command-aliases 2017-03-13 07:35:12 -04:00
default_floating_border.c Merge branch 'master' of git://github.com/SirCmpwn/sway into new-command-aliases 2017-03-13 07:35:12 -04:00
exec.c merge in latest commits 2016-09-02 14:11:48 -05:00
exec_always.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
exit.c merge in latest commits 2016-09-02 14:11:48 -05:00
floating.c Improve criteria handling 2017-04-05 22:07:23 -06:00
floating_maximum_size.c merge in latest commits 2016-09-02 14:11:48 -05:00
floating_minimum_size.c merge in latest commits 2016-09-02 14:11:48 -05:00
floating_mod.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
floating_scroll.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
focus.c Improve criteria handling 2017-04-05 22:07:23 -06:00
focus_follows_mouse.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
font.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
for_window.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
force_focus_wrapping.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
fullscreen.c Improve criteria handling 2017-04-05 22:07:23 -06:00
gaps.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
hide_edge_borders.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
include.c merge in latest commits 2016-09-02 14:11:48 -05:00
input.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
ipc.c Handle symlinks as IPC security targets 2017-04-16 17:09:53 +03:00
kill.c Improve criteria handling 2017-04-05 22:07:23 -06:00
layout.c Improve criteria handling 2017-04-05 22:07:23 -06:00
log_colors.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
mark.c Add -t get_marks and use more i3-like marks 2017-04-07 11:37:51 -06:00
mode.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
mouse_warping.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
move.c Improve criteria handling 2017-04-05 22:07:23 -06:00
new_float.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
new_window.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
orientation.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
output.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
permit.c Handle symlinks as IPC security targets 2017-04-16 17:09:53 +03:00
reload.c merge in latest commits 2016-09-02 14:11:48 -05:00
resize.c Improve criteria handling 2017-04-05 22:07:23 -06:00
scratchpad.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
seamless_mouse.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
set.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
show_marks.c Impliment i3-style marks 2017-04-03 11:48:37 -06:00
smart_gaps.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
split.c Improve criteria handling 2017-04-05 22:07:23 -06:00
sticky.c merge in latest commits 2016-09-02 14:11:48 -05:00
unmark.c Improve criteria handling 2017-04-05 22:07:23 -06:00
workspace.c remove unnecessary todo item 2017-03-18 17:26:59 -04:00
workspace_auto_back_and_forth.c UnGNUify the codebase 2017-03-10 23:41:24 -05:00
workspace_layout.c Fix off-by-one error when checking workspace_layout arguments 2017-03-18 22:24:44 +02:00