Skip to content

Commit

Permalink
Revert "move whitelist/blacklist to allow/deny"
Browse files Browse the repository at this point in the history
This reverts commit fe0f975.

Note: This only reverts the changes from etc.

The 4 aliases introduced on commit 45f2ba5 are mere, well, aliases.
That is, they fail to address the different usability problems discussed
on [netblue30#3447][3447] and in fact only make things more confusing (as has
already been mentioned on [this][4379] and later comments).  The main
reason is that the aliases do not meaningfully map to the original
commands.  For example, the commands from each pair below seem like they
would do the exact same thing:

* `allow` and `nodeny`
* `deny` and `noallow`

Additionally, if these aliases are not the final commands, but only a
test/work-in-progress, then keeping the wide-scale search/replace
changes made on commit fe0f975 would only serve to cause confusion, as
users of firejail-git, contributors and downstream projects might start
changing the commands used on their profiles, only to later have to
change them again, potentially to completely different commands.

The sooner this is undone the better, as (besides the above reasons) the
more profile changes there are between the original commit and the
revert, the harder it is to e.g.: `git diff` versions of files across
the following revision ranges: before the commit, after the commit but
before the revert and after the revert.  Note: This is still the case
even if a commit is [ignored by `git blame`][4390].

So let us revert fe0f975 and only reapply similar large-scale changes
once we have discussed and settled on better commands.

How the revert was applied: Despite using the auto-generated message
from `git revert`, to ensure correctness and to avoid conflicts the
changes were reverted in different steps: Firstly, revert the files
which can be safely reverted directly ("filestorevert"):

    # Find out which files have been changed on fe0f975, but have not
    # been changed afterwards and list them on "filestorevert"
    git show --pretty='' --name-only fe0f975 -- etc | LC_ALL=C sort >allfiles
    git diff --name-only fe0f975..master -- etc | LC_ALL=C sort >filestoignore
    comm -2 -3 allfiles filestoignore >filestorevert

    # Note: There are 3 extra files on filestoignore because they were
    # added after commit fe0f975
    wc -l allfiles filestoignore filestorevert | head -n 3
    #   797 allfiles
    #     8 filestoignore
    #   792 filestorevert

    # Automatically revert files in "filestorevert"
    # See https://stackoverflow.com/a/23401018/10095231
    tr '\n' '\000' <filestorevert | xargs -0 git show fe0f975 -- |
    git apply --reverse

    printf 'Total files reverted:\n'
    git diff --name-only | wc -l
    # 792

Secondly, do some search/replace on the rest:

    tr '\n' '\000' <filestoignore | xargs -0 sed -i.bak \
      -e 's/allow  /whitelist /' -e 's/noallow  /nowhitelist /' \
      -e 's/deny  /blacklist /' -e 's/nodeny  /noblacklist /' \
      -e 's/deny-nolog  /blacklist-nolog /'

    find etc -name '*.bak' -print0 | xargs -0 rm

Thirdly, verify the result.  The following command shows the difference
between all the changes in etc from before fe0f975 and this commit
(inclusive):

    git diff fe0f975~1 -- etc

From the output, it looks like all alias changes are fully reverted and
that the other changes to etc (from after fe0f975) remain, so the
revert seems to be done correctly.

[3447]: netblue30#3447
[4379]: netblue30#4379 (comment)
[4390]: netblue30#4390
  • Loading branch information
kmk3 committed Jul 18, 2021
1 parent 42a0351 commit f43382f
Show file tree
Hide file tree
Showing 798 changed files with 5,084 additions and 5,084 deletions.
6 changes: 3 additions & 3 deletions etc/inc/allow-bin-sh.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Persistent customizations should go in a .local file.
include allow-bin-sh.local

nodeny ${PATH}/bash
nodeny ${PATH}/dash
nodeny ${PATH}/sh
noblacklist ${PATH}/bash
noblacklist ${PATH}/dash
noblacklist ${PATH}/sh
36 changes: 18 additions & 18 deletions etc/inc/allow-common-devel.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
include allow-common-devel.local

