blackbox
blackbox copied to clipboard
Fix how `vcs_relative_path` first resolves an absolute path
Second attempt to fix #303.
The problem in #304 was that vcs_relative_path
needs its argument to exist when called, and blackbox_register_new_file
was calling shred_file
before vcs_ignore
.
I ran the tests after changing that order and applying the same change to vcs_relative_path
as before, but now my new test for blackbox_cat
started failing:
********************
********************
********* She enrolls secrets.txt.
********************
********************
========== PLAINFILE secret.txt
========== ENCRYPTED secret.txt.gpg
========== Importing keychain: START
gpg: key C6CB856A3A3DFB80: public key "Bob Example (my password is the lowercase letter b) <[email protected]>" imported
gpg: Total number processed: 2
gpg: imported: 1
gpg: unchanged: 1
========== Importing keychain: DONE
========== Encrypting: secret.txt
========== Encrypting: DONE
========== Adding file to list.
========== CREATED: secret.txt.gpg
========== UPDATING REPO:
NOTE: "already tracked!" messages are safe to ignore.
[master ab86c55] registered in blackbox: secret.txt
3 files changed, 2 insertions(+)
create mode 100644 secret.txt.gpg
========== UPDATING VCS: DONE
Local repo updated. Please push when ready.
git push
********************
********************
********* She cats secrets.txt.gpg.
********************
********************
========== PLAINFILE "secret.txt"
ERROR: secret.txt not found in /run/user/1000/tmp.TVLFg8a5XV/keyrings/live/blackbox-files.txt
PWD=/run/user/1000/tmp.TVLFg8a5XV
Exiting...
gpg-agent[5671]: homedir has been removed - shutting down
gpg-agent[5671]: gpg-agent (GnuPG) 2.2.12 stopped
gpg-agent[5674]: homedir has been removed - shutting down
gpg-agent[5674]: gpg-agent (GnuPG) 2.2.12 stopped
When I checked /run/user/1000/tmp.TVLFg8a5XV/keyrings/live/blackbox-files.txt
it definitely contained a line for secret.txt
, as proven by the additional assert_line_exists
I added to the previous phase in the WIP commit, plus my own validation:
❯ cat /run/user/1000/tmp.TVLFg8a5XV/keyrings/live/blackbox-files.txt
secret.txt
I see some Circle CI config in the repo, so is there a way to run the tests somewhere other than my machine as a sanity check?
The CircleCI stuff was set up by someone else and I never learned what it did.... which I regret since now it doesn't work and I don't know how to fix it. :-(
Does "make test" work for you on the current master branch? (just checking)
How about a different algorithm that doesn't require the file to exist?
Sadly this still fails for me. Are you testing on macos? Its a little different than linux.
********* She enrolls secrets.txt.
********************
********************
========== PLAINFILE secret.txt
========== ENCRYPTED secret.txt.gpg
========== Importing keychain: START
gpg: key 2831D06A94A006FD: public key "Bob Example (my password is the lowercase letter b) <[email protected]>" imported
gpg: Total number processed: 2
gpg: imported: 1
gpg: unchanged: 1
========== Importing keychain: DONE
========== Encrypting: secret.txt
========== Encrypting: DONE
========== Adding file to list.
========== CREATED: secret.txt.gpg
========== UPDATING REPO:
NOTE: "already tracked!" messages are safe to ignore.
[master 0468fb5] registered in blackbox: secret.txt
3 files changed, 2 insertions(+)
create mode 100644 secret.txt.gpg
========== UPDATING VCS: DONE
Local repo updated. Please push when ready.
git push
ASSERT FAILED: line '/secret.txt' should exist in file .gitignore
==== file contents: START .gitignore
/
/var/folders/qw/qp8v2j353wz7q57_jymyxj0h0000gn/T/SO.50tX48h4/secret.txt
==== file contents: END .gitignore
wsdwr
I'm sorry but I don't recognize this acronym.
This PR is listed as draft. @jamesottaway is it ready to be reviewed?
I don't remember what was keeping this from being reviewed, but I recall abandoning it after losing myself under an avalanche of Bash. The ability to run Blackbox from arbitrary subdirectories still makes sense, but I'm no longer in the role where I was using Blackbox. Would love to see someone carry this forward, if someone else is willing to take it on.