From nobody Tue Mar 1 20:13:57 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DD17719DBF71 for ; Tue, 1 Mar 2022 20:13:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K7T3T4M2Wz3DpN for ; Tue, 1 Mar 2022 20:13:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7602916203 for ; Tue, 1 Mar 2022 20:13:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 221KDv1m090968 for ; Tue, 1 Mar 2022 20:13:57 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 221KDvHZ090967 for bugs@FreeBSD.org; Tue, 1 Mar 2022 20:13:57 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 262283] encoding of + in libfetch Date: Tue, 01 Mar 2022 20:13:57 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: ronald-lists@klop.ws X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646165637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gl3Z34L0liw+WAx4XKVj87IY4GLUOKSVl20pR/ENbn4=; b=NcieZ+vnykvizEMQUWO/prP05m8hVV2NumckPIxD49kwe5Egv8yM43kBiMvAlLtSROPV0W x+X3LBrh0WsS+TuyDy4s7l8Ia25NaJNlvlGWKMshUfVkJNmM4TOXyzEG13crVChVmdfqAP v0C46C3sjTN/1ygysnebGjGy5YxrSGzJzfZUw0yho3o7fb1a0DytHbmjrHSe1K6wNahRF9 cMUBLM2PNFkCDoJ0FU6V1zdG2q/Cjax7PqjvAxPpRRKXjMJ0c5uxHD8Gw0GohDRc/bX8dJ UulRZ8r4f+rZfLY7wC+xowLZXsT70VqihY0Sa+uJMJR6AU2eP12m+H8C9Yq+Pw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646165637; a=rsa-sha256; cv=none; b=kXDMDo372MrZXg2YGTf1Ju6JMKqmvzKQ54tuDmTHKcdCDTDwqBeE0xD2MhSJNZGaFhQIZJ Ulem58AGbGenS9CsBUfH0Pc1xz3wCOS5xqbSKn6h8XSNxbM85FVScZlU8tRF44UtUmJR8c 0yeCx0G1BjsAaYqpaTPgbTwiDSjAOoVNvWUxcjDPHs//4QqshaEd7xRNtfCWs9Y9IBllgZ E+rcE6kHW85gNNRetU8CQ1peeTFlMpsxepyYnaRefnBUv/k+L5iVtVQIbnq8DTTcxILgl3 l6XPKUDY3OMRsFCiBd7I6210HELGLfBXTbq65Rk1brCYxKnSD8CwZxPo9tEDHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262283 Bug ID: 262283 Summary: encoding of + in libfetch Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: ronald-lists@klop.ws Created attachment 232193 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D232193&action= =3Dedit git diff in /lib/libfetch against 14-CURRENT Because of this mail thread https://lists.freebsd.org/archives/freebsd-ports/2022-February/001461.html I took a look at fetch. There is also information in the github link in the mails. What I found is that it is pretty easy to encode the + in the path of the U= RL. Although libfetch is spec compliant with and without this patch. This patch would provide more compatibility with non-spec compliant servers like S3/Cloudflare. My experience as a programmer is that encoding a space as a = + is only done when building the query string so if we leave the query string as= is we don't change valid URLs. If somebody encodes a space as a + in the host = or path of an URI before passing it to libfetch the request will not work with= the major (spec compliant) web servers. So I do not see possibilities for regression. So I think encoding the + as %2B in the path is very safe for requests to s= pec compliant servers and will prevent ambiguous requests to servers who do not follow the specs. An example of the encoding I implemented: fetch -vv "http://example.com/plus+space test?&q=3Da+b c" scheme: "http" user: "" password: "" host: "example.com" port: "0" document: "/plus%2bspace%20test?&q=3Da+b%20c" ... So the + and space before the question mark are percent-escaped. In the que= ry string only the space is escaped for a correct http request line. --=20 You are receiving this mail because: You are the assignee for the bug.=