# Git
nodeny ${HOME}/.config/git
nodeny ${HOME}/.gitconfig
nodeny ${HOME}/.git-credentials
noblacklist ${HOME}/.config/git
noblacklist ${HOME}/.gitconfig
noblacklist ${HOME}/.git-credentials

# Java
nodeny ${HOME}/.gradle
nodeny ${HOME}/.java
noblacklist ${HOME}/.gradle
noblacklist ${HOME}/.java

# Node.js
nodeny ${HOME}/.node-gyp
nodeny ${HOME}/.npm
nodeny ${HOME}/.npmrc
nodeny ${HOME}/.nvm
nodeny ${HOME}/.yarn
nodeny ${HOME}/.yarn-config
nodeny ${HOME}/.yarncache
nodeny ${HOME}/.yarnrc
noblacklist ${HOME}/.node-gyp
noblacklist ${HOME}/.npm
noblacklist ${HOME}/.npmrc
noblacklist ${HOME}/.nvm
noblacklist ${HOME}/.yarn
noblacklist ${HOME}/.yarn-config
noblacklist ${HOME}/.yarncache
noblacklist ${HOME}/.yarnrc

# Python
nodeny ${HOME}/.pylint.d
nodeny ${HOME}/.python-history
nodeny ${HOME}/.python_history
nodeny ${HOME}/.pythonhist
noblacklist ${HOME}/.pylint.d
noblacklist ${HOME}/.python-history
noblacklist ${HOME}/.python_history
noblacklist ${HOME}/.pythonhist

