Skip to contentSkip to conversation

fetch/git: Handle github dropping git:// support

PATCH In review Richard Purdie 6 participants 8 messages Nov 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fetch/git: Handle github dropping git:// support

github is dropping support for git procotol iun git urls. Add code to remap this to https in a way that could be used in older bitbake versions.

---
 lib/bb/fetch2/git.py | 4 ++++
 1 file changed, 4 insertions(+)
lib/bb/fetch2/git.py +4 -0
index e974445fbe..f5be24d6ab 100644
@@ -142,6 +142,10 @@ class Git(FetchMethod):
             ud.proto = 'file'
         else:
             ud.proto = "git"
+        if ud.host == "github.com" and ud.proto == "git":
+            # github stopped supporting git protocol
+            # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git
+            ud.proto = "https"
 
         if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
             raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/2 fetch/git: Show warning for invalid github urls

On master, tell the users they need to update their urls for github.

---
 lib/bb/fetch2/git.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/fetch2/git.py +1 -0
index f5be24d6ab..682efa323f 100644
@@ -146,6 +146,7 @@ class Git(FetchMethod):
             # github stopped supporting git protocol
             # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git
             ud.proto = "https"
+            bb.warn("URL: %s uses git protocol which is no longer supported by github. Please change to ;protocol=https in the url.")
 
         if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
             raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
Signature · 1 line
2.32.0
#2 lore raw
In reply to Richard Purdie
Quoted 13 lines · Richard Purdie

github is dropping support for git procotol iun git urls. Add code to remap this to https in a way that could be used in older bitbake versions.

---
  lib/bb/fetch2/git.py | 4 ++++
  1 file changed, 4 insertions(+)
lib/bb/fetch2/git.py +0 -0
index e974445fbe..f5be24d6ab 100644

lib/bb/fetch2/git.py class Git(FetchMethod): · line 147

Quoted 6 lines
lib/bb/fetch2/git.py +3 -0
@@ -142,6 +142,10 @@ class Git(FetchMethod):
              ud.proto = 'file'
          else:
              ud.proto = "git"
+        if ud.host == "github.com" and ud.proto == "git":
+            # github stopped supporting git protocol
+            # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git

While having a warning within the bitbake is something very much appreciated, I don't think it's a good idea to remap to https here, as I think rather the recipes that still use this should be fixed. This will just lead to non-core layer (the ones being not so well maintained) just ignoring the warning and leave the original offending recipes as they are.

I think this solution does scale very well.
For instance this assumes that github.com is used, but I can also think of DNS aliases, where this rule here simply won't catch up... same for the fact that other hosting platforms will likely go in the same direction and we would end up with an ever growing condition here

Bottom line: I like the warning, but would rather insist on the recipes that still use git:// + protocol=git to be fixed - at the mentioned 11.1.22 likely fetching them will fail with an explicit error message anyway, so I actually don't see the need to magically fix up things here

Quoted 15 lines
lib/bb/fetch2/git.py +1 -1
+            ud.proto = "https"
 
          if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
              raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#12856): https://lists.openembedded.org/g/bitbake-devel/message/12856
Mute This Topic: https://lists.openembedded.org/mt/86764631/3647476
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 35 lines · Konrad Weihmann
Quoted 13 lines · Richard Purdie

github is dropping support for git procotol iun git urls. Add code to remap this to https in a way that could be used in older bitbake versions.

---
  lib/bb/fetch2/git.py | 4 ++++
  1 file changed, 4 insertions(+)
lib/bb/fetch2/git.py +0 -0
index e974445fbe..f5be24d6ab 100644

lib/bb/fetch2/git.py class Git(FetchMethod): · line 147

Quoted 6 lines
lib/bb/fetch2/git.py +3 -0
@@ -142,6 +142,10 @@ class Git(FetchMethod):
              ud.proto = 'file'
          else:
              ud.proto = "git"
+        if ud.host == "github.com" and ud.proto == "git":
+            # github stopped supporting git protocol
+            # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git

While having a warning within the bitbake is something very much appreciated, I don't think it's a good idea to remap to https here, as I think rather the recipes that still use this should be fixed. This will just lead to non-core layer (the ones being not so well maintained) just ignoring the warning and leave the original offending recipes as they are.

I think this solution does scale very well.
For instance this assumes that github.com is used, but I can also think of DNS aliases, where this rule here simply won't catch up... same for the fact that other hosting platforms will likely go in the same direction and we would end up with an ever growing condition here

Quoted 4 lines

Bottom line: I like the warning, but would rather insist on the recipes that still use git:// + protocol=git to be fixed - at the mentioned 11.1.22 likely fetching them will fail with an explicit error message anyway, so I actually don't see the need to magically fix up things here

With 15 years of legacy branches and recipes out there, this change is intended to be backported to older bitbakes to at least give some support to people stuck on older versions. This is why this commit and the warning are separated.

The warning is being added as we're not at 11.1.22 yet and people have previously said they don't like instant hard breaking error messages. We'll therefore give people some time to update, then change master to an error.

Cheers,

Richard

#4 lore raw

