Bug: blackbox_deregister_file deletes blackbox-files.txt
* Clarified symantics of blackbox_deregister_file in comments. * Added confidence test
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
#
|
||||
# blackbox_deregister_file -- Remove a file from the blackbox system.
|
||||
#
|
||||
# Takes an encrypted file and removes it from the blackbox system. The
|
||||
# encrypted file will also be removed from the filesystem.
|
||||
# Takes an encrypted file and removes it from the blackbox system.
|
||||
# The encrypted file will also be removed from the filesystem.
|
||||
# The unencrypted file, if it exists, will be left alone.
|
||||
|
||||
set -e
|
||||
source "${0%/*}/_blackbox_common.sh"
|
||||
@@ -25,10 +26,10 @@ fail_if_not_exists "$encrypted_file" "Please specify an existing file."
|
||||
|
||||
prepare_keychain
|
||||
remove_filename_from_cryptlist "$unencrypted_file"
|
||||
vcs_notice "$unencrypted_file"
|
||||
vcs_remove "$BB_FILES"
|
||||
vcs_remove "$encrypted_file"
|
||||
vcs_add "$BB_FILES"
|
||||
|
||||
vcs_commit "Removing from blackbox: ${unencrypted_file}"
|
||||
vcs_commit "Removing from blackbox: ${unencrypted_file}" "$BB_FILES" "$encrypted_file"
|
||||
echo "========== UPDATING VCS: DONE"
|
||||
echo "Local repo updated. Please push when ready."
|
||||
echo " $(which_vcs) push"
|
||||
|
||||
@@ -307,7 +307,7 @@ assert_file_group secret.txt "$TEST_GID_NAME"
|
||||
PHASE 'Bob cleans up the secret.'
|
||||
rm secret.txt
|
||||
|
||||
PHASE 'Bob removes alice.'
|
||||
PHASE 'Bob removes Alice.'
|
||||
blackbox_removeadmin alice@example.com
|
||||
assert_line_not_exists 'alice@example.com' keyrings/live/blackbox-admins.txt
|
||||
|
||||
@@ -439,7 +439,17 @@ assert_file_exists 'secret.txt.gpg'
|
||||
assert_file_exists 'space space.txt.gpg'
|
||||
assert_file_exists 'stars*bars?.txt.gpg'
|
||||
|
||||
PHASE 'Bob DEregisters mistake.txt'
|
||||
touch 'mistake.txt'
|
||||
blackbox_deregister_file 'mistake.txt.gpg'
|
||||
assert_file_exists 'keyrings/live/blackbox-admins.txt'
|
||||
assert_file_exists 'keyrings/live/blackbox-files.txt'
|
||||
assert_line_not_exists 'mistake.txt' 'keyrings/live/blackbox-files.txt'
|
||||
assert_file_missing 'mistake.txt.gpg'
|
||||
assert_file_exists 'mistake.txt'
|
||||
|
||||
PHASE 'Alice returns. She should be locked out'
|
||||
assert_file_missing 'secret.txt'
|
||||
become_alice
|
||||
PHASE 'Alice tries to decrypt secret.txt. Is blocked.'
|
||||
if blackbox_edit_start secret.txt ; then
|
||||
@@ -455,11 +465,15 @@ fi
|
||||
# ASSERTIONS
|
||||
#
|
||||
|
||||
echo '========== Verifying .gnupg was not accidentally created.'
|
||||
|
||||
if [[ -e $HOME/.gnupg ]]; then
|
||||
echo "ASSERT FAILED: $HOME/.gnupg should not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo '========== DONE with tests. Outputing some diagnostics:'
|
||||
|
||||
find .git?* * -type f -ls
|
||||
echo cd "$test_repository"
|
||||
echo rm -rf "$test_repository"
|
||||
|
||||
Reference in New Issue
Block a user