# Rust
nodeny ${HOME}/.cargo/*
noblacklist ${HOME}/.cargo/*
16 changes: 8 additions & 8 deletions etc/inc/allow-gjs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Persistent customizations should go in a .local file.
include allow-gjs.local

nodeny ${PATH}/gjs
nodeny ${PATH}/gjs-console
nodeny /usr/lib/gjs
nodeny /usr/lib/libgjs*
nodeny /usr/lib/libmozjs-*
nodeny /usr/lib64/gjs
nodeny /usr/lib64/libgjs*
nodeny /usr/lib64/libmozjs-*
noblacklist ${PATH}/gjs
noblacklist ${PATH}/gjs-console
noblacklist /usr/lib/gjs
noblacklist /usr/lib/libgjs*
noblacklist /usr/lib/libmozjs-*
noblacklist /usr/lib64/gjs
noblacklist /usr/lib64/libgjs*
noblacklist /usr/lib64/libmozjs-*
10 changes: 5 additions & 5 deletions etc/inc/allow-java.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Persistent customizations should go in a .local file.
include allow-java.local

nodeny ${HOME}/.java
nodeny ${PATH}/java
nodeny /etc/java
nodeny /usr/lib/java
nodeny /usr/share/java
noblacklist ${HOME}/.java
noblacklist ${PATH}/java
noblacklist /etc/java
noblacklist /usr/lib/java
noblacklist /usr/share/java
16 changes: 8 additions & 8 deletions etc/inc/allow-lua.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Persistent customizations should go in a .local file.
include allow-lua.local

nodeny ${PATH}/lua*
nodeny /usr/include
nodeny /usr/lib/liblua*
nodeny /usr/lib/lua
nodeny /usr/lib64/liblua*
nodeny /usr/lib64/lua
nodeny /usr/share/lua
nodeny /usr/share/lua*
noblacklist ${PATH}/lua*
noblacklist /usr/include
noblacklist /usr/lib/liblua*
noblacklist /usr/lib/lua
noblacklist /usr/lib64/liblua*
noblacklist /usr/lib64/lua
noblacklist /usr/share/lua
noblacklist /usr/share/lua*
4 changes: 2 additions & 2 deletions etc/inc/allow-nodejs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Persistent customizations should go in a .local file.
include allow-nodejs.local

nodeny ${PATH}/node
nodeny /usr/include/node
noblacklist ${PATH}/node
noblacklist /usr/include/node

# Allow python for node-gyp (blacklisted by disable-interpreters.inc)
include allow-python2.inc
Expand Down
4 changes: 2 additions & 2 deletions etc/inc/allow-opengl-game.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Persistent customizations should go in a .local file.
include allow-opengl-game.local

nodeny ${PATH}/bash
allow /usr/share/opengl-games-utils/opengl-game-functions.sh
noblacklist ${PATH}/bash
whitelist /usr/share/opengl-games-utils/opengl-game-functions.sh
private-bin basename,bash,cut,glxinfo,grep,head,sed,zenity
16 changes: 8 additions & 8 deletions etc/inc/allow-perl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Persistent customizations should go in a .local file.
include allow-perl.local

nodeny ${PATH}/core_perl
nodeny ${PATH}/cpan*
nodeny ${PATH}/perl
nodeny ${PATH}/site_perl
nodeny ${PATH}/vendor_perl
nodeny /usr/lib/perl*
nodeny /usr/lib64/perl*
nodeny /usr/share/perl*
noblacklist ${PATH}/core_perl
noblacklist ${PATH}/cpan*
noblacklist ${PATH}/perl
noblacklist ${PATH}/site_perl
noblacklist ${PATH}/vendor_perl
noblacklist /usr/lib/perl*
noblacklist /usr/lib64/perl*
noblacklist /usr/share/perl*
6 changes: 3 additions & 3 deletions etc/inc/allow-php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Persistent customizations should go in a .local file.
include allow-php.local

nodeny ${PATH}/php*
nodeny /usr/lib/php*
nodeny /usr/share/php*
noblacklist ${PATH}/php*
noblacklist /usr/lib/php*
noblacklist /usr/share/php*
10 changes: 5 additions & 5 deletions etc/inc/allow-python2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Persistent customizations should go in a .local file.
include allow-python2.local

nodeny ${PATH}/python2*
nodeny /usr/include/python2*
nodeny /usr/lib/python2*
nodeny /usr/local/lib/python2*
nodeny /usr/share/python2*
noblacklist ${PATH}/python2*
noblacklist /usr/include/python2*
noblacklist /usr/lib/python2*
noblacklist /usr/local/lib/python2*
noblacklist /usr/share/python2*
12 changes: 6 additions & 6 deletions etc/inc/allow-python3.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Persistent customizations should go in a .local file.
include allow-python3.local

nodeny ${PATH}/python3*
nodeny /usr/include/python3*
nodeny /usr/lib/python3*
nodeny /usr/lib64/python3*
nodeny /usr/local/lib/python3*
nodeny /usr/share/python3*
noblacklist ${PATH}/python3*
noblacklist /usr/include/python3*
noblacklist /usr/lib/python3*
noblacklist /usr/lib64/python3*
noblacklist /usr/local/lib/python3*
noblacklist /usr/share/python3*
4 changes: 2 additions & 2 deletions etc/inc/allow-ruby.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Persistent customizations should go in a .local file.
include allow-ruby.local

nodeny ${PATH}/ruby
nodeny /usr/lib/ruby
noblacklist ${PATH}/ruby
noblacklist /usr/lib/ruby
8 changes: 4 additions & 4 deletions etc/inc/allow-ssh.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Persistent customizations should go in a .local file.
include allow-ssh.local

nodeny ${HOME}/.ssh
nodeny /etc/ssh
nodeny /etc/ssh/ssh_config
nodeny /tmp/ssh-*
noblacklist ${HOME}/.ssh
noblacklist /etc/ssh
noblacklist /etc/ssh/ssh_config
noblacklist /tmp/ssh-*
Loading

0 comments on commit f43382f

Please sign in to comment.