Compare commits

...
Author SHA1 Message Date
anchore-actions-token-generator[bot]andwillmurphyscode a8d4202d77 chore(deps): update stereoscope to aa3a3ef4efe8d8759c9aa87261b405cc003bfc9a (#3472)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: willmurphyscode <12529630+willmurphyscode@users.noreply.github.com>
2024-11-21 14:28:51 +00:00
dependabot[bot] 19a30b9fd2 chore(deps): bump github.com/charmbracelet/bubbletea from 1.2.2 to 1.2.3 (#3467)
Bumps [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/charmbracelet/bubbletea/releases)
- [Changelog](https://github.com/charmbracelet/bubbletea/blob/main/.goreleaser.yml)
- [Commits](https://github.com/charmbracelet/bubbletea/compare/v1.2.2...v1.2.3)

---
updated-dependencies:
- dependency-name: github.com/charmbracelet/bubbletea
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-20 08:32:30 -05:00
William Murphy e65fe243bf fix: bump clio to pull in logging fix (#3466)
Previously, if SYFT_LOG_FILE was not set, and no TTY was present,
log.Warn messages were discarded instead of being sent to stderr.

Signed-off-by: Will Murphy <willmurphyscode@users.noreply.github.com>
2024-11-19 14:56:53 -05:00
Christopher Angelo Phillips f4cad63da1 3122 valid license url characters (#3449)
* chore: strip unwanted characters from license URL
---------
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
2024-11-19 15:34:58 +00:00
Christopher Angelo Phillips e7b65c2c58 3030 license declared spdx correction (#3461)
* feat: update hasExtractedLicense field to include license-ref candidates
---------
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
2024-11-19 15:00:59 +00:00
anchore-actions-token-generator[bot]andspiffcs 8aef0c908a chore(deps): update tools to latest versions (#3463)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: spiffcs <32073428+spiffcs@users.noreply.github.com>
2024-11-19 09:36:46 -05:00
dependabot[bot] 35fa0cc454 chore(deps): bump github.com/jedib0t/go-pretty/v6 from 6.6.1 to 6.6.2 (#3465)
Bumps [github.com/jedib0t/go-pretty/v6](https://github.com/jedib0t/go-pretty) from 6.6.1 to 6.6.2.
- [Release notes](https://github.com/jedib0t/go-pretty/releases)
- [Commits](https://github.com/jedib0t/go-pretty/compare/v6.6.1...v6.6.2)

---
updated-dependencies:
- dependency-name: github.com/jedib0t/go-pretty/v6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-19 09:36:32 -05:00
dependabot[bot] 1c61e9cbff chore(deps): bump modernc.org/sqlite from 1.33.1 to 1.34.1 (#3460)
Bumps [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) from 1.33.1 to 1.34.1.
- [Commits](https://gitlab.com/cznic/sqlite/compare/v1.33.1...v1.34.1)

---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 09:33:08 -05:00
anchore-actions-token-generator[bot]andwagoodman d91150edea chore(deps): update CPE dictionary index (#3453)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: wagoodman <590471+wagoodman@users.noreply.github.com>
2024-11-18 08:33:41 -05:00
anchore-actions-token-generator[bot]andspiffcs 215ae2bbb9 chore(deps): update tools to latest versions (#3454)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: spiffcs <32073428+spiffcs@users.noreply.github.com>
2024-11-18 08:33:23 -05:00
anchore-actions-token-generator[bot]andspiffcs 93d90cb10a chore(deps): update tools to latest versions (#3448)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: spiffcs <32073428+spiffcs@users.noreply.github.com>
2024-11-17 12:32:11 -05:00
8 changed files with 208 additions and 26 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ tools:
# used to release all artifacts
- name: goreleaser
version:
want: v2.4.5
want: v2.4.7
method: github-release
with:
repo: goreleaser/goreleaser
@@ -127,7 +127,7 @@ tools:
# used to upload test fixture cache
- name: yq
version:
want: v4.44.3
want: v4.44.5
method: github-release
with:
repo: mikefarah/yq
+5 -5
View File
@@ -9,7 +9,7 @@ require (
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/acobaugh/osrelease v0.1.0
github.com/anchore/bubbly v0.0.0-20231115134915-def0aba654a9
github.com/anchore/clio v0.0.0-20241015191535-f538a9016e10
github.com/anchore/clio v0.0.0-20241115144204-29e89f9fa837
github.com/anchore/fangs v0.0.0-20241014201141-b6e4b3469f10
github.com/anchore/go-collections v0.0.0-20240216171411-9321230ce537
github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a
@@ -17,14 +17,14 @@ require (
github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04
github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b
github.com/anchore/packageurl-go v0.1.1-0.20241018175412-5c22e6360c4f
github.com/anchore/stereoscope v0.0.9-0.20241113211114-aa3a3ef4efe8
github.com/anchore/stereoscope v0.0.9
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be
// we are hinting brotli to latest due to warning when installing archiver v3:
// go: warning: github.com/andybalholm/brotli@v1.0.1: retracted by module author: occasional panics and data corruption
github.com/aquasecurity/go-pep440-version v0.0.0-20210121094942-22b2f8951d46
github.com/bmatcuk/doublestar/v4 v4.7.1
github.com/charmbracelet/bubbles v0.20.0
github.com/charmbracelet/bubbletea v1.2.2
github.com/charmbracelet/bubbletea v1.2.3
github.com/charmbracelet/lipgloss v1.0.0
github.com/dave/jennifer v1.7.1
github.com/deitch/magic v0.0.0-20230404182410-1ff89d7342da
@@ -46,7 +46,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/iancoleman/strcase v0.3.0
github.com/invopop/jsonschema v0.7.0
github.com/jedib0t/go-pretty/v6 v6.6.1
github.com/jedib0t/go-pretty/v6 v6.6.2
github.com/jinzhu/copier v0.4.0
github.com/kastenhq/goversion v0.0.0-20230811215019-93b2f8823953
github.com/knqyf263/go-rpmdb v0.1.1
@@ -81,7 +81,7 @@ require (
golang.org/x/mod v0.22.0
golang.org/x/net v0.31.0
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.33.1
modernc.org/sqlite v1.34.1
)
require google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
+10 -10
View File
@@ -97,8 +97,8 @@ github.com/anchore/archiver/v3 v3.5.2 h1:Bjemm2NzuRhmHy3m0lRe5tNoClB9A4zYyDV58Pa
github.com/anchore/archiver/v3 v3.5.2/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
github.com/anchore/bubbly v0.0.0-20231115134915-def0aba654a9 h1:p0ZIe0htYOX284Y4axJaGBvXHU0VCCzLN5Wf5XbKStU=
github.com/anchore/bubbly v0.0.0-20231115134915-def0aba654a9/go.mod h1:3ZsFB9tzW3vl4gEiUeuSOMDnwroWxIxJelOOHUp8dSw=
github.com/anchore/clio v0.0.0-20241015191535-f538a9016e10 h1:3xmanFdoQEH0REvPA+gLm3Km0/981F4z2a/7ADTlv8k=
github.com/anchore/clio v0.0.0-20241015191535-f538a9016e10/go.mod h1:h6Ly2hlKjQoPtI3rA8oB5afSmB/XimhcY55xbuW4Dwo=
github.com/anchore/clio v0.0.0-20241115144204-29e89f9fa837 h1:bIG3WsfosZsJ5LMC7PB9J/ekFM3a0j0ZEDvN3ID6GTI=
github.com/anchore/clio v0.0.0-20241115144204-29e89f9fa837/go.mod h1:tRQVKkjYeejrh9AdM0s1esbwtMU7rdHAHSQWkv4qskE=
github.com/anchore/fangs v0.0.0-20241014201141-b6e4b3469f10 h1:w+HibE+e/heP6ysADh7sWxg5LhYdVqrpB1A4Hmgjyx8=
github.com/anchore/fangs v0.0.0-20241014201141-b6e4b3469f10/go.mod h1:s0L1//Sxn6Rq0Dcxx+dmT/RRmD9HhsaJjJkPUJHLJLM=
github.com/anchore/go-collections v0.0.0-20240216171411-9321230ce537 h1:GjNGuwK5jWjJMyVppBjYS54eOiiSNv4Ba869k4wh72Q=
@@ -115,8 +115,8 @@ github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b h1:e1bmaoJfZV
github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b/go.mod h1:Bkc+JYWjMCF8OyZ340IMSIi2Ebf3uwByOk6ho4wne1E=
github.com/anchore/packageurl-go v0.1.1-0.20241018175412-5c22e6360c4f h1:dAQPIrQ3a5PBqZeZ+B9NGZsGmodk4NO9OjDIsQmQyQM=
github.com/anchore/packageurl-go v0.1.1-0.20241018175412-5c22e6360c4f/go.mod h1:KoYIv7tdP5+CC9VGkeZV4/vGCKsY55VvoG+5dadg4YI=
github.com/anchore/stereoscope v0.0.9-0.20241113211114-aa3a3ef4efe8 h1:gYed/fx5OeW+isRay2q60JGt8+ED/odEPiJ/SWlbw8s=
github.com/anchore/stereoscope v0.0.9-0.20241113211114-aa3a3ef4efe8/go.mod h1:c2oGDU0R+llJObsatBSenjYPV1raKhMq9GEqe8J56EI=
github.com/anchore/stereoscope v0.0.9 h1:rLhYWe/CXhDq/UCUWQ3U5xtpGk4RFnssKaM0bHhs5us=
github.com/anchore/stereoscope v0.0.9/go.mod h1:c2oGDU0R+llJObsatBSenjYPV1raKhMq9GEqe8J56EI=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
@@ -158,8 +158,8 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
github.com/charmbracelet/bubbletea v1.2.2 h1:EMz//Ky/aFS2uLcKqpCst5UOE6z5CFDGRsUpyXz0chs=
github.com/charmbracelet/bubbletea v1.2.2/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM=
github.com/charmbracelet/bubbletea v1.2.3 h1:d9MdMsANIYZB5pE1KkRqaUV6GfsiWm+/9z4fTuGVm9I=
github.com/charmbracelet/bubbletea v1.2.3/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg=
@@ -481,8 +481,8 @@ github.com/invopop/jsonschema v0.7.0 h1:2vgQcBz1n256N+FpX3Jq7Y17AjYt46Ig3zIWyy77
github.com/invopop/jsonschema v0.7.0/go.mod h1:O9uiLokuu0+MGFlyiaqtWxwqJm41/+8Nj0lD7A36YH0=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jedib0t/go-pretty/v6 v6.6.1 h1:iJ65Xjb680rHcikRj6DSIbzCex2huitmc7bDtxYVWyc=
github.com/jedib0t/go-pretty/v6 v6.6.1/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jedib0t/go-pretty/v6 v6.6.2 h1:27bLj3nRODzaiA7tPIxy9UVWHoPspFfME9XxgwiiNsM=
github.com/jedib0t/go-pretty/v6 v6.6.2/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -1351,8 +1351,8 @@ modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
modernc.org/sqlite v1.33.1 h1:trb6Z3YYoeM9eDL1O8do81kP+0ejv+YzgyFo+Gwy0nM=
modernc.org/sqlite v1.33.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
modernc.org/sqlite v1.34.1 h1:u3Yi6M0N8t9yKRDwhXcyp1eS5/ErhPTBggxWFuR6Hfk=
modernc.org/sqlite v1.34.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
@@ -5,6 +5,7 @@ import (
"crypto/sha1"
"fmt"
"path"
"regexp"
"slices"
"sort"
"strings"
@@ -713,8 +714,8 @@ func toFileTypes(metadata *file.Metadata) (ty []string) {
return ty
}
// other licenses are for licenses from the pkg.Package that do not have an SPDXExpression
// field. The spdxexpression field is only filled given a validated Value field.
// other licenses are for licenses from the pkg.Package that do not have a valid SPDX Expression
// OR are an expression that is a single `License-Ref-*`
func toOtherLicenses(catalog *pkg.Collection) []*spdx.OtherLicense {
licenses := map[string]helpers.SPDXLicense{}
@@ -724,11 +725,17 @@ func toOtherLicenses(catalog *pkg.Collection) []*spdx.OtherLicense {
if l.Value != "" {
licenses[l.ID] = l
}
if l.ID != "" && isLicenseRef(l.ID) {
licenses[l.ID] = l
}
}
for _, l := range concludedLicenses {
if l.Value != "" {
licenses[l.ID] = l
}
if l.ID != "" && isLicenseRef(l.ID) {
licenses[l.ID] = l
}
}
}
@@ -742,14 +749,27 @@ func toOtherLicenses(catalog *pkg.Collection) []*spdx.OtherLicense {
slices.Sort(ids)
for _, id := range ids {
license := licenses[id]
value := license.Value
// handle cases where LicenseRef needs to be included in hasExtractedLicensingInfos
if license.Value == "" {
value, _ = strings.CutPrefix(license.ID, "LicenseRef-")
}
result = append(result, &spdx.OtherLicense{
LicenseIdentifier: license.ID,
ExtractedText: license.Value,
ExtractedText: value,
})
}
return result
}
var licenseRefRegEx = regexp.MustCompile(`^LicenseRef-[A-Za-z0-9_-]+$`)
// isSingularLicenseRef checks if the string is a singular LicenseRef-* identifier
func isLicenseRef(s string) bool {
// Match the input string against the regex
return licenseRefRegEx.MatchString(s)
}
// TODO: handle SPDX excludes file case
// f file is an "excludes" file, skip it /* exclude SPDX analysis file(s) */
// see: https://spdx.github.io/spdx-spec/v2.3/package-information/#79-package-verification-code-field
@@ -753,6 +753,29 @@ func Test_OtherLicenses(t *testing.T) {
},
},
},
{
name: "LicenseRef as a valid spdx expression",
pkg: pkg.Package{
Licenses: pkg.NewLicenseSet(
pkg.NewLicense("LicenseRef-Fedora-Public-Domain"),
),
},
expected: []*spdx.OtherLicense{
{
LicenseIdentifier: "LicenseRef-Fedora-Public-Domain",
ExtractedText: "Fedora-Public-Domain",
},
},
},
{
name: "LicenseRef as a valid spdx expression does not otherize compound spdx expressions",
pkg: pkg.Package{
Licenses: pkg.NewLicenseSet(
pkg.NewLicense("(MIT AND LicenseRef-Fedora-Public-Domain)"),
),
},
expected: nil,
},
}
for _, test := range tests {
@@ -7046,6 +7046,9 @@
"a2-optimized-wp": [
"cpe:2.3:a:a2hosting:a2_optimized:*:*:*:*:*:wordpress:*:*"
],
"a4-barcode-generator": [
"cpe:2.3:a:ukrsolution:print_labels_with_barcodes:*:*:*:*:*:wordpress:*:*"
],
"aajoda-testimonials": [
"cpe:2.3:a:aajoda:aajoda_testimonials:*:*:*:*:*:wordpress:*:*"
],
@@ -7527,6 +7530,9 @@
"all-bootstrap-blocks": [
"cpe:2.3:a:areoi:all_bootstrap_blocks:*:*:*:*:*:wordpress:*:*"
],
"all-contact-form-integration-for-elementor": [
"cpe:2.3:a:theinnovs:eleforms:*:*:*:*:*:wordpress:*:*"
],
"all-in-one-favicon": [
"cpe:2.3:a:techotronic:all_in_one_favicon:*:*:*:*:*:wordpress:*:*"
],
@@ -7746,6 +7752,9 @@
"aprils-super-functions-pack": [
"cpe:2.3:a:april\\'s_super_functions_pack_project:april\\'s_super_functions_pack:*:*:*:*:*:wordpress:*:*"
],
"ar-for-wordpress": [
"cpe:2.3:a:webandprint:ar:*:*:*:*:*:wordpress:*:*"
],
"archivist-custom-archive-templates": [
"cpe:2.3:a:archivist_-_custom_archive_templates_project:archivist_-_custom_archive_templates:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:ericteubert:archivist_-_custom_archive_templates:*:*:*:*:*:wordpress:*:*"
@@ -8076,6 +8085,9 @@
"cpe:2.3:a:web-x:be-popia-compliant:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:web-x:be_popia_compliant:*:*:*:*:*:wordpress:*:*"
],
"beam-me-up-scotty": [
"cpe:2.3:a:outtheboxthemes:beam_me_up_scotty:*:*:*:*:*:wordpress:*:*"
],
"beautiful-and-responsive-cookie-consent": [
"cpe:2.3:a:beautiful-cookie-banner:beautiful_cookie_consent_banner:*:*:*:*:*:wordpress:*:*"
],
@@ -8505,7 +8517,7 @@
],
"cafe-lite": [
"cpe:2.3:a:clever-soft:clever_addons_for_elementor:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:cleversoft:clever_addons_for_elementor:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:cleversoft:clever_addons_for_elementor:*:*:*:*:lite:wordpress:*:*",
"cpe:2.3:a:download_clever_addons_for_elementor_project:download_clever_addons_for_elementor:*:*:*:*:*:wordpress:*:*"
],
"calculated-fields-form": [
@@ -9336,6 +9348,9 @@
"crelly-slider": [
"cpe:2.3:a:crelly_slider_project:crelly_slider:*:*:*:*:*:wordpress:*:*"
],
"cresta-addons-for-elementor": [
"cpe:2.3:a:crestaproject:cresta_addons_for_elementor:*:*:*:*:*:wordpress:*:*"
],
"crisp": [
"cpe:2.3:a:crisp:live_chat:*:*:*:*:*:wordpress:*:*"
],
@@ -9410,6 +9425,9 @@
"cube-slider": [
"cpe:2.3:a:webpsilon:cube_slider:*:*:*:*:*:wordpress:*:*"
],
"cubewp-framework": [
"cpe:2.3:a:cubewp:cubewp:*:*:*:*:*:wordpress:*:*"
],
"curatorio": [
"cpe:2.3:a:curator:curator.io:*:*:*:*:*:wordpress:*:*"
],
@@ -9977,6 +9995,7 @@
"cpe:2.3:a:easysocialfeed:easy_social_feed:*:*:*:*:free:wordpress:*:*"
],
"easy-fancybox": [
"cpe:2.3:a:firelightwp:firelight_lightbox:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:status301:easy_fancybox:*:*:*:*:*:wordpress:*:*"
],
"easy-faq-with-expanding-text": [
@@ -10010,6 +10029,9 @@
"easy-paypal-donation": [
"cpe:2.3:a:wpplugin:accept_donations_with_paypal:*:*:*:*:*:wordpress:*:*"
],
"easy-paypal-events-tickets": [
"cpe:2.3:a:wpplugin:easy_paypal_events:*:*:*:*:*:wordpress:*:*"
],
"easy-pdf-restaurant-menu-upload": [
"cpe:2.3:a:easy_pdf_restaurant_menu_upload_project:easy_pdf_restaurant_menu_upload:*:*:*:*:*:wordpress:*:*"
],
@@ -10284,6 +10306,9 @@
"envira-gallery-lite": [
"cpe:2.3:a:enviragallery:envira_gallery:*:*:*:*:lite:wordpress:*:*"
],
"envo-elementor-for-woocommerce": [
"cpe:2.3:a:envothemes:envo\\'s_elementor_templates_\\\u0026_widgets_for_woocommerce:*:*:*:*:*:wordpress:*:*"
],
"envo-extra": [
"cpe:2.3:a:envothemes:envo_extra:*:*:*:*:*:wordpress:*:*"
],
@@ -11427,6 +11452,7 @@
"cpe:2.3:a:handsome_testimonials_\\\u0026_reviews_project:handsome_testimonials_\\\u0026_reviews:*:*:*:*:*:wordpress:*:*"
],
"happy-elementor-addons": [
"cpe:2.3:a:leevio:happy_addons_for_elementor:*:*:*:*:free:wordpress:*:*",
"cpe:2.3:a:wedevs:happy_addons_for_elementor:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:wedevs:happy_addons_for_elementor:*:*:*:*:-:wordpress:*:*"
],
@@ -11455,7 +11481,8 @@
"cpe:2.3:a:draftpress:header_footer_code_manager:*:*:*:*:*:wordpress:*:*"
],
"header-footer-elementor": [
"cpe:2.3:a:brainstormforce:elementor_-_header\\,_footer_\\\u0026_blocks_template:*:*:*:*:*:wordpress:*:*"
"cpe:2.3:a:brainstormforce:elementor_-_header\\,_footer_\\\u0026_blocks_template:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:brainstormforce:elementor_header_\\\u0026_footer_builder:*:*:*:*:*:wordpress:*:*"
],
"heat-trackr": [
"cpe:2.3:a:heat-trackr_project:heat-trackr:*:*:*:*:*:wordpress:*:*"
@@ -12422,6 +12449,9 @@
"loco-translate": [
"cpe:2.3:a:loco_translate_project:loco_translate:*:*:*:*:*:wordpress:*:*"
],
"loggedin": [
"cpe:2.3:a:duckdev:loggedin:*:*:*:*:*:wordpress:*:*"
],
"login-as-customer-or-user": [
"cpe:2.3:a:wp-buy:login_as_user_or_customer_\\(user_switching\\):*:*:*:*:*:wordpress:*:*"
],
@@ -13394,6 +13424,9 @@
"olive-one-click-demo-import": [
"cpe:2.3:a:olivethemes:olive_one_click_demo_import:*:*:*:*:*:wordpress:*:*"
],
"olympus-google-fonts": [
"cpe:2.3:a:fontsplugin:fonts:*:*:*:*:*:wordpress:*:*"
],
"omnisend-connect": [
"cpe:2.3:a:omnisend:email_marketing_for_woocommerce:*:*:*:*:*:wordpress:*:*"
],
@@ -13507,6 +13540,7 @@
"cpe:2.3:a:webtoffee:order_export_\\\u0026_order_import_for_woocommerce:*:*:*:*:*:wordpress:*:*"
],
"order-tracking": [
"cpe:2.3:a:etoilewebdesign:order_tracking:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:etoilewebdesign:order_tracking:*:*:*:*:pro:wordpress:*:*"
],
"organization-chart": [
@@ -13670,6 +13704,9 @@
"pdf-embedder": [
"cpe:2.3:a:wp-pdf:pdf_embedder:*:*:*:*:*:wordpress:*:*"
],
"pdf-generator-addon-for-elementor-page-builder": [
"cpe:2.3:a:redefiningtheweb:pdf_generator_addon_for_elementor_page_builder:*:*:*:*:*:wordpress:*:*"
],
"pdf-generator-for-wp": [
"cpe:2.3:a:wpswings:pdf_generator_for_wordpress:*:*:*:*:*:wordpress:*:*"
],
@@ -14338,6 +14375,9 @@
"querlo-chatbots": [
"cpe:2.3:a:querlo:chatbot:*:*:*:*:*:wordpress:*:*"
],
"quick-adsense-reloaded": [
"cpe:2.3:a:wpquads:ads:*:*:*:*:*:wordpress:*:*"
],
"quick-chat": [
"cpe:2.3:a:quick_chat_project:quick_chat:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:techytalk:quick_chat:*:*:*:*:*:wordpress:*:*"
@@ -15132,6 +15172,9 @@
"shortpixel-adaptive-images": [
"cpe:2.3:a:shortpixel:shortpixel_adaptive_images:*:*:*:*:*:wordpress:*:*"
],
"shortpixel-image-optimiser": [
"cpe:2.3:a:shortpixel:image_optimizer:*:*:*:*:*:wordpress:*:*"
],
"show-all-comments-in-one-page": [
"cpe:2.3:a:appjetty:show_all_comments:*:*:*:*:*:wordpress:*:*"
],
@@ -15938,7 +15981,7 @@
"cpe:2.3:a:subscribe_to_category_project:subscribe_to_category:*:*:*:*:*:wordpress:*:*"
],
"subscribe-to-comments": [
"cpe:2.3:a:subscribe_to_comments_project:subscribe_to_comments:*:*:*:*:*:wordpress:*:*"
"cpe:2.3:a:markjaquith:subscribe_to_comments:*:*:*:*:*:wordpress:*:*"
],
"subscribe-to-comments-reloaded": [
"cpe:2.3:a:wpkube:subscribe_to_comments_reloaded:*:*:*:*:*:wordpress:*:*"
@@ -16265,6 +16308,10 @@
"tickera-event-ticketing-system": [
"cpe:2.3:a:tickera:tickera:*:*:*:*:*:wordpress:*:*"
],
"time-clock": [
"cpe:2.3:a:wpplugin:time_clock:*:*:*:*:-:wordpress:*:*",
"cpe:2.3:a:wpplugin:time_clock:*:*:*:*:pro:wordpress:*:*"
],
"time-sheets": [
"cpe:2.3:a:dcac:time_sheets:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:time_sheets_project:time_sheets:*:*:*:*:*:wordpress:*:*"
@@ -16281,6 +16328,9 @@
"timesheet": [
"cpe:2.3:a:bestwebsoft:timesheet:*:*:*:*:*:wordpress:*:*"
],
"timetics": [
"cpe:2.3:a:arraytics:wp_timetics:*:*:*:*:*:wordpress:*:*"
],
"timthumb-vulnerability-scanner": [
"cpe:2.3:a:peterbutler:timthumb_vulnerability_scanner:*:*:*:*:*:wordpress:*:*"
],
@@ -16400,6 +16450,9 @@
"tubepress": [
"cpe:2.3:a:tubepress:tubepress:*:*:*:*:*:wordpress:*:*"
],
"tumult-hype-animations": [
"cpe:2.3:a:tumult:tumult_hype_animations:*:*:*:*:*:wordpress:*:*"
],
"tune-library": [
"cpe:2.3:a:tune_library_project:tune_library:*:*:*:*:*:wordpress:*:*"
],
@@ -16796,6 +16849,9 @@
"video-thumbnails": [
"cpe:2.3:a:video_thumbnails_project:video_thumbnails:*:*:*:*:*:wordpress:*:*"
],
"video-wc-gallery": [
"cpe:2.3:a:martinvalchev:video_gallery_for_woocommerce:*:*:*:*:*:wordpress:*:*"
],
"video-widget": [
"cpe:2.3:a:nikodev:video_widget:*:*:*:*:*:wordpress:*:*"
],
@@ -17236,6 +17292,9 @@
"woo-esto": [
"cpe:2.3:a:rebing:woocommerce_esto:*:*:*:*:*:wordpress:*:*"
],
"woo-floating-cart-lite": [
"cpe:2.3:a:xplodedthemes:xt_floating_cart_for_woocommerce:*:*:*:*:*:wordpress:*:*"
],
"woo-gift-cards-lite": [
"cpe:2.3:a:wpswings:ultimate_gift_cards_for_woocommerce:*:*:*:*:*:wordpress:*:*"
],
@@ -17317,6 +17376,9 @@
"woo-thank-you-page-nextmove-lite": [
"cpe:2.3:a:xlplugins:nextmove:*:*:*:*:lite:wordpress:*:*"
],
"woo-tools": [
"cpe:2.3:a:themefarmer:woocommerce_tools:*:*:*:*:*:wordpress:*:*"
],
"woo-tranzila-gateway": [
"cpe:2.3:a:antonbond:woocommerce_tranzila_payment_gateway:*:*:*:*:*:wordpress:*:*"
],
@@ -17553,6 +17615,9 @@
"wp-404-auto-redirect-to-similar-post": [
"cpe:2.3:a:hwk:wp_404_auto_redirect_to_similar_post:*:*:*:*:*:wordpress:*:*"
],
"wp-abstracts-manuscripts-manager": [
"cpe:2.3:a:kevonadonis:wp_abstracts:*:*:*:*:free:wordpress:*:*"
],
"wp-academic-people": [
"cpe:2.3:a:wp_academic_people_list_project:wp_academic_people_list:*:*:*:*:*:wordpress:*:*"
],
@@ -17587,7 +17652,8 @@
"cpe:2.3:a:wp-appbox_project:wp-appbox:*:*:*:*:*:wordpress:*:*"
],
"wp-asset-clean-up": [
"cpe:2.3:a:asset_cleanup\\:_page_speed_booster_project:asset_cleanup\\:_page_speed_booster:*:*:*:*:*:wordpress:*:*"
"cpe:2.3:a:asset_cleanup\\:_page_speed_booster_project:asset_cleanup\\:_page_speed_booster:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:gabelivan:asset_cleanup:*:*:*:*:*:wordpress:*:*"
],
"wp-athletics": [
"cpe:2.3:a:wp_athletics_project:wp_athletics:*:*:*:*:*:wordpress:*:*"
@@ -17818,6 +17884,9 @@
"wp-database-backup": [
"cpe:2.3:a:wpseeds:wp_database_backup:*:*:*:*:*:wordpress:*:*"
],
"wp-datepicker": [
"cpe:2.3:a:androidbubbles:wp_datepicker:*:*:*:*:*:wordpress:*:*"
],
"wp-db-backup": [
"cpe:2.3:a:deliciousbrains:database_backup:*:*:*:*:*:wordpress:*:*",
"cpe:2.3:a:wp-db-backup_project:wp-db-backup:*:*:*:*:*:wordpress:*:*"
@@ -19338,6 +19407,9 @@
"bingle": [
"cpe:2.3:a:accesspressthemes:bingle:*:*:*:*:*:wordpress:*:*"
],
"blockbooster": [
"cpe:2.3:a:cozythemes:blockbooster:*:*:*:*:*:wordpress:*:*"
],
"blocksy": [
"cpe:2.3:a:creativethemes:blocksy:*:*:*:*:*:wordpress:*:*"
],
@@ -19415,6 +19487,9 @@
"formula": [
"cpe:2.3:a:awplife:formula:*:*:*:*:free:wordpress:*:*"
],
"fotawp": [
"cpe:2.3:a:cozythemes:fotawp:*:*:*:*:*:wordpress:*:*"
],
"fullbase": [
"cpe:2.3:a:marchettidesign:fullbase:*:*:*:*:*:wordpress:*:*"
],
@@ -19431,6 +19506,9 @@
"grey-opaque": [
"cpe:2.3:a:grey_opaque_project:grey_opaque:*:*:*:*:*:wordpress:*:*"
],
"hello-agency": [
"cpe:2.3:a:cozythemes:hello_agency:*:*:*:*:*:wordpress:*:*"
],
"hotel-galaxy": [
"cpe:2.3:a:webdzier:hotel_galaxy:*:*:*:*:*:wordpress:*:*"
],
@@ -19526,6 +19604,9 @@
"responsive": [
"cpe:2.3:a:cyberchimps:responsive:*:*:*:*:*:wordpress:*:*"
],
"revivenews": [
"cpe:2.3:a:cozythemes:revivenews:*:*:*:*:*:wordpress:*:*"
],
"rife-free": [
"cpe:2.3:a:apollo13themes:rife_free:*:*:*:*:*:wordpress:*:*"
],
+24 -2
View File
@@ -2,7 +2,9 @@ package pkg
import (
"fmt"
"net/url"
"sort"
"strings"
"github.com/scylladb/go-set/strset"
@@ -112,7 +114,12 @@ func NewLicenseFromURLs(value string, urls ...string) License {
s := strset.New()
for _, url := range urls {
if url != "" {
s.Add(url)
sanitizedURL, err := stripUnwantedCharacters(url)
if err != nil {
log.Tracef("unable to sanitize url=%q: %s", url, err)
continue
}
s.Add(sanitizedURL)
}
}
@@ -122,13 +129,28 @@ func NewLicenseFromURLs(value string, urls ...string) License {
return l
}
func stripUnwantedCharacters(rawURL string) (string, error) {
cleanedURL := strings.TrimSpace(rawURL)
_, err := url.ParseRequestURI(cleanedURL)
if err != nil {
return "", fmt.Errorf("invalid URL: %w", err)
}
return cleanedURL, nil
}
func NewLicenseFromFields(value, url string, location *file.Location) License {
l := NewLicense(value)
if location != nil {
l.Locations.Add(*location)
}
if url != "" {
l.URLs = append(l.URLs, url)
sanitizedURL, err := stripUnwantedCharacters(url)
if err != nil {
log.Tracef("unable to sanitize url=%q: %s", url, err)
} else {
l.URLs = append(l.URLs, sanitizedURL)
}
}
return l
+36
View File
@@ -226,3 +226,39 @@ func TestLicense_Merge(t *testing.T) {
})
}
}
func TestLicenseConstructors(t *testing.T) {
type input struct {
value string
urls []string
}
tests := []struct {
name string
input input
expected License
}{
{
name: "License URLs are stripped of newlines and tabs",
input: input{
value: "New BSD License",
urls: []string{
`
http://user-agent-utils.googlecode.com/svn/trunk/UserAgentUtils/LICENSE.txt
`},
},
expected: License{
Value: "New BSD License",
Type: license.Declared,
URLs: []string{"http://user-agent-utils.googlecode.com/svn/trunk/UserAgentUtils/LICENSE.txt"},
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
got := NewLicenseFromURLs(test.input.value, test.input.urls...)
assert.Equal(t, test.expected, got)
})
}
}