Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix how vcs_relative_path first resolves an absolute path #305

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jamesottaway
Copy link
Contributor

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?

@tlimoncelli
Copy link
Contributor

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?

@tlimoncelli
Copy link
Contributor

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

Copy link

@Alexocool Alexocool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wsdwr

@tlimoncelli
Copy link
Contributor

wsdwr

I'm sorry but I don't recognize this acronym.

This PR is listed as draft. @jamesottaway is it ready to be reviewed?

@jamesottaway
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to reference files in a sibling directory using ..
3 participants