aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/t-http.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-11-22 21:27:56 +0000
committerWerner Koch <[email protected]>2018-11-23 08:23:26 +0000
commit4a4bb874f63741026bd26264c43bb32b1099f060 (patch)
tree0857a46bd3ddc7e0afda2ffb1bebde518d8e9c6e /dirmngr/t-http.c
parentdoc: Clarify use of clear and nodefault in the AKL. (diff)
downloadgnupg-4a4bb874f63741026bd26264c43bb32b1099f060.tar.gz
gnupg-4a4bb874f63741026bd26264c43bb32b1099f060.zip
dirmngr: Avoid possible CSRF attacks via http redirects.
* dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path. (http_redir_info_t): New. * dirmngr/http.c (do_parse_uri): Set new fields. (same_host_p): New. (http_prepare_redirect): New. * dirmngr/t-http-basic.c: New test. * dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect instead of the open code. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. -- With this change a http query will not follow a redirect unless the Location header gives the same host. If the host is different only the host and port is taken from the Location header and the original path and query parts are kept. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144)
Diffstat (limited to '')
-rw-r--r--dirmngr/t-http.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dirmngr/t-http.c b/dirmngr/t-http.c
index 440633db4..3cf08ada2 100644
--- a/dirmngr/t-http.c
+++ b/dirmngr/t-http.c
@@ -394,9 +394,9 @@ main (int argc, char **argv)
else
{
printf ("Auth : %s\n", uri->auth? uri->auth:"[none]");
- printf ("Host : %s\n", uri->host);
+ printf ("Host : %s (off=%hu)\n", uri->host, uri->off_host);
printf ("Port : %u\n", uri->port);
- printf ("Path : %s\n", uri->path);
+ printf ("Path : %s (off=%hu)\n", uri->path, uri->off_path);
for (r = uri->params; r; r = r->next)
{
printf ("Params: %s", r->name);