(Reply to all, since I simply hit reply...not nearly enough caffeine yet...)

This kind of breaks other things- what if you have a server that you need to do protocol=ssh and it's authenticated (We have some of this at Motorola
Solutions going on for security reasons...)? The proposed change causes
access to that to go away. You almost need to fix this by checking the target host and if it's GitHub, do those changes since they're not allowed- but that's a more invasive change for "fixing" the older branches (We're
working on catching up, PROMISE! X-D) Not sure what the right answer is
for this other than Yowl at GitHub and Microsoft for this one- the only place you know of this and finding out about it is on their blog and when you get punted out.

Quoted 71 lines · Richard Purdie
Quoted 3 lines · Konrad Weihmann
Quoted 1 line · Richard Purdie

github is dropping support for git procotol iun git urls. Add code to

remap

Quoted 7 lines
Quoted 7 lines

this to https in a way that could be used in older bitbake versions.

---
  lib/bb/fetch2/git.py | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 11 lines

lib/bb/fetch2/git.py class Git(FetchMethod): · line 147

Quoted 11 lines
lib/bb/fetch2/git.py +3 -0
index e974445fbe..f5be24d6ab 100644
@@ -142,6 +142,10 @@ class Git(FetchMethod):
              ud.proto = 'file'
          else:
              ud.proto = "git"
+        if ud.host == "github.com" and ud.proto == "git":
+            # github stopped supporting git protocol
+            #

https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git

Quoted 14 lines

While having a warning within the bitbake is something very much appreciated, I don't think it's a good idea to remap to https here, as I think rather the recipes that still use this should be fixed. This will just lead to non-core layer (the ones being not so well maintained) just ignoring the warning and leave the original offending recipes as they are.

I think this solution does scale very well.
For instance this assumes that github.com is used, but I can also think of DNS aliases, where this rule here simply won't catch up... same for the fact that other hosting platforms will likely go in the same direction and we would end up with an ever growing condition here

Quoted 4 lines

Bottom line: I like the warning, but would rather insist on the recipes that still use git:// + protocol=git to be fixed - at the mentioned 11.1.22 likely fetching them will fail with an explicit error message anyway, so I actually don't see the need to magically fix up things here

With 15 years of legacy branches and recipes out there, this change is intended
to be backported to older bitbakes to at least give some support to people stuck
on older versions. This is why this commit and the warning are separated.

The warning is being added as we're not at 11.1.22 yet and people have previously said they don't like instant hard breaking error messages. We'll therefore give people some time to update, then change master to an error.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#12859):
https://lists.openembedded.org/g/bitbake-devel/message/12859
Mute This Topic: https://lists.openembedded.org/mt/86764631/5804681
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Hi Frank,

Quoted 5 lines · Frank Earl

(Reply to all, since I simply hit reply...not nearly enough caffeine yet...)

This kind of breaks other things- what if you have a server that you need to do protocol=ssh and it's authenticated (We have some of this at Motorola

I think in that case you have ;protocol=ssh at the end of your URL?

In that case, the suggested code does handle that because it only replaces the protocol from git to https. git protocol does not have authentication, c.f. man git-clone:

"""
The native transport (i.e. git:// URL) does no authentication and should be used with caution on unsecured networks.
"""

So if you needed authentication in the first place and it worked, I'm pretty sure this change will not change anything for you.

Hopefully I understood your complain and am not completely off-topic :)

Cheers,
Quentin

#6 lore raw
In reply to Richard Purdie

Am Dienstag, 2. November 2021, 14:27:58 CET schrieb Richard Purdie:

Quoted 9 lines

With 15 years of legacy branches and recipes out there, this change is intended to be backported to older bitbakes to at least give some support to people stuck on older versions. This is why this commit and the warning are separated.

The warning is being added as we're not at 11.1.22 yet and people have previously said they don't like instant hard breaking error messages. We'll therefore give people some time to update, then change master to an error.

I think this is a good plan.

Best,
JS

#7 lore raw
In reply to Richard Purdie
Quoted 9 lines

-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Richard Purdie
Sent: den 2 november 2021 13:45
To: [email protected]
Subject: [bitbake-devel] [PATCH 1/2] fetch/git: Handle github dropping
git:// support

github is dropping support for git procotol iun git urls. Add code to remap

Typo: procotol iun -> protocol in

Quoted 1 line

this to https in a way that could be used in older bitbake versions.

Though I would have written:

github is dropping support for the Git protocol in Git URLs. Add code to remap this to HTTPS in a way that can be used in older bitbake versions.

//Peter

Quoted 23 lines
---
 lib/bb/fetch2/git.py | 4 ++++
 1 file changed, 4 insertions(+)
lib/bb/fetch2/git.py +4 -1
index e974445fbe..f5be24d6ab 100644
@@ -142,6 +142,10 @@ class Git(FetchMethod):
             ud.proto = 'file'
         else:
             ud.proto = "git"
+        if ud.host == "github.com" and ud.proto == "git":
+            # github stopped supporting git protocol
+            # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git
+            ud.proto = "https"
 
         if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
             raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
--

2.32.0