-
|
Hello, The title says it all. Let's go through an example to highlight specifically the situation I'm referring to: cd repo # repo was previously `jj init`'d
echo "THIS IS A SECRET, I DON'T WANT IT IN REFLOGS" > key.pem
# `git add -A` now would leak `key.pem` to reflogs. I suppose `jj` would leak it to its ops log?
echo "key.pem" >> .gitignore # Whoops, don't want to accidentally leak my key to reflog
# From now on, `git add -A` is safe, but am I already doomed because of `jj`?
jj new # Or maybe I'm wrong in my assumption, and `jj` shakes off the ops regarding `key.pem`?Suppose I did as such, would
I've just started using Adding some keywords for future searches, as I was only able to find #323 regarding this question, and the thread is so long that I couldn't really find my answer in there: leak, expose, key, secret. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
|
You can select all revsets that contain a particular file with the $ jj log -r files(key.pem)You can also use string patterns like To find secrets inside a tracked file, you can use |
Beta Was this translation helpful? Give feedback.
-
|
@jennings answer is good for checking that the secret file is not in one of the visible commits. For normal levels of paranoia, if the important thing is not to push the secret to a remote, that should be sufficient. You can just edit commits until all traces of the secret are gone. For heightened levels of paranoia, you should be aware that even if commands like But then, if the secret is merely in the Still, if you do in fact want to get rid of all copies of the file on disk, |
Beta Was this translation helpful? Give feedback.
The attack vector that worried me was not "My disk is compromised, can someone find it in local logs" (which I agree is very very paranoid).
Instead, it was "Does
jjimplicitly doesgit addwhenever I change a file? Because if so, couldn't anyone with access to the repo (even remote versions) usegit fsckandgit rev-listto recover versions of files that were never in any commits".I've run a little experiment. And here are the conclusions:
git adddoes happen, and does let someone with access to the local copy of the repo find intermediate states .git pushonly pushes objects that correspond to a commit, shaking off the offending object which cannot be recovered …