<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14768</bug_id>
          
          <creation_ts>2022-03-24 15:10:24 +0000</creation_ts>
          <short_desc>GitHub git protocol urls need to be scrubbed</short_desc>
          <delta_ts>2022-04-20 21:25:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Layer Index</product>
          <component>Layer Index Metadata</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Orling">tim.orling</reporter>
          <assigned_to name="Tim Orling">tim.orling</assigned_to>
          <cc>konrad.scherer</cc>
    
    <cc>mhalstead</cc>
    
    <cc>randy.macleod</cc>
          
          <qa_contact name="apoorv sangal">apoorvsangal</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92854</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-03-24 15:10:24 +0000</bug_when>
    <thetext>Layers which have git protocol urls for GitHub need to switch to https. GitHub has blocked unauthenticated git protocol.

https://github.blog/2021-09-01-improving-git-protocol-security-github/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92892</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-03-31 14:36:05 +0000</bug_when>
    <thetext>Is this something that Michael can do in the database?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92917</commentid>
    <comment_count>2</comment_count>
    <who name="Konrad Scherer">konrad.scherer</who>
    <bug_when>2022-04-01 13:50:14 +0000</bug_when>
    <thetext>Yes from the Admin interface all the project url for each layers can be updated. 

Django does support custom commands and it should be possible to make a command that will iterate through the layers and update any github urls.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92967</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-04-10 18:45:20 +0000</bug_when>
    <thetext>The following should fix it:

UPDATE layerindex_layeritem
    SET layerindex_layeritem.vcs_url = REPLACE(layerindex_layeritem.vcs_url,&apos;git://github.com&apos;, &apos;https://github.com&apos;)
    WHERE layerindex_layeritem.vcs_url LIKE &quot;git://github.com%&quot;;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92991</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-04-11 22:04:39 +0000</bug_when>
    <thetext>After discussing with Paul, we do not want to do SQL directly. I&apos;ll need to refactor for &apos;manage.py shell&apos; which I might have permissions to do (after testing on local instance).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93134</commentid>
    <comment_count>5</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-04-20 17:36:36 +0000</bug_when>
    <thetext>Using manage.py shell:

from django.db.models import Value
from django.db.models.functions import Replace
from layerindex.models import LayerItem

layers = LayerItem.objects.all().filter(vcs_url__startswith=&apos;git://github.com&apos;)
layers.update(vcs_url=Replace(&apos;vcs_url&apos;, Value(&apos;git://github.com&apos;), Value(&apos;https://github.com&apos;)))</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93135</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-04-20 21:25:01 +0000</bug_when>
    <thetext>To get to the shell:
docker exec -it &lt;layersapp&gt; sh -c &quot;/opt/layerindex/manage.py shell&quot;

Count before fix:
106</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>