summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/wget.py
diff options
context:
space:
mode:
authorJustin Bronder <jsbronder@cold-front.org>2021-12-06 16:24:37 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-08 20:22:53 +0000
commitacd77c3ac9f5272908cbeb96426c2f80fa75a48f (patch)
tree03c5d50359577a7f5213b4b59ba9191e198a80d1 /bitbake/lib/bb/fetch2/wget.py
parent35f134529097e9b1d1fa28613f6e19b047836e1f (diff)
downloadpoky-acd77c3ac9f5272908cbeb96426c2f80fa75a48f.tar.gz
bitbake: fetch2/wget: add redirectauth parameter
Add a parameter that limits sending Basic authentication in the Authorization header to only the first host and not any that we're redirected to. Ignoring potential security concerns, temporary AWS URLs will reject any request that includes authentication details in both the query parameters (from the redirect) and in the Authorization header. Temporary AWS URLs are now being used for release assets from private Github repositories. According to the previous discussion linked below, they're also in use by bitbucket. See also: https://lore.kernel.org/bitbake-devel/CAC9ffDEuZL-k8199bUyN+8frjw6bg-g=vrumxxtvt+RVParQ8Q@mail.gmail.com/ (Bitbake rev: a6ab32013a4381a1b694ed46caf2c9da932644d0) Signed-off-by: Justin Bronder <jsbronder@cold-front.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/wget.py')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index fd9b304961..d48998a98f 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -112,7 +112,17 @@ class Wget(FetchMethod):
112 fetchcmd += " -O %s" % shlex.quote(localpath) 112 fetchcmd += " -O %s" % shlex.quote(localpath)
113 113
114 if ud.user and ud.pswd: 114 if ud.user and ud.pswd:
115 fetchcmd += " --user=%s --password=%s --auth-no-challenge" % (ud.user, ud.pswd) 115 fetchcmd += " --auth-no-challenge"
116 if ud.parm.get("redirectauth", "1") == "1":
117 # An undocumented feature of wget is that if the
118 # username/password are specified on the URI, wget will only
119 # send the Authorization header to the first host and not to
120 # any hosts that it is redirected to. With the increasing
121 # usage of temporary AWS URLs, this difference now matters as
122 # AWS will reject any request that has authentication both in
123 # the query parameters (from the redirect) and in the
124 # Authorization header.
125 fetchcmd += " --user=%s --password=%s" % (ud.user, ud.pswd)
116 126
117 uri = ud.url.split(";")[0] 127 uri = ud.url.split(";")[0]
118 if os.path.exists(ud.localpath): 128 if os.path.exists(ud.localpath):