-
-
Couldn't load subscription status.
- Fork 6.9k
HTTP Strict Transport Security (HSTS) using libhsts #2682
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
Conversation
lib/url.c
Outdated
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.
I think you should stick with plain #ifdef when there's just one define to check, as that's what we usually do in the code.
|
FYI: @rockdaboot |
|
Thanks for letting me know about this patch ! Great work ! I didn't even make a release of libhsts yet. Nor did I make a real implementation by myself (but it's on my list for wget and wget2 - just striked out curl ;-). I was so busy the last weeks with polishing the GnuTLS build architecture... But I take this as a butt-kick to get busy with libhsts again :-) |
configure.ac
Outdated
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.
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.
I agree with @vszakats!
docs/libcurl/symbols-in-versions
Outdated
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.
same version number comment as below...
docs/libcurl/curl_version_info.3
Outdated
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.
Make it 7.62.0, which seems the likely candidate since we won't merge new features like this before 7.61.0 and the next release with new features will be 7.62.0...
configure.ac
Outdated
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.
I agree with @vszakats!
lib/url.c
Outdated
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.
should this perhaps include it <libhsts.h> since it isn't a local header?
lib/urldata.h
Outdated
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.
same as above
|
@zagor let me know if you need any help getting changes to the test scripts done so we can have a test or two of this added. |
|
I think the PSL test, test 1136, is a good example. Note how it sets "PSL" as a required feature for the test to run. The runtests.pl script first checks if the build has the feature enabled and if so, sets the associated variable. The logic that then makes sure that the test's required feature matches what the local build features is here. You could use a similar approach for HSTS. I would also suggest that you make the test depend on "debug", which makes it only work on debug builds but then you can add custom logic #ifdefed on #ifdef DEBUGBUILD
char *special = curl_getenv("CURL_HSTSFILE");
if(special) {
/* use this file name instead of the real one */
free(special);
}
#endifYou can then make the test case set that environment variable. Test 1136 sets the |
|
@zagor you up to getting this polished and ready for merge? I'll volunteer to write up a travis adjustment for it post-merge. |
|
Yes, sorry for the delay. I had a long vacation and sort of forgot about this. I'll trim the final bits soon! |
|
Fixed the review comments. Test case coming soon. |
|
I think the tests look fine! Some questions/wishes on the patch in general:
|
|
Sorry, forgot to weigh in on this but thanks for underscoring the issue for me. Here's what I think... Loading 700KB only to do a single transfer, kill the handle and then do another one that loads the same 700KB again is certainly almost like a nightmare scenario to many users. At the same time, doing it unconditionally with a fixed path in However, doing HSTS globally still has so many downsides that I can't see it being a very good way forward. For example users will be stuck with that single HSTS file, no matter how many easy handles or threads it uses. I think we pretty much have to do the load per-handle in spite of all. We should probably then only do it for users that ask for it, and then we can allow a custom path to the file. As a follow-up, we can then add HSTS sharing to the share API so that a user can select to share that single HSTS between exactly those handles they think is suitable. An application could then even create/kill easy handles and re-use the same cached share object if they want to use HSTS without reloading it many times. |
|
Initialising the HSTS object on first-use and sharing it afterwards looks like a nice solution — |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Thanks for the reminder, bot. I haven't abandoned this, just being really bad at finishing what I started. 😄 |
|
I have @zagor's work rebased and squashed in a separate branch. |
|
I have yet again rebased this work in my separate branch. There is an interest in HSTS from users and I'm thinking of how to push this forward. @zagor, are you still interested in working on this? |
|
I'm very embarrassed but yes, I would still like to see this go in. I'll try to make time for it soon. |
|
I think we should presume users of this would like to use their own crafted preload file (simply because the full one is too big) and/or that we should populate a file/cache at run-time based on incoming headers. Possibly we could make the preloaded list get passed to libcurl via a pointer/buffer somehow so that applications could have a built-in set. |
This patch adds two new configure parameters: --with-libhsts=PATH to point to libhsts --with-hsts-file=FILE to specify location of the dafsa file that contains the domain database
|
I suggest we split runtime caching into a separate PR. This one has been open for much too long already. |
|
Maybe we want to specify a default one for the curl tool? |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This patch adds two new configure parameters:
--with-libhsts=PATH to point to libhsts
--with-hsts-file=FILE to specify location of the dafsa file that
contains the domain database