-
Notifications
You must be signed in to change notification settings - Fork 291
Hash history comments and sign them with the author's personal key. #6004
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
base: trunk
Are you sure you want to change the base?
Conversation
|
We need a passphrase option here, right? Or what's the standard |
Hrmm, this is a deep rabbit hole to go down that adds a ton of work;
I was planning on having ucm manage these complete for the user as basic EdDSA keys, rather than having the user configure their own keys; thus it's basically treated the same as your Share token, but with the added ability of cryptographic signing and a public key. Do you think passphrases or the other mentioned features are table-stakes? |
37b15a0 to
aa40862
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the migration, this adds nullable versions of the new columns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part 3 of the migration, this makes the new columns non-nullable in SQLite's own annoying way, which is creating a new table and copying all the data between them, then dropping the original and renaming the new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just moved due to import needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes here to support the new comment hashes, author thumbprints, and author signatures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that migrations need a credential manager I rewrote the bulk of the credential manager stuff to support a proper singleton, which should be safer when multiple parts of the app may have their own credential managers; I also pulled it out into its own package so it can be accessed in the Migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All new Personal Key stuff.
A personal key is just a public-private EdDsa key pair, which is stored in the user's credentials.json file.
28e1af1 to
0af09bd
Compare
It seems to work now.
0af09bd to
de952d7
Compare
258064e to
6f4d4ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into the unison-credentials package
| - http-types | ||
| - ki | ||
| - lens | ||
| - lock-file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into unison-credentials
abdb970 to
9b4a76e
Compare
Okay, makes sense. Sorry I just spotted your reply now. Edit: It was a draft PR at the time so I feel less bad about not noticing the comment. |
Which approach does command-line |
| cabal-version: 1.12 | ||
|
|
||
| -- This file has been generated from package.yaml by hpack version 0.36.0. | ||
| -- This file has been generated from package.yaml by hpack version 0.38.1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
danger here; in the other cabal files too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
side note: stack 3.1.1 (which I haven't tested yet?) has a force-hpack option (or something) which will make this less dangerous once we're on that version.
aryairani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after reverting the cabal hpack version lines (sorry) I would say it can be merged
ssh does support encrypted keys of course, in SSH's case that key represents your ability to sign into remote servers, If we're legitimately concerned about a user's credentials file being stolen or leaked then we shouldn't be storing unencrypted auth tokens on disk at all; since currently an attacker would just take the user's OAuth token rather than their personal key. AFAIK storing unencrypted credentials is quite a common practice, e.g. the AWS cli just stores your unencrypted creds at Not saying it's bad to allow requiring a password for this stuff, and maybe if we end up using the personal key for accessing Unison Cloud we may wish to add more layers of security, but at the moment I don't think it's worth the time to implement, since if an attacker has access to your file-system we have bigger concerns than them fraudulently signing comments in your name; Hrmm, Is that a reasonable stance? |
|
Makes sense. |
|
Some tests with 'continue-on-error: true' have failed:
Created by continue-on-error-comment |
Overview
Adds a migration which hashes and signs all of a codebase's history comments, as a step towards syncing them with Share.
Implementation approach and notes
Adds a Migration which:
credentials.jsonfile.unison-clithere.ensure hashing uses a canonicalized serialization of the components to ensure no hash-collisions that can result froma simple concatenationInteresting/controversial decisions
It's hard to know whether personal keys are overkill or not, while it would likely be possible to get away with just Share auth in the short term, I don't think it's really sound in the presence of multiple codeservers; I opted to implement personal keys because I believe I'll get mileage out of them in the future, e.g. they can be used for things like service-account auth in CI and such.
Test coverage
I tested the migration by creating some comments on a trunk build and running the migration on it, then creating some new comments.
Loose ends
Next up is to implement the comment sync APIs.