Skip to content

feed2catalog produces catalog items with invalid dependency version ranges #3482

Closed

Description

@emgarten

V3 registration blobs contain packages with invalid version ranges

https://api.nuget.org/v3/registration1/nservicebus.persistence.sql.msbuild/index.json

Expected

feeds should validate packages and avoid displaying invalid data in the feed

Actual

From the client
install-package nservicebus.persistence.sql.msbuild -version 1.0.0-beta0006

fails with:

install-package : An error occurred while retrieving package metadata for 'nservicebus.persistence.sql.msbuild.1.0.0-beta0006' from source 'nuget.org'.
  '$version$' is not a valid version string.

Activity

  1. emgarten commented on Jan 22, 2017

    @emgarten
    MemberAuthor

    More examples

    Microsoft.VisualStudio.Services.Gallery.WebApi
      '[15.106.0.preview]' is not a valid version string.
    
    ServiceStack.Extras.Serilog
      '0.0.0-~4' is not a valid version string.
    
    BaseLine
      Invalid
    
    MassTransit.RavenDbIntegration
    '0.0.0-~3' is not a valid version string.
    
  2. added this to the milestone on Feb 9, 2017
  3. scottbommarito commented on Feb 17, 2017

    @scottbommarito
    Contributor

    These packages can all still be uploaded to the Gallery.

    The Gallery deserializes data from .nuspecs using a NuGet.Packaging class called NuSpecReader. When this class sees an invalid version range, it silently handles it and returns a version range that contains all versions. As a result, the Gallery has no visibility on broken metadata and cannot reject packages with invalid version ranges.

    I suggest either

    1. Leave the metadata flow intact and modify the client to install the latest version of a package dependency when it encounters a range it cannot understand.
    2. Modify NuSpecReader to throw an exception when it encounters invalid data and then handle the exceptions on the Gallery side.
  4. scottbommarito commented on Feb 21, 2017

    @scottbommarito
    Contributor

    We have concluded that we should both modify the client to install the latest/oldest version of a package dependency when it encounters a range it cannot understand AND modify NuSpecReader to throw an exception when it encounters invalid data and then handle the exception on the gallery side.

  5. changed the title [-]Invalid version range in v3 registration blob[/-] [+]Gallery accepts packages with illegal package dependency version ranges[/+] on Mar 6, 2017
  6. joelverhagen commented on Mar 6, 2017

    @joelverhagen
    Member

    This work item is: In the gallery, reject new packages with bad dependency version ranges. Just a validation task.

  7. 19 remaining items

  8. tedchamb commented on Oct 19, 2017

    @tedchamb

    @joelverhagen The issue is when a customer runs the following command using a nuget.exe the user will get an error and can not install the latest version of the package. We made a mistake on the version dependency for an older version of the package, and there is no way that I know of to fix that on our side. We had a '.' instead of a '-' in [15.106.0.preview]

    nuget.exe install install Microsoft.VisualStudio.Services.Gallery.WebApi -Verbosity Detailed -Pre

    NuGet Version: 4.4.0.4475
    Feeds used:
    E:\tfsomNuGet\Release_RealSigned_20170930.1
    https://www.myget.org/F/dotnet-core/api/v3/index.json
    https://api.nuget.org/v3/index.json
    https://www.myget.org/F/nugetvssprivate/api/v3/index.json
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

    Installing package 'Microsoft.VisualStudio.Services.Gallery.WebApi' to 'C:'.
    GET https://www.myget.org/F/nugetvssprivate/api/v3/registration1/microsoft.visualstudio.services.gallery.webapi/index.json
    GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.visualstudio.services.gallery.webapi/index.json
    GET https://dotnet.myget.org/F/dotnet-core/api/v3/registration1/microsoft.visualstudio.services.gallery.webapi/index.json
    OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.visualstudio.services.gallery.webapi/index.json 281ms
    NotFound https://www.myget.org/F/nugetvssprivate/api/v3/registration1/microsoft.visualstudio.services.gallery.webapi/index.json 574ms
    NotFound https://dotnet.myget.org/F/dotnet-core/api/v3/registration1/microsoft.visualstudio.services.gallery.webapi/index.json 2002ms
    An error occurred while retrieving package metadata for 'Microsoft.VisualStudio.Services.Gallery.WebApi' from source 'nuget.org'.
    '[15.106.0.preview]' is not a valid version string.
    NuGet.Protocol.Core.Types.FatalProtocolException: An error occurred while retrieving package metadata for 'Microsoft.VisualStudio.Services.Gallery.WebApi' from source 'nuget.org'. ---> System.ArgumentException: '[15.106.0.preview]' is not a valid version string.
    at NuGet.Versioning.VersionRange.Parse(String value, Boolean allowFloating)
    at NuGet.Protocol.Utils.CreateVersionRange(String stringToParse)
    at NuGet.Protocol.ResolverMetadataClient.ProcessPackageVersion(JObject packageObj, NuGetVersion version)
    at NuGet.Protocol.ResolverMetadataClient.d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.Protocol.ResolverMetadataClient.d__2.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.Protocol.DependencyInfoResourceV3.d__5.MoveNext()
    --- End of inner exception stack trace ---
    at NuGet.Protocol.DependencyInfoResourceV3.d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.PackageManagement.NuGetPackageManager.d__90.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.PackageManagement.NuGetPackageManager.<>c__DisplayClass89_1.<b__0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.PackageManagement.NuGetPackageManager.d__89.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.PackageManagement.NuGetPackageManager.d__88.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.CommandLine.InstallCommand.d__40.MoveNext()

  9. joelverhagen commented on Oct 25, 2017

    @joelverhagen
    Member

    After this fix is deployed, the following packages should be reflowed:

    MassTransit.RavenDbIntegration 3.2.2
    MassTransit.RavenDbIntegration 3.2.3
    MassTransit.RavenDbIntegration 3.2.4
    MassTransit.RavenDbIntegration 3.3.0
    MassTransit.RavenDbIntegration 3.3.0-unstable0009
    MassTransit.RavenDbIntegration 3.3.0-unstable0010
    MassTransit.RavenDbIntegration 3.3.0-unstable0012
    MassTransit.RavenDbIntegration 3.3.0-unstable0013
    Microsoft.VisualStudio.Services.Gallery.WebApi 15.106.0-preview
    ServiceStack.Extras.Serilog 2.0.1
    
  10. changed the title [-]Gallery accepts packages with illegal package dependency version ranges[/-] [+]feed2catalog produces catalog items with invalid dependency version ranges[/+] on Oct 30, 2017
  11. joelverhagen commented on Nov 3, 2017

    @joelverhagen
    Member

    All packages on nuget.org with invalid version ranges have been reflowed. nuget.exe install works on all of the three package IDs with invalid dependency version ranges:

    MassTransit.RavenDbIntegration
    Microsoft.VisualStudio.Services.Gallery.WebApi
    ServiceStack.Extras.Serilog
    

    Note that nuget.exe treats invalid version ranges as the "any version" range (, ).

    @tedchamb, let me know if you run into any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions