Add clock drift tolerance to signature validation#28
Conversation
chibenwa
left a comment
There was a problem hiding this comment.
Thanks for this contribution.
A clock drift tolerence of 5 minutes being the operational norm (OpenDKIM default) this contribution is welcome but I would personally love to have this configurable.
|
I do think the tolerated clock drift can be a field of the verifier. |
|
CF https://issues.apache.org/jira/browse/JDKIM-49 I can squash this upon merge to get the issue number into the commit message. |
After I pushed the PR I saw the other PR with API change proposal, I tought a setter would not be welcome, but it was the my first solution and it is what I'm running in my mail server. I agree with it, but I think instead of throwing an exception in the setter we could just keep it with the default value when parameter is negative. |
b4e3038 to
07a9ffb
Compare
|
Updated commit message |
|
If mutability is an issue we can make the field final and have a field in DkimVerifier that does a copy of it and update that only field. Regarding API proposed in #27 I think we would be able to easily add that useful feature in it. Thoughts? |
I don't see a problem with mutability with this configuration alone, I suggested to remove the exception just to avoid a runtime error if there's some weird bug on the user side, I prefer to throw exceptions in the constructor to avoid weird object states if more features are added. Looking to just this config, I'm fine with both solutions. In the future if more configuration options are needed, maybe an Options class containing parameters could be added to a second constructor in DKIMVerifier. EDIT: something like this |
|
Let me know what is more aligned with your view of the possible API changes and I will update this PR. |
This looks great to me 👍 |
Avoids signature validation failures when clock drift is lower than the threshold.
07a9ffb to
4601cf9
Compare
|
I kept |
chibenwa
left a comment
There was a problem hiding this comment.
Awesome!
I will wait 1 day or 2 to let the chance others to review before I merge this, but it looks perfect as is.
|
Thanks @epinter for this very nice contribution and everyone for the review! |
Avoids signature validation failures when clock drift is lower than the threshold.