-
Notifications
You must be signed in to change notification settings - Fork 140
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
Allow the user to provide their own IPolicyForHTTPS implementation. #80
Conversation
… if no policy is present.
So the failed builds indicate that this approach doesn't work for Twisted < 14.0.0, as that version introduced BrowserLikePolicyForHTTPS, upon which the PR relies. It should be possible to provide the equivalent functionality for older versions of Twisted, by providing a suitably configured instance of twisted.internet.ssl.ClientContextFactory, but that will mean some version-sniffing. |
I would personally suggest dropping support for older versions of Twisted, given their default TLS policy was insecure. |
@@ -0,0 +1,52 @@ | |||
-----BEGIN PRIVATE KEY----- |
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.
Seeing BEGIN PRIVATE KEY
anywhere in a PR is somewhat worrisome, as it provides an opportunity for naive users to re-use publicly known keys. Not to mention the fact that github security scanners will forever be notifying the org admins about this "security problem" :). I'd really rather that this go into a key-bootstrapping script.
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.
My apologies, I wasn't aware that GH would spam admins over this. I naively based this example on some twisted docs that included keys and certs as part of the code, thinking that it would be a familiar presentation, but I realize that probably wasn't the best choice,
I will rework this to issue the requisite OpenSSL commands, etc.
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.
GH doesn't regularly spam admins, but on an inconsistent basis, security consulting type folks will go trawling through repositories looking for matches of that regex (I have to admit I type it in sometimes just to make myself sad; many usages are not so harmless).
The twisted examples that ship .pem files with the code are definitely the bad example I learned from here.
Sorry that it took so long to review this; treq's review queue isn't integrated into Twisted's and so it has often escaped my attention. Would you be willing to address this stuff so we can get it merged? |
@ldanielburr that is (apparently I can't assign you because you aren't in the org or something?) |
@glyph - Yes, I would be happy to address the review feedback by tomorrow, provided the question of how to set the twisted version requirements is answered. Thanks for reviewing! |
No problem! The spurious build failures should be fixed now, so if you want to merge master or rebase you should be able to get a clean run. |
… is a bad practice. Added link to exarkun's self-signed certificate generation script.
…r does not provide a policy argument.
Current coverage is
|
@glyph - Given that PR #76 was merged a while ago, I think this PR should be closed. Now that a caller can provide their own agent implemention as an argument when invoking treq, any IPolicyForHTTPS concerns can be handled by passing the appropriate object to the agent, in the contextFactory argument. It might still be useful to revise the documentation in this PR to demonstrate how to work with a self-signed cert, how to work with a client cert, etc. |
I'm inclined to agree, since you're the one who originally opened it. As always feel free to make a new PR if you change your mind :). |
Use @Implementer instead of @implements
This allows a user to, for example, connect to a server using a self-signed certificate. Could definitely use some guidance as to how best to test this.