From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#24490: 25.1; restclient no longer sends auth header upon redirect Date: Tue, 06 Jul 2021 17:44:00 +0200 Message-ID: <87sg0rphvj.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12212"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 24490@debbugs.gnu.org, Thomas Fitzsimmons To: Alain Picard Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 06 17:45:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0nGE-0002ze-C6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Jul 2021 17:45:22 +0200 Original-Received: from localhost ([::1]:51268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0nGD-00082Z-BV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Jul 2021 11:45:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0nFu-0007zj-Ik for bug-gnu-emacs@gnu.org; Tue, 06 Jul 2021 11:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0nFu-000238-8r for bug-gnu-emacs@gnu.org; Tue, 06 Jul 2021 11:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m0nFu-0006Ks-3k for bug-gnu-emacs@gnu.org; Tue, 06 Jul 2021 11:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Jul 2021 15:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24490 X-GNU-PR-Package: emacs Original-Received: via spool by 24490-submit@debbugs.gnu.org id=B24490.162558625524277 (code B ref 24490); Tue, 06 Jul 2021 15:45:02 +0000 Original-Received: (at 24490) by debbugs.gnu.org; 6 Jul 2021 15:44:15 +0000 Original-Received: from localhost ([127.0.0.1]:49793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0nF9-0006JU-Cv for submit@debbugs.gnu.org; Tue, 06 Jul 2021 11:44:15 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:41856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0nF7-0006JG-5J for 24490@debbugs.gnu.org; Tue, 06 Jul 2021 11:44:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6C2mjWmGoajirpt64Tm2VGf7XIe1UiDipC27APO1exQ=; b=jBH+0Np5HAvCFPlPErZd3AolPS Ee9oqJrj5Ig2OSGLI4737mnyPesQ/ugqAyvr4v2XklcwD/G8CG6+Flg5Mrvovmg8hqwmWcrdRfMxJ y3TbGxeH+E5GtFDtBup4FTN1TEzEivserGuKrxeCnHYSwlucl/AB+gj/Lhncq/6ImTro=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0nEx-0002bR-81; Tue, 06 Jul 2021 17:44:05 +0200 X-Now-Playing: Black Midi's _Live on Canal St, NYC_: "Live on Canal St, NYC" In-Reply-To: (Alain Picard's message of "Wed, 21 Sep 2016 14:19:18 +1000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:209538 Archived-At: Alain Picard writes: > Dear Maintainers, > > In emacs 25.1, > the code in url-http.el, line 638, states: > > ;; Do not automatically include an authorization header in the > ;; redirect. If needed it will be regenerated by the relevant > ;; auth scheme when the new request happens. > (setq url-http-extra-headers > (cl-remove "Authorization" > url-http-extra-headers :key 'car :test 'equal)) > > I suspect this automatic regenration does not occur. I think this code is basically correct -- if the auth scheme has added something to url-http-extra-headers, then that has to be removed when doing the redirect, because otherwise we might be sending the auth to a completely wrong server, with the security implications of that. > Problem: I am using restclient.el, and hitting a server which > issues a redirect, and I receive a 400 Forbidden response because > the redirected call does not receive the authentication header > (I can see this from the log of my server). I think this must be a bug in restclient.el -- it should instead use an auth scheme that re-adds the Authorization header. I think. The URL interface is pretty vague here, as it is with many other things... Hm... Reading (defun url-http-create-request () [...] (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers)) nil (url-get-authentication (or (and (boundp 'proxy-info) proxy-info) url-http-target-url) nil 'any nil))) the auth is never added to `url-http-extra-headers', so perhaps that's not correct anyway -- it should be possible for the user to put Authorization in `url-http-extra-headers', and then have that be heeded even over the redirect. I've added Thomas to the CCs; perhaps he has some insights here. (Also see Bug#21350.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no