mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
fix: logging for remote network calls (#3140)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
parent
511cc9c2d5
commit
95b4a88256
@ -1,9 +1,9 @@
|
|||||||
// Code generated by go generate; DO NOT EDIT.
|
// Code generated by go generate; DO NOT EDIT.
|
||||||
// This file was generated by robots at 2024-05-23 08:47:23.204981 -0400 EDT m=+0.050881068
|
// This file was generated by robots at 2024-08-20 11:33:49.349625 -0400 EDT m=+0.383911876
|
||||||
// using data from https://spdx.org/licenses/licenses.json
|
// using data from https://spdx.org/licenses/licenses.json
|
||||||
package spdxlicense
|
package spdxlicense
|
||||||
|
|
||||||
const Version = "3.24.0"
|
const Version = "3.25.0"
|
||||||
|
|
||||||
var licenseIDs = map[string]string{
|
var licenseIDs = map[string]string{
|
||||||
"0bsd": "0BSD",
|
"0bsd": "0BSD",
|
||||||
@ -501,6 +501,8 @@ var licenseIDs = map[string]string{
|
|||||||
"dldezero2.0": "DL-DE-ZERO-2.0",
|
"dldezero2.0": "DL-DE-ZERO-2.0",
|
||||||
"dldezero2.0.0": "DL-DE-ZERO-2.0",
|
"dldezero2.0.0": "DL-DE-ZERO-2.0",
|
||||||
"doc": "DOC",
|
"doc": "DOC",
|
||||||
|
"docbookschema": "DocBook-Schema",
|
||||||
|
"docbookxml": "DocBook-XML",
|
||||||
"dotseqn": "Dotseqn",
|
"dotseqn": "Dotseqn",
|
||||||
"drl1": "DRL-1.0",
|
"drl1": "DRL-1.0",
|
||||||
"drl1.0": "DRL-1.0",
|
"drl1.0": "DRL-1.0",
|
||||||
@ -714,6 +716,7 @@ var licenseIDs = map[string]string{
|
|||||||
"gutmann": "Gutmann",
|
"gutmann": "Gutmann",
|
||||||
"haskellreport": "HaskellReport",
|
"haskellreport": "HaskellReport",
|
||||||
"hdparm": "hdparm",
|
"hdparm": "hdparm",
|
||||||
|
"hidapi": "HIDAPI",
|
||||||
"hippocratic2": "Hippocratic-2.1",
|
"hippocratic2": "Hippocratic-2.1",
|
||||||
"hippocratic2.1": "Hippocratic-2.1",
|
"hippocratic2.1": "Hippocratic-2.1",
|
||||||
"hippocratic2.1.0": "Hippocratic-2.1",
|
"hippocratic2.1.0": "Hippocratic-2.1",
|
||||||
@ -740,6 +743,7 @@ var licenseIDs = map[string]string{
|
|||||||
"hpndmarkuskuhn": "HPND-Markus-Kuhn",
|
"hpndmarkuskuhn": "HPND-Markus-Kuhn",
|
||||||
"hpndmerchantabilityvariant": "HPND-merchantability-variant",
|
"hpndmerchantabilityvariant": "HPND-merchantability-variant",
|
||||||
"hpndmitdisclaimer": "HPND-MIT-disclaimer",
|
"hpndmitdisclaimer": "HPND-MIT-disclaimer",
|
||||||
|
"hpndnetrek": "HPND-Netrek",
|
||||||
"hpndpbmplus": "HPND-Pbmplus",
|
"hpndpbmplus": "HPND-Pbmplus",
|
||||||
"hpndsellmitdisclaimerxserver": "HPND-sell-MIT-disclaimer-xserver",
|
"hpndsellmitdisclaimerxserver": "HPND-sell-MIT-disclaimer-xserver",
|
||||||
"hpndsellregexpr": "HPND-sell-regexpr",
|
"hpndsellregexpr": "HPND-sell-regexpr",
|
||||||
@ -1165,6 +1169,7 @@ var licenseIDs = map[string]string{
|
|||||||
"rsamd": "RSA-MD",
|
"rsamd": "RSA-MD",
|
||||||
"rscpl": "RSCPL",
|
"rscpl": "RSCPL",
|
||||||
"ruby": "Ruby",
|
"ruby": "Ruby",
|
||||||
|
"rubypty": "Ruby-pty",
|
||||||
"saxpath": "Saxpath",
|
"saxpath": "Saxpath",
|
||||||
"saxpd": "SAX-PD",
|
"saxpd": "SAX-PD",
|
||||||
"saxpd2": "SAX-PD-2.0",
|
"saxpd2": "SAX-PD-2.0",
|
||||||
@ -1265,6 +1270,9 @@ var licenseIDs = map[string]string{
|
|||||||
"tuberlin2": "TU-Berlin-2.0",
|
"tuberlin2": "TU-Berlin-2.0",
|
||||||
"tuberlin2.0": "TU-Berlin-2.0",
|
"tuberlin2.0": "TU-Berlin-2.0",
|
||||||
"tuberlin2.0.0": "TU-Berlin-2.0",
|
"tuberlin2.0.0": "TU-Berlin-2.0",
|
||||||
|
"ubuntufont1": "Ubuntu-font-1.0",
|
||||||
|
"ubuntufont1.0": "Ubuntu-font-1.0",
|
||||||
|
"ubuntufont1.0.0": "Ubuntu-font-1.0",
|
||||||
"ucar": "UCAR",
|
"ucar": "UCAR",
|
||||||
"ucl1": "UCL-1.0",
|
"ucl1": "UCL-1.0",
|
||||||
"ucl1.0": "UCL-1.0",
|
"ucl1.0": "UCL-1.0",
|
||||||
@ -1315,8 +1323,11 @@ var licenseIDs = map[string]string{
|
|||||||
"x11.0": "X11",
|
"x11.0": "X11",
|
||||||
"x11.0.0": "X11",
|
"x11.0.0": "X11",
|
||||||
"x11.0.0distributemodificationsvariant": "X11-distribute-modifications-variant",
|
"x11.0.0distributemodificationsvariant": "X11-distribute-modifications-variant",
|
||||||
|
"x11.0.0swapped": "X11-swapped",
|
||||||
"x11.0distributemodificationsvariant": "X11-distribute-modifications-variant",
|
"x11.0distributemodificationsvariant": "X11-distribute-modifications-variant",
|
||||||
|
"x11.0swapped": "X11-swapped",
|
||||||
"x11distributemodificationsvariant": "X11-distribute-modifications-variant",
|
"x11distributemodificationsvariant": "X11-distribute-modifications-variant",
|
||||||
|
"x11swapped": "X11-swapped",
|
||||||
"xdebug1": "Xdebug-1.03",
|
"xdebug1": "Xdebug-1.03",
|
||||||
"xdebug1.03": "Xdebug-1.03",
|
"xdebug1.03": "Xdebug-1.03",
|
||||||
"xdebug1.03.0": "Xdebug-1.03",
|
"xdebug1.03.0": "Xdebug-1.03",
|
||||||
|
|||||||
@ -251,6 +251,7 @@ func getModule(proxies []string, moduleName, moduleVersion string) (urlPrefix st
|
|||||||
case "file":
|
case "file":
|
||||||
p := filepath.Join(u.Path, moduleName, "@v", moduleVersion)
|
p := filepath.Join(u.Path, moduleName, "@v", moduleVersion)
|
||||||
urlPrefix = path.Join("file://", p) + "/"
|
urlPrefix = path.Join("file://", p) + "/"
|
||||||
|
log.WithFields("path", p).Info("looking for go module in filesystem")
|
||||||
fsys = os.DirFS(p)
|
fsys = os.DirFS(p)
|
||||||
}
|
}
|
||||||
if fsys != nil {
|
if fsys != nil {
|
||||||
@ -264,6 +265,7 @@ func getModuleProxy(proxy string, moduleName string, moduleVersion string) (modu
|
|||||||
u := fmt.Sprintf("%s/%s/@v/%s.zip", proxy, moduleName, moduleVersion)
|
u := fmt.Sprintf("%s/%s/@v/%s.zip", proxy, moduleName, moduleVersion)
|
||||||
|
|
||||||
// get the module zip
|
// get the module zip
|
||||||
|
log.WithFields("url", u).Info("downloading go module from proxy")
|
||||||
resp, err := http.Get(u) //nolint:gosec
|
resp, err := http.Get(u) //nolint:gosec
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
@ -334,6 +336,8 @@ func getModuleRepository(moduleName string, moduleVersion string) (string, fs.FS
|
|||||||
f := memfs.New()
|
f := memfs.New()
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
repoURL := fmt.Sprintf("https://%s", repoName)
|
repoURL := fmt.Sprintf("https://%s", repoName)
|
||||||
|
|
||||||
|
log.WithFields("repoURL", repoURL, "ref", cloneRefName).Info("cloning go module repository")
|
||||||
r, err := git.Clone(memory.NewStorage(), f, &git.CloneOptions{
|
r, err := git.Clone(memory.NewStorage(), f, &git.CloneOptions{
|
||||||
URL: repoURL,
|
URL: repoURL,
|
||||||
ReferenceName: cloneRefName,
|
ReferenceName: cloneRefName,
|
||||||
|
|||||||
@ -178,13 +178,13 @@ func formatNpmRegistryURL(baseURL, packageName, version string) (requestURL stri
|
|||||||
return requestURL, nil
|
return requestURL, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLicenseFromNpmRegistry(basURL, packageName, version string) (string, error) {
|
func getLicenseFromNpmRegistry(baseURL, packageName, version string) (string, error) {
|
||||||
// "https://registry.npmjs.org/%s/%s", packageName, version
|
// "https://registry.npmjs.org/%s/%s", packageName, version
|
||||||
requestURL, err := formatNpmRegistryURL(basURL, packageName, version)
|
requestURL, err := formatNpmRegistryURL(baseURL, packageName, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("unable to format npm request for pkg:version %s%s; %w", packageName, version, err)
|
return "", fmt.Errorf("unable to format npm request for pkg:version %s%s; %w", packageName, version, err)
|
||||||
}
|
}
|
||||||
log.Tracef("trying to fetch remote package %s", requestURL)
|
log.WithFields("url", requestURL).Info("downloading javascript package from npm")
|
||||||
|
|
||||||
npmRequest, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
npmRequest, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user