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