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

Is encrypt list automatically ignored? #69

Closed
marcopolo4k opened this issue Jun 14, 2017 · 7 comments
Closed

Is encrypt list automatically ignored? #69

marcopolo4k opened this issue Jun 14, 2017 · 7 comments
Labels

Comments

@marcopolo4k
Copy link

Are encrypt list files automatically yadm-git-ignored? If not, why not? Seems like that would prevent accidental uploading of intentionally encrypted files.

@TheLocehiliosan
Copy link
Member

They are not automatically ignored. As far as I'm aware, Git only allows for a single core.excludesFile. I don't think there is a way to activate excludes through something like an environment variable either. There are users who already use $GIT_DIR/info/exclude or core.excludesFile for their own purposes, so hooking into that would be a bit disruptive.

I'll think about it some more. Perhaps I'll think of a suitable way.

@malikoth
Copy link

What about appending the contents of .yadm/encrypt to $GIT_DIR/info/exclude with a header like, ### This section is auto-generated, modify this through .yadm/encrypt. Having a section be automatically managed shouldn't affect whatever else someone is using the exclude file for. Then you could just wipe the file from the header to the EOF, and append the new contents again whenever there's a change to .yadm/encrypt. Maybe?

@abathur
Copy link
Contributor

abathur commented Feb 20, 2018

I got a good noob-run through using yadm to preserve config before wiping a system last night, and I had to double-check myself each time I saw one of the files I needed to encrypt in yadm status -u. I thought of a few things that might've made it a little less stressful:

More explicit reporting of the status of encrypted files

I think it'd help to have either a separate command (yadm status-encrypted) or overlay a flag on yadm status (yadm status --encrypted) that collects a modular set of smaller reports that convey as much as possible about the exact status of every file that is in the current blob or matches encrypt. This can require the decryption password; but if decryption time is too tedious for some uses, a separate encrypted file could just store metadata about the paths in the blob. (While thinking about how to generate this, I wondered if the encrypted blob could be/hold its own .git repo, though that might make older copies of sensitive information too durable.)

This information would be most useful appended/inlined for relevant git commands:

  • append a small report on encrypt paths that are either out of sync with or will be updated by the current encrypted blob toyadm status, and one on paths that are safely up-to-date in the committed encryption blob and paths that still need action to yadm status -u.
  • filter output from some git commands (particularly yadm status -u) to wrap encrypt paths with new colors or typographic indications of their status.

Backstops for things that are easy to miss

It's probably more frustrating to try and satisfy a git hook than to be able to see relevant status information before commit, but I think a good pre-commit hook that objects if a commit includes files matching encrypt would go a long way towards preventing hard-to-fix accidents. It might also lay a foundation for more pre-commit sanity checks that improve UX around less-serious consistency issues (like objecting if encrypt files don't match what's in the encrypted blob when the blob is committed).

@TheLocehiliosan TheLocehiliosan self-assigned this Jun 22, 2018
@TheLocehiliosan TheLocehiliosan added this to the 1.13.0 milestone Jun 22, 2018
@abathur
Copy link
Contributor

abathur commented Dec 28, 2018

I'm repeating this process again as I clean up to prepare to replace my laptop. A few stray thoughts...

It's fairly obvious, but I've found some grep oneliners useful for sorting this out. I've been using yadm status -u | grep -f .yadm/encrypt -v to filter the status down to uncommitted files that don't match the patterns in the encrypt file, and yadm status -u | grep -f .yadm/encrypt to see anything that does match. I guess you could also use yadm list | grep -f .yadm/encrypt as a double-check to make sure you haven't committed one. This probably depends on how you've formatted your encrypt file. I had to remove a blank line from mine, for example.

WRT to eventual code changes here, I wondered if there's an existing list (or if it would be worth maintaining one) of well-known dotfiles and flagging files that shouldn't be included, or should only be included if encrypted, etc.

This could power some nice UX improvements like:

  • a safety net if the user tries to add well-known files that should be encrypted
  • a command that can highlight uncommitted files that are good candidates for inclusion
  • command that can search repo history for traces of a file that should be encrypted

TheLocehiliosan added a commit that referenced this issue Oct 17, 2019
Append the contents of .config/yadm/encrypt to the repo's git ignore
list. This is to help prevent accidentally committing unencrypted
sensitive data.
@TheLocehiliosan
Copy link
Member

Automatic ignoring of patterns found in .config/yadm/encrypt has been added to the develop branch. There are some other good ideas for features in this issue, so I'll leave it open for now until I move them over to their own issues.

@seankhl
Copy link

seankhl commented Nov 1, 2019

I agree that smarter handling of encrypted files would be nice. What about something like yadm add --encrypt [file] which would add the file as an encrypted one and (possibly) encrypt it into files.gpg and stage files.gpg. This way adding an encrypted file would follow the same flow as any other version-controlled file, you just yadm add --encrypt it and it would work as expected. One possible stumbling block for this would be adding only that one file to the encrypted files.gpg without adding others that have changed but not been manually added themselves, though I guess it should certainly be possible. Extending yadm status to show the state of encrypted files is a big +1 from me. Even extending yadm diff and yadm diff --staged would be cool, not showing a full diff necessarily but just that it has changed, or even showing the diff with a password prompt. I agree that it's not clear exactly what set of improvements is best, but I figured I'd throw in my two cents.

TheLocehiliosan added a commit that referenced this issue Nov 8, 2019
Update version number and update documentation

* Support XDG base directory specification
* Redesign alternate processing
* Add built-in default template processor
* Allow storing alternates in yadm dir (#90)
* Add support for j2cli template processor
* Ignore encrypted files (#69)
* Support DISTRO in alternates (#72)
* Support `source` in templates (#163)
* Change yadm.cygwin-copy to yadm.alt-copy
* Support `-b <branch>` when cloning (#133)
* Support includes for j2-based templates (#114)
* Remove stale/invalid linked alternates (#65)
* Add support for Mingw/Msys (#102)
* Allow `-l` to pass thru to the `yadm config` command
* Improve processing of `yadm/encrypt`
* Fix bugs in legacy alternate processing
* Fix bug with hidden private files
* Improve support for older versions of Git
* Add upgrade command
@TheLocehiliosan TheLocehiliosan removed this from the 2.0.0 milestone Nov 9, 2019
@TheLocehiliosan TheLocehiliosan removed their assignment Nov 16, 2019
@TheLocehiliosan
Copy link
Member

I've created a new issue, #386 from a non-addressed idea in this issue.

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

No branches or pull requests

5 participants