-
Notifications
You must be signed in to change notification settings - Fork 996
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
Caveats should return True or False, not raise #8598
Caveats should return True or False, not raise #8598
Conversation
This approach is not going to work. I'm getting more and more familiar with the way pymacaroons works, and there's a problem. The only caveats that are considered are those that are verified, which means the verifier got at least 1 positive callback for this caveat. In this PR's code we have: def verify(self, key: str) -> None:
self.verifier.satisfy_general(V1Caveat(self))
self.verify_signature(key=key)
def verify_signature(...):
...
self.verifier.verify(self.macaroon, key) When I wrote this I thought This means:
If we wanted it to work, when solely checking the signature, one would need to attach a Back to the drawing board. |
In a comical turn of event, I think I'll split this splitted PR into
That would mean I'd remove the verify_signature altogether, this would not be needed anymore for #8563 and the problem described above disappears. Sometimes, less is more. |
dbf49b8
to
fb7005c
Compare
I've done that. |
fb7005c
to
fdf723e
Compare
Closing in favor of #9264 which is (to me) a much better approach of the problem. |
This is #8562 with one more commit to take care of #8591/#8565.
EDIT: Actually no, read below for detail, but this PR does 1 thing: make the code much more explicit regarding raising vs returning False in macaroon-related code to express the idea that there was a problem when verifying a macaroon.
In addition to the 100% coverage that has proven unsufficient twice in a row, here are the tests I did:
I've tested that the same twine upload on my previous PR failed, and now it works.
That being said, I want to add integration tests too, to avoid regressions. I'll add the integration tests in a different unrelated PR that we can merge before this one to make sure.