You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remember all previously verified configurations #300
I can't rebase to past revisions with different overcommit configurations. I end up in a detached state. I tried disabling signature verification but it will only work for commits after disabling the check.
This behavior is weird since I've already acknowledged all past revisions of overcommit's config, so I shouldn't need to verify them again. The only solution I've found it to completely uninstall overcommit hooks just for the rebase.
Let me know if you need more information.
Thanks!
Reacted by Gerry, Rob Bishop, thegranddesign, Ben Bernard, Jason Pickens, Steve Mokris and Kyrylo Struzhuk
@sds also even if it hasn't remembered previous states, it probably shouldn't end up leaving the branch in a detached state with no obvious way to recover or continue the rebase after signing.
You'll need to modify the HookSigner class to support searching through a list of previously-verified signatures.
This may involve creating a different storage format for the configuration value so that a quick lookup can be performed (emphasis on quick—the list of signatures will potentially grow quite large with time, so this needs to be something supporting a constant-time lookup).
@sds are you suggesting better than O(fileSize) like you want to do a search on disk? That seems like overkill. If we are going to read the whole file into memory to load it into a hash (like with a protobuf or a json file) it seems like that will get an O(fileSize) step, and so an addition single O(fileSize) search for an exact match in the set of strings won't actually take a long time.
Seems like signatures will grow at a rate O(number of .overcommit or custom .githooks) changes, that doesn't seem prohibitively large. Something simple like a SHA/signature per line seems like it would be reasonable?
I'm just trying to answer some questions on approach before I dive in :) Thanks for the assist!
I could also keep the most recent signature on "top" of the file and probably keep O() costs the same if the signature exists and is the most recent signature (the happy case) and only incur O(fileSize) search when there is no immediate match
Hey @benbernard, agree it's probably not crucial to address this, but I've seen some pretty weird use cases from users of this tool so I tend to not rule these possibilities out.
In this case, I like the idea of capping the number of signatures and storing the most-recently-created signature at the beginning of the file. Note that storing at the beginning of the file will require we store this outside of the .git/config file (which is what I think you were suggesting, but I just want to be clear). Storing inside .git/config will slow down every git invocation that needs to read this configuration file.
yeah 100%, don't store in .git/config. Do you think we can store in .git/? like .git/overcommit_signatures? Could drop it in the repo root, but that seems problematic since we would rather avoid people checking the file in... Could also do a ~/.overcommit_signatures or something like that... .git/ seems best to me if we are comfortable with shoving a file in there
Storing in .git makes sense to me. Agreed this should not be tracked by Git since that allows attackers to inject signatures in a pull request, bypassing the safety check.
I'd love to have this as well! If nobody is currently working on it, I might open a PR to address it.
What I'd propose is:
Add a new git config variable, overcommit.configuration.signaturehistory, which determines how many historical signatures we keep. Maybe default it to 5 or so.
When a new signature is generated:
Let VAR be the name of the config variable it's stored in (e.g. overcommit.configuration.signature or overcommit.HookType.HookName.signature)
If a signature already exists, and it's different from the new one:
For any signature variables with the same name but a numeric suffix (VAR.1, VAR.2, etc), increment the key, dropping the last one if it exceeds overcommit.configuration.signaturehistory
On Fri, May 27, 2022, 9:47 AM Tony Novak ***@***.***> wrote:
I'd love to have this as well! If nobody is currently working on it, I
might open a PR to address it.
What I'd propose is:
- Add a new git config variable,
overcommit.configuration.signaturehistory, which determines how many
historical signatures we keep. Maybe default it to 5 or so.
- When a new signature is generated:
- Let VAR be the name of the config variable it's stored in (e.g.
overcommit.configuration.signature or
overcommit.HookType.HookName.signature)
- If a signature already exists, and it's different from the new
one:
- For any signature variables with the same name but a numeric
suffix (VAR.1, VAR.2, etc), increment the key, dropping the last
one if it exceeds overcommit.configuration.signaturehistory
- Store the current signature in VAR.1
- Store the new signature in VAR
Thoughts?
—
Reply to this email directly, view it on GitHub
<#300 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADFKE3BFT7T5YYG664DSC3VMD4CDANCNFSM4BVITAAA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
Activity
trotzig commentedon Nov 26, 2015
Echoing what @sds informed me about when I ran into the same issue:
So something like
deivid-rodriguez commentedon Nov 27, 2015
@trotzig @sds Thanks to both for that. It's certainly more convenient than the workaround I ended up using:
I still think this is undesirable and shouldn't be necessary but if the fix is difficult to implement, I find the workaround acceptable.
sds commentedon Dec 1, 2015
You raise a good point, @deivid-rodriguez. It would be nice if Overcommit remembered all previously-signed configurations.
[-]Can't rebase due to signature verification[/-][+]Remember all previously verified configurations [/+]gerrywastaken commentedon Aug 14, 2016
@sds also even if it hasn't remembered previous states, it probably shouldn't end up leaving the branch in a detached state with no obvious way to recover or continue the rebase after signing.
ryanclark2 commentedon Jan 26, 2017
Is this still alive? Ran into this today after making changes to
overcommit.ymlthen rebasing a branch onto master.benbernard commentedon Aug 7, 2017
would really like this to land. Assume you folks would accept a pull request? Any pointers for where to start with the signatures?
sds commentedon Aug 7, 2017
Would love a PR addressing this, @benbernard!
You'll need to modify the
HookSignerclass to support searching through a list of previously-verified signatures.This may involve creating a different storage format for the configuration value so that a quick lookup can be performed (emphasis on quick—the list of signatures will potentially grow quite large with time, so this needs to be something supporting a constant-time lookup).
Hope that helps!
benbernard commentedon Aug 7, 2017
@sds are you suggesting better than O(fileSize) like you want to do a search on disk? That seems like overkill. If we are going to read the whole file into memory to load it into a hash (like with a protobuf or a json file) it seems like that will get an O(fileSize) step, and so an addition single O(fileSize) search for an exact match in the set of strings won't actually take a long time.
Seems like signatures will grow at a rate O(number of .overcommit or custom .githooks) changes, that doesn't seem prohibitively large. Something simple like a SHA/signature per line seems like it would be reasonable?
I'm just trying to answer some questions on approach before I dive in :) Thanks for the assist!
benbernard commentedon Aug 7, 2017
I could also keep the most recent signature on "top" of the file and probably keep O() costs the same if the signature exists and is the most recent signature (the happy case) and only incur O(fileSize) search when there is no immediate match
benbernard commentedon Aug 7, 2017
Another option would be to limit the # of signatures that we store, like cap it at like 1,000, that would prevent it from growing too large
sds commentedon Aug 7, 2017
Hey @benbernard, agree it's probably not crucial to address this, but I've seen some pretty weird use cases from users of this tool so I tend to not rule these possibilities out.
In this case, I like the idea of capping the number of signatures and storing the most-recently-created signature at the beginning of the file. Note that storing at the beginning of the file will require we store this outside of the
.git/configfile (which is what I think you were suggesting, but I just want to be clear). Storing inside.git/configwill slow down everygitinvocation that needs to read this configuration file.benbernard commentedon Aug 7, 2017
yeah 100%, don't store in
.git/config. Do you think we can store in.git/? like.git/overcommit_signatures? Could drop it in the repo root, but that seems problematic since we would rather avoid people checking the file in... Could also do a~/.overcommit_signaturesor something like that....git/seems best to me if we are comfortable with shoving a file in theresds commentedon Aug 7, 2017
Storing in
.gitmakes sense to me. Agreed this should not be tracked by Git since that allows attackers to inject signatures in a pull request, bypassing the safety check.ncri commentedon Mar 29, 2019
Any progress on this?
afn commentedon May 27, 2022
I'd love to have this as well! If nobody is currently working on it, I might open a PR to address it.
What I'd propose is:
overcommit.configuration.signaturehistory, which determines how many historical signatures we keep. Maybe default it to 5 or so.VARbe the name of the config variable it's stored in (e.g.overcommit.configuration.signatureorovercommit.HookType.HookName.signature)VAR.1,VAR.2, etc), increment the key, dropping the last one if it exceedsovercommit.configuration.signaturehistoryVAR.1VARThoughts?
benbernard commentedon May 27, 2022