diff --git a/apollo/rherrata/BUILD.bazel b/apollo/rherrata/BUILD.bazel
deleted file mode 100644
index af10f137..00000000
--- a/apollo/rherrata/BUILD.bazel
+++ /dev/null
@@ -1,30 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
-
-go_library(
- name = "rherrata",
- srcs = [
- "api.go",
- "compact_errata.go",
- "errata.go",
- "mock.go",
- ],
- importpath = "peridot.resf.org/apollo/rherrata",
- visibility = ["//visibility:public"],
- deps = [
- "//apollo/proto/v1:pb",
- "//vendor/github.com/PuerkitoBio/goquery",
- "//vendor/github.com/go-chi/chi",
- "//vendor/github.com/gocolly/colly/v2:colly",
- ],
-)
-
-go_test(
- name = "rherrata_test",
- srcs = ["errata_test.go"],
- data = glob(["testdata/**"]),
- embed = [":rherrata"],
- deps = [
- "//apollo/proto/v1:pb",
- "//vendor/github.com/stretchr/testify/require",
- ],
-)
diff --git a/apollo/rherrata/api.go b/apollo/rherrata/api.go
deleted file mode 100644
index 4f638a1f..00000000
--- a/apollo/rherrata/api.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
-// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
-// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors
-// may be used to endorse or promote products derived from this software without
-// specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-package rherrata
-
-import (
- "io"
- "net/http"
- "time"
-)
-
-type APIService interface {
- GetErrata(advisory string) (*Errata, error)
- GetAdvisories(currentVersion string, after *time.Time) ([]*CompactErrata, error)
-}
-
-// API is the APIService implementation. Should not be used directly
-type API struct {
- client *http.Client
- userAgent string
- baseURLErrata string
- baseURLAPI string
-}
-
-func NewClient() *API {
- return &API{
- client: &http.Client{
- Timeout: 30 * time.Second,
- },
- userAgent: "apollo/rherrata/0.2",
- baseURLErrata: "https://access.redhat.com/errata",
- baseURLAPI: "https://access.redhat.com/hydra/rest/search/kcs",
- }
-}
-
-func (a *API) newRequest(method string, url string, body io.Reader) (*http.Request, error) {
- req, err := http.NewRequest(method, url, body)
- if err != nil {
- return nil, err
- }
-
- req.Header.Set("User-Agent", a.userAgent)
-
- return req, nil
-}
diff --git a/apollo/rherrata/compact_errata.go b/apollo/rherrata/compact_errata.go
deleted file mode 100644
index 4e7a959f..00000000
--- a/apollo/rherrata/compact_errata.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
-// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
-// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors
-// may be used to endorse or promote products derived from this software without
-// specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-package rherrata
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
- "strings"
- "time"
-)
-
-var internalAfterDates = map[string]string{
- "8.4": "2021-04-29T00:00:00Z",
- "9.0": "2022-05-17T00:00:00Z",
-}
-
-type CompactErrata struct {
- Name string `json:"id"`
- Description string `json:"portal_description"`
- Synopsis string `json:"portal_synopsis"`
- Severity string `json:"portal_severity"`
- Type string `json:"portal_advisory_type"`
- AffectedPackages []string `json:"portal_package"`
- CVEs []string `json:"portal_CVE"`
- Fixes []string `json:"portal_BZ"`
- PublicationDate string `json:"portal_publication_date"`
-}
-
-type internalAdvisoriesInnerResponse struct {
- Docs []*CompactErrata `json:"docs"`
-}
-
-type internalAdvisoriesResponse struct {
- Response *internalAdvisoriesInnerResponse `json:"response"`
-}
-
-func (a *API) GetAdvisories(currentVersion string, after *time.Time) ([]*CompactErrata, error) {
- req, err := a.newRequest("GET", a.baseURLAPI, nil)
- if err != nil {
- return nil, err
- }
-
- fq1 := "documentKind:(%22Errata%22)"
- usableVersion := strings.Replace(currentVersion, ".", "%5C.", -1)
- fq2 := fmt.Sprintf("portal_product_filter:Red%%5C+Hat%%5C+Enterprise%%5C+Linux%%7C*%%7C%s%%7C*", usableVersion)
- var fq3 string
- if after != nil {
- fq3 = "&fq=" + url.QueryEscape(fmt.Sprintf("portal_publication_date:[%s TO NOW]", after.Format(time.RFC3339)))
- } else if afterDate := internalAfterDates[currentVersion]; afterDate != "" {
- fq3 = "&fq=" + url.QueryEscape(fmt.Sprintf("portal_publication_date:[%s TO NOW]", afterDate))
- }
- req.URL.RawQuery = fmt.Sprintf("fq=%s&fq=%s%s&q=*:*&rows=10000&sort=portal_publication_date+desc&start=0", fq1, fq2, fq3)
-
- req.Header.Set("Accept", "application/json")
-
- res, err := a.client.Do(req)
- if err != nil {
- return nil, err
- }
- defer res.Body.Close()
-
- var marshalBody internalAdvisoriesResponse
- err = json.NewDecoder(res.Body).Decode(&marshalBody)
- if err != nil {
- return nil, err
- }
-
- return marshalBody.Response.Docs, nil
-}
diff --git a/apollo/rherrata/errata.go b/apollo/rherrata/errata.go
deleted file mode 100644
index 7269d5d4..00000000
--- a/apollo/rherrata/errata.go
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
-// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
-// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors
-// may be used to endorse or promote products derived from this software without
-// specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-package rherrata
-
-import (
- "errors"
- "fmt"
- "github.com/PuerkitoBio/goquery"
- "github.com/gocolly/colly/v2"
- apollopb "peridot.resf.org/apollo/pb"
- "strings"
- "time"
-)
-
-type Architecture string
-
-const (
- ArchX8664 Architecture = "x86_64"
- ArchAArch64 Architecture = "aarch64"
- ArchPPC64 Architecture = "ppc64le"
- ArchS390X Architecture = "s390x"
- ArchNoArch Architecture = "noarch"
-)
-
-type Fix struct {
- BugzillaID string
- Description string
-}
-
-type UpdatedPackages struct {
- SRPMs []string
- Packages map[Architecture][]string
-}
-
-type Errata struct {
- Synopsis string
- Type apollopb.Advisory_Type
- Severity apollopb.Advisory_Severity
- Topic []string
- Description []string
- Solution []string
- AffectedProducts map[string]*UpdatedPackages
- Fixes []*Fix
- CVEs []string
- References []string
- IssuedAt time.Time
-}
-
-func (a *API) GetErrata(advisory string) (*Errata, error) {
- var err error
- var errata Errata
- c := colly.NewCollector(colly.UserAgent(a.userAgent))
-
- // Do not fix this typo. It is like this on Red Hat's website
- c.OnHTML("div#synpopsis", func(element *colly.HTMLElement) {
- errata.Synopsis = element.DOM.Find("p").Text()
- })
- c.OnHTML("div#topic > p", func(element *colly.HTMLElement) {
- errata.Topic = append(errata.Topic, element.Text)
- })
- c.OnHTML("div#solution > p", func(element *colly.HTMLElement) {
- errata.Solution = append(errata.Solution, element.Text)
- })
- c.OnHTML("div#fixes > ul > li", func(element *colly.HTMLElement) {
- fixComponents := strings.SplitN(element.Text, "-", 3)
- if len(fixComponents) != 3 {
- return
- }
-
- for i, comp := range fixComponents {
- fixComponents[i] = strings.TrimSpace(comp)
- }
-
- fix := &Fix{
- BugzillaID: fixComponents[1],
- Description: fixComponents[2],
- }
- errata.Fixes = append(errata.Fixes, fix)
- })
- c.OnHTML("div#cves > ul > li", func(element *colly.HTMLElement) {
- errata.CVEs = append(errata.CVEs, strings.TrimSpace(element.Text))
- })
- c.OnHTML("div#references > ul > li", func(element *colly.HTMLElement) {
- errata.References = append(errata.References, strings.TrimSpace(element.Text))
- })
- c.OnHTML("dl.details", func(element *colly.HTMLElement) {
- issuedAt, err := time.Parse("2006-01-02", element.DOM.Find("dd").First().Text())
- if err == nil {
- errata.IssuedAt = issuedAt
- }
- })
- c.OnHTML("div#packages", func(element *colly.HTMLElement) {
- productIndex := map[int]string{}
- products := map[string]*UpdatedPackages{}
- element.DOM.Find("h2").Each(func(i int, selection *goquery.Selection) {
- productIndex[i] = selection.Text()
- products[selection.Text()] = &UpdatedPackages{}
- })
-
- element.DOM.Find("table.files").Each(func(i int, selection *goquery.Selection) {
- productUpdate := products[productIndex[i]]
- if productUpdate.Packages == nil {
- productUpdate.Packages = map[Architecture][]string{}
- }
-
- selection.Find("td.name").Each(func(_ int, selection *goquery.Selection) {
- name := strings.TrimSpace(selection.Text())
- isRpm := strings.HasSuffix(name, ".rpm")
- isSrcRpm := strings.HasSuffix(name, ".src.rpm")
- if isRpm {
- if isSrcRpm {
- productUpdate.SRPMs = append(productUpdate.SRPMs, name)
- } else {
- var arch Architecture
- if strings.Contains(name, ".x86_64") || strings.Contains(name, ".i686") {
- arch = ArchX8664
- } else if strings.Contains(name, ".aarch64") {
- arch = ArchAArch64
- } else if strings.Contains(name, ".ppc64le") {
- arch = ArchPPC64
- } else if strings.Contains(name, ".s390x") {
- arch = ArchS390X
- } else if strings.Contains(name, ".noarch") {
- arch = ArchNoArch
- }
-
- if productUpdate.Packages[arch] == nil {
- productUpdate.Packages[arch] = []string{}
- }
- productUpdate.Packages[arch] = append(productUpdate.Packages[arch], name)
- }
- }
- })
-
- errata.AffectedProducts = products
- })
- })
- c.OnHTML("div#description > p", func(element *colly.HTMLElement) {
- htmlText, err := element.DOM.Html()
- if err != nil {
- return
- }
- htmlText = strings.TrimSuffix(htmlText, "
")
-
- if element.Text == "Security Fix(es):" || element.Text == "Bug Fix(es) and Enhancement(s):" || element.Text == "Bug Fix(es):" || element.Text == "Enhancement(s):" {
- return
- }
- errata.Description = append(errata.Description, strings.Split(htmlText, "
")...)
- })
- c.OnHTML("div#type-severity", func(element *colly.HTMLElement) {
- typeSeverity := strings.Split(element.DOM.Find("p").Text(), ":")
- if typeSeverity[0] == "Product Enhancement Advisory" {
- errata.Type = apollopb.Advisory_TYPE_ENHANCEMENT
- } else if typeSeverity[0] == "Bug Fix Advisory" {
- errata.Type = apollopb.Advisory_TYPE_BUGFIX
- } else {
- if len(typeSeverity) != 2 {
- err = errors.New("invalid type/severity")
- return
- }
-
- typeSplit := strings.Split(typeSeverity[0], " ")
- if len(typeSplit) != 2 {
- err = errors.New("invalid type")
- return
- }
-
- switch strings.TrimSpace(typeSplit[0]) {
- case "Security":
- errata.Type = apollopb.Advisory_TYPE_SECURITY
- break
- case "BugFix":
- errata.Type = apollopb.Advisory_TYPE_BUGFIX
- break
- case "Enhancement":
- errata.Type = apollopb.Advisory_TYPE_ENHANCEMENT
- break
- }
-
- switch strings.TrimSpace(typeSeverity[1]) {
- case "Low":
- errata.Severity = apollopb.Advisory_SEVERITY_LOW
- break
- case "Moderate":
- errata.Severity = apollopb.Advisory_SEVERITY_MODERATE
- break
- case "Important":
- errata.Severity = apollopb.Advisory_SEVERITY_IMPORTANT
- break
- case "Critical":
- errata.Severity = apollopb.Advisory_SEVERITY_CRITICAL
- break
- }
- }
- })
-
- errC := c.Visit(fmt.Sprintf("%s/%s", a.baseURLErrata, advisory))
- if errC != nil {
- return nil, errC
- }
-
- c.Wait()
-
- if err != nil {
- return nil, err
- }
- return &errata, nil
-}
diff --git a/apollo/rherrata/errata_test.go b/apollo/rherrata/errata_test.go
deleted file mode 100644
index 0ad8c886..00000000
--- a/apollo/rherrata/errata_test.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
-// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
-// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors
-// may be used to endorse or promote products derived from this software without
-// specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-package rherrata
-
-import (
- "github.com/stretchr/testify/require"
- "io/ioutil"
- apollopb "peridot.resf.org/apollo/pb"
- "testing"
-)
-
-func newInstance() *MockInstance {
- return NewMock()
-}
-
-func TestRHBA20212759(t *testing.T) {
- mock := newInstance()
-
- htmlFile, err := ioutil.ReadFile("testdata/RHBA-2021-2759.html")
- require.Nil(t, err)
-
- mock.HTMLResponses["RHBA-2021:2759"] = string(htmlFile[:])
-
- errata, err := mock.API.GetErrata("RHBA-2021:2759")
- require.Nil(t, err)
-
- require.Equal(t, "firefox bugfix update", errata.Synopsis)
- require.Equal(t, apollopb.Advisory_TYPE_BUGFIX, errata.Type)
- require.Len(t, errata.Topic, 1)
- require.Equal(t, "An update for firefox is now available for Red Hat Enterprise Linux 8.", errata.Topic[0])
- require.Len(t, errata.Description, 3)
- require.Equal(t, "Mozilla Firefox is an open-source web browser, designed for standards", errata.Description[0])
- require.Equal(t, "compliance, performance, and portability.", errata.Description[1])
- require.Equal(t, "This update upgrades Firefox to version 78.12.0 ESR.", errata.Description[2])
- require.Len(t, errata.AffectedProducts, 12)
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for x86_64 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for x86_64 - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server - AUS 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for IBM z Systems 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for IBM z Systems - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for Power, little endian 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for Power, little endian - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server - TUS 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for ARM 64 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for ARM 64 - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server (for IBM Power LE) - Update Services for SAP Solutions 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server - Update Services for SAP Solutions 8.4"])
-
- x86 := errata.AffectedProducts["Red Hat Enterprise Linux for x86_64 8"]
- require.Len(t, x86.SRPMs, 1)
- require.Equal(t, "firefox-78.12.0-2.el8_4.src.rpm", x86.SRPMs[0])
- require.Len(t, x86.Packages[ArchX8664], 3)
- require.Equal(t, "firefox-78.12.0-2.el8_4.x86_64.rpm", x86.Packages[ArchX8664][0])
- require.Equal(t, "firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm", x86.Packages[ArchX8664][1])
- require.Equal(t, "firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm", x86.Packages[ArchX8664][2])
-}
-
-func TestRHBA20212743(t *testing.T) {
- mock := newInstance()
-
- htmlFile, err := ioutil.ReadFile("testdata/RHSA-2021-2743.html")
- require.Nil(t, err)
-
- mock.HTMLResponses["RHSA-2021:2743"] = string(htmlFile[:])
-
- errata, err := mock.API.GetErrata("RHSA-2021:2743")
- require.Nil(t, err)
-
- require.Equal(t, "Important: firefox security update", errata.Synopsis)
- require.Equal(t, apollopb.Advisory_TYPE_SECURITY, errata.Type)
- require.Equal(t, apollopb.Advisory_SEVERITY_IMPORTANT, errata.Severity)
- require.Len(t, errata.Topic, 2)
- require.Equal(t, "An update for firefox is now available for Red Hat Enterprise Linux 8.", errata.Topic[0])
- require.Equal(t, "Red Hat Product Security has rated this update as having a security impact of Important. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available for each vulnerability from the CVE link(s) in the References section.", errata.Topic[1])
- require.Len(t, errata.Description, 3)
- require.Equal(t, "Mozilla Firefox is an open-source web browser, designed for standards compliance, performance, and portability.", errata.Description[0])
- require.Equal(t, "This update upgrades Firefox to version 78.12.0 ESR.", errata.Description[1])
- require.Equal(t, "For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.", errata.Description[2])
- require.Len(t, errata.AffectedProducts, 12)
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for x86_64 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for x86_64 - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server - AUS 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for IBM z Systems 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for IBM z Systems - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for Power, little endian 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for Power, little endian - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server - TUS 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for ARM 64 8"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux for ARM 64 - Extended Update Support 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server (for IBM Power LE) - Update Services for SAP Solutions 8.4"])
- require.NotNil(t, errata.AffectedProducts["Red Hat Enterprise Linux Server - Update Services for SAP Solutions 8.4"])
- require.Len(t, errata.Fixes, 3)
- require.Equal(t, "1970109", errata.Fixes[0].BugzillaID)
- require.Equal(t, "CVE-2021-30547 chromium-browser: Out of bounds write in ANGLE", errata.Fixes[0].Description)
- require.Equal(t, "1982013", errata.Fixes[1].BugzillaID)
- require.Equal(t, "CVE-2021-29970 Mozilla: Use-after-free in accessibility features of a document", errata.Fixes[1].Description)
- require.Equal(t, "1982014", errata.Fixes[2].BugzillaID)
- require.Equal(t, "CVE-2021-29976 Mozilla: Memory safety bugs fixed in Firefox 90 and Firefox ESR 78.12", errata.Fixes[2].Description)
- require.Len(t, errata.CVEs, 3)
- require.Equal(t, "CVE-2021-29970", errata.CVEs[0])
- require.Equal(t, "CVE-2021-29976", errata.CVEs[1])
- require.Equal(t, "CVE-2021-30547", errata.CVEs[2])
- require.Len(t, errata.References, 1)
- require.Equal(t, "https://access.redhat.com/security/updates/classification/#important", errata.References[0])
-
- x86 := errata.AffectedProducts["Red Hat Enterprise Linux for x86_64 8"]
- require.Len(t, x86.SRPMs, 1)
- require.Equal(t, "firefox-78.12.0-1.el8_4.src.rpm", x86.SRPMs[0])
- require.Len(t, x86.Packages[ArchX8664], 3)
- require.Equal(t, "firefox-78.12.0-1.el8_4.x86_64.rpm", x86.Packages[ArchX8664][0])
- require.Equal(t, "firefox-debuginfo-78.12.0-1.el8_4.x86_64.rpm", x86.Packages[ArchX8664][1])
- require.Equal(t, "firefox-debugsource-78.12.0-1.el8_4.x86_64.rpm", x86.Packages[ArchX8664][2])
-}
diff --git a/apollo/rherrata/mock.go b/apollo/rherrata/mock.go
deleted file mode 100644
index 41dbd2d0..00000000
--- a/apollo/rherrata/mock.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
-// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
-// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors
-// may be used to endorse or promote products derived from this software without
-// specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-package rherrata
-
-import (
- "encoding/json"
- "github.com/go-chi/chi"
- "net/http"
- "net/http/httptest"
-)
-
-type MockInstance struct {
- API *API
- // Mapped to advisory id/name
- HTMLResponses map[string]string
- Advisories *internalAdvisoriesResponse
- TestServerErrata *httptest.Server
- TestServerMock *httptest.Server
-}
-
-func NewMock() *MockInstance {
- mockInstance := &MockInstance{
- HTMLResponses: map[string]string{},
- Advisories: &internalAdvisoriesResponse{
- Response: &internalAdvisoriesInnerResponse{
- Docs: []*CompactErrata{},
- },
- },
- }
-
- muxErrata := chi.NewMux()
- muxErrata.Get("/{advisory}", func(w http.ResponseWriter, r *http.Request) {
- advisory := chi.URLParam(r, "advisory")
-
- if response := mockInstance.HTMLResponses[advisory]; response != "" {
- w.Header().Set("Content-Type", "text/html")
- _, _ = w.Write([]byte(response))
- } else {
- w.WriteHeader(http.StatusNotFound)
- }
- })
-
- muxAPI := chi.NewMux()
- muxAPI.Get("/*", func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
-
- _ = json.NewEncoder(w).Encode(mockInstance.Advisories)
- })
-
- api := NewClient()
- tsErrata := httptest.NewServer(muxErrata)
- tsAPI := httptest.NewServer(muxAPI)
- api.baseURLErrata = tsErrata.URL
- api.baseURLAPI = tsAPI.URL
-
- mockInstance.API = api
- mockInstance.TestServerErrata = tsErrata
-
- return mockInstance
-}
diff --git a/apollo/rherrata/testdata/RHBA-2021-2759.html b/apollo/rherrata/testdata/RHBA-2021-2759.html
deleted file mode 100644
index 4b1f1103..00000000
--- a/apollo/rherrata/testdata/RHBA-2021-2759.html
+++ /dev/null
@@ -1,697 +0,0 @@
-
-
-
firefox bugfix update
-Bug Fix Advisory
-Identify and remediate systems affected by this advisory.
- -An update for firefox is now available for Red Hat Enterprise Linux 8.
-Mozilla Firefox is an open-source web browser, designed for standards
compliance, performance, and portability.
This update upgrades Firefox to version 78.12.0 ESR.
Bug Fix(es) and Enhancement(s):
Before applying this update, make sure all previously released errata
relevant to your system have been applied.
For details on how to apply this update, refer to:
- (none) -
-- (none) -
-SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
x86_64 | -|
- firefox-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5 | -
- firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f | -
- firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
x86_64 | -|
- firefox-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5 | -
- firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f | -
- firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
x86_64 | -|
- firefox-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5 | -
- firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f | -
- firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
s390x | -|
- firefox-78.12.0-2.el8_4.s390x.rpm - | -SHA-256: 40697d7bacf45b06063b60f8b5bd1f640e8b9aa6653151b69fe290f3b1dac77e | -
- firefox-debuginfo-78.12.0-2.el8_4.s390x.rpm - | -SHA-256: 4963ee8c61103f4072634f7e4c89e70ef4540300e41db28eb81c7d9f31f20868 | -
- firefox-debugsource-78.12.0-2.el8_4.s390x.rpm - | -SHA-256: 8079617c093dbd76c45e9f09cf7bd19f170d9d2adbe45c913e4e0c5ea03c4932 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
s390x | -|
- firefox-78.12.0-2.el8_4.s390x.rpm - | -SHA-256: 40697d7bacf45b06063b60f8b5bd1f640e8b9aa6653151b69fe290f3b1dac77e | -
- firefox-debuginfo-78.12.0-2.el8_4.s390x.rpm - | -SHA-256: 4963ee8c61103f4072634f7e4c89e70ef4540300e41db28eb81c7d9f31f20868 | -
- firefox-debugsource-78.12.0-2.el8_4.s390x.rpm - | -SHA-256: 8079617c093dbd76c45e9f09cf7bd19f170d9d2adbe45c913e4e0c5ea03c4932 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
ppc64le | -|
- firefox-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: d98a5004873909d9ab659d0090580367e1a89e67dbc6a1344aa62ea410a3735b | -
- firefox-debuginfo-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: 5239bad414f02fe5ea3402a0de2f3c10d3f47feec74590e4bbecaa390a43ac7c | -
- firefox-debugsource-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: fd1122a830c1e0e853a90a30779f015e3ae91ac64d082791492942ebc3619408 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
ppc64le | -|
- firefox-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: d98a5004873909d9ab659d0090580367e1a89e67dbc6a1344aa62ea410a3735b | -
- firefox-debuginfo-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: 5239bad414f02fe5ea3402a0de2f3c10d3f47feec74590e4bbecaa390a43ac7c | -
- firefox-debugsource-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: fd1122a830c1e0e853a90a30779f015e3ae91ac64d082791492942ebc3619408 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
x86_64 | -|
- firefox-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5 | -
- firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f | -
- firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
aarch64 | -|
- firefox-78.12.0-2.el8_4.aarch64.rpm - | -SHA-256: 4a884d2cf1f2d2da10bfe3010e6323a698ac137270ff2bf4f6f5f3bfd74389ae | -
- firefox-debuginfo-78.12.0-2.el8_4.aarch64.rpm - | -SHA-256: ff8b84361bc20665fec33e85391cef9240aadaf15088cd6655357ccbb94f2665 | -
- firefox-debugsource-78.12.0-2.el8_4.aarch64.rpm - | -SHA-256: fb9986dd21e71ffc2bbafedc6b8519ba10fb677184061fb6a94c84087a737a2d | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
aarch64 | -|
- firefox-78.12.0-2.el8_4.aarch64.rpm - | -SHA-256: 4a884d2cf1f2d2da10bfe3010e6323a698ac137270ff2bf4f6f5f3bfd74389ae | -
- firefox-debuginfo-78.12.0-2.el8_4.aarch64.rpm - | -SHA-256: ff8b84361bc20665fec33e85391cef9240aadaf15088cd6655357ccbb94f2665 | -
- firefox-debugsource-78.12.0-2.el8_4.aarch64.rpm - | -SHA-256: fb9986dd21e71ffc2bbafedc6b8519ba10fb677184061fb6a94c84087a737a2d | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
ppc64le | -|
- firefox-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: d98a5004873909d9ab659d0090580367e1a89e67dbc6a1344aa62ea410a3735b | -
- firefox-debuginfo-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: 5239bad414f02fe5ea3402a0de2f3c10d3f47feec74590e4bbecaa390a43ac7c | -
- firefox-debugsource-78.12.0-2.el8_4.ppc64le.rpm - | -SHA-256: fd1122a830c1e0e853a90a30779f015e3ae91ac64d082791492942ebc3619408 | -
SRPM | -|
---|---|
- firefox-78.12.0-2.el8_4.src.rpm - | -SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742 | -
x86_64 | -|
- firefox-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5 | -
- firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f | -
- firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm - | -SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537 | -
- The Red Hat security contact is secalert@redhat.com. - More contact details at https://access.redhat.com/security/team/contact/. -
-