audit, advisories and doctors/setup work
This commit is contained in:
@@ -306,7 +306,7 @@ public sealed class DockerSourceHandler : ISourceTypeHandler
|
||||
};
|
||||
}
|
||||
|
||||
private static (string Repository, string? Tag) ParseReference(string reference)
|
||||
internal static (string Repository, string? Tag) ParseReference(string reference)
|
||||
{
|
||||
// Handle digest references
|
||||
if (reference.Contains('@'))
|
||||
@@ -316,18 +316,21 @@ public sealed class DockerSourceHandler : ISourceTypeHandler
|
||||
}
|
||||
|
||||
// Handle tag references
|
||||
if (reference.Contains(':'))
|
||||
var lastSlash = reference.LastIndexOf('/');
|
||||
var lastColon = reference.LastIndexOf(':');
|
||||
if (lastColon > -1 && lastColon > lastSlash)
|
||||
{
|
||||
var lastColon = reference.LastIndexOf(':');
|
||||
return (reference[..lastColon], reference[(lastColon + 1)..]);
|
||||
}
|
||||
|
||||
return (reference, null);
|
||||
}
|
||||
|
||||
private static string BuildFullReference(string registryUrl, string repository, string tag)
|
||||
internal static string BuildFullReference(string registryUrl, string repository, string tag)
|
||||
{
|
||||
var host = new Uri(registryUrl).Host;
|
||||
var uri = new Uri(registryUrl);
|
||||
var host = uri.Host;
|
||||
var authority = uri.Authority;
|
||||
|
||||
// Docker Hub special case
|
||||
if (host.Contains("docker.io") || host.Contains("docker.com"))
|
||||
@@ -339,6 +342,6 @@ public sealed class DockerSourceHandler : ISourceTypeHandler
|
||||
return $"{repository}:{tag}";
|
||||
}
|
||||
|
||||
return $"{host}/{repository}:{tag}";
|
||||
return $"{authority}/{repository}:{tag}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using StellaOps.Scanner.Sources.Configuration;
|
||||
using StellaOps.Scanner.Sources.Handlers.Zastava;
|
||||
@@ -132,9 +133,9 @@ public sealed class ImageDiscoveryService : IImageDiscoveryService
|
||||
|
||||
return new SemVer
|
||||
{
|
||||
Major = int.Parse(match.Groups["major"].Value),
|
||||
Minor = int.Parse(match.Groups["minor"].Value),
|
||||
Patch = int.Parse(match.Groups["patch"].Value),
|
||||
Major = int.Parse(match.Groups["major"].Value, CultureInfo.InvariantCulture),
|
||||
Minor = int.Parse(match.Groups["minor"].Value, CultureInfo.InvariantCulture),
|
||||
Patch = int.Parse(match.Groups["patch"].Value, CultureInfo.InvariantCulture),
|
||||
PreRelease = match.Groups["prerelease"].Success
|
||||
? match.Groups["prerelease"].Value
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user