Merge pull request #98 from mstg/delete-apollo-2

Delete Apollo from this repo
This commit is contained in:
resf-prow[bot] 2023-02-17 18:47:50 +00:00 committed by GitHub
commit c2b607522a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
151 changed files with 40 additions and 21286 deletions

View File

@ -0,0 +1,4 @@
sh_test(
name = "test-dummy",
srcs = ["test-dummy.sh"],
)

2
apollo/README.md Normal file
View File

@ -0,0 +1,2 @@
# Apollo has moved
Apollo v3 lives in distro-tools at https://github.com/resf/distro-tools

View File

@ -1,21 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "apollo_lib",
srcs = ["main.go"],
importpath = "peridot.resf.org/apollo/cmd/apollo",
visibility = ["//visibility:private"],
deps = [
"//apollo/db/connector",
"//apollo/impl/v1:impl",
"//utils",
"//vendor/github.com/sirupsen/logrus",
"//vendor/github.com/spf13/cobra",
],
)
go_binary(
name = "apollo",
embed = [":apollo_lib"],
visibility = ["//visibility:public"],
)

View File

@ -1,21 +0,0 @@
load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container(
base = "//bases/bazel/go",
files = [
"//apollo/cmd/apollo",
],
image_name = "apollo",
tars_to_layer = [
"//apollo/migrate",
],
)
peridot_k8s(
name = "apollo",
src = "deploy.jsonnet",
outs = RESFDEPLOY_OUTS_MIGRATE,
chart_yaml = "Chart.yaml",
values_yaml = "values.yaml",
deps = ["//ci"],
)

View File

@ -1,6 +0,0 @@
apiVersion: v2
name: apollo
description: Helm chart for apollo
type: application
version: 0.0.1
appVersion: "0.0.1"

View File

@ -1,48 +0,0 @@
local resfdeploy = import 'ci/resfdeploy.jsonnet';
local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet';
resfdeploy.new({
name: 'apollo',
replicas: 1,
dbname: 'apollo',
backend: true,
migrate: true,
legacyDb: true,
command: '/bundle/apollo',
image: kubernetes.tag('apollo'),
tag: kubernetes.version,
dsn: {
name: 'APOLLO_DATABASE_URL',
value: db.dsn_legacy('apollo'),
},
requests: if kubernetes.prod() then {
cpu: '0.5',
memory: '512M',
},
ports: [
{
name: 'http',
containerPort: 9100,
protocol: 'TCP',
expose: true,
},
{
name: 'grpc',
containerPort: 9101,
protocol: 'TCP',
},
],
health: {
port: 9100,
},
env: [
{
name: 'APOLLO_PRODUCTION',
value: if kubernetes.dev() then 'false' else 'true',
},
$.dsn,
] + temporal.kube_env('APOLLO'),
})

View File

@ -1,3 +0,0 @@
# Ports under requires ingressHost to be set during deploy
http:
ingressHost: null

View File

@ -1,67 +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 main
import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
apolloconnector "peridot.resf.org/apollo/db/connector"
apolloimpl "peridot.resf.org/apollo/impl/v1"
"peridot.resf.org/utils"
)
var root = &cobra.Command{
Use: "apollo",
Run: mn,
}
var cnf = utils.NewFlagConfig()
func init() {
cnf.DefaultPort = 9100
cnf.DatabaseName = utils.Pointer[string]("apollo")
cnf.Name = *cnf.DatabaseName
root.PersistentFlags().String("homepage", "https://errata.build.resf.org", "Frontend root URL")
utils.AddFlags(root.PersistentFlags(), cnf)
}
func mn(_ *cobra.Command, _ []string) {
apolloimpl.NewServer(apolloconnector.MustAuto()).Run()
}
func main() {
utils.Main()
if err := root.Execute(); err != nil {
logrus.Fatal(err)
}
}

View File

@ -1,24 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "apollostarter_lib",
srcs = ["main.go"],
importpath = "peridot.resf.org/apollo/cmd/apollostarter",
visibility = ["//visibility:private"],
deps = [
"//apollo/db/connector",
"//apollo/worker",
"//proto:common",
"//temporalutils",
"//utils",
"//vendor/github.com/sirupsen/logrus",
"//vendor/github.com/spf13/cobra",
"//vendor/go.temporal.io/sdk/client",
],
)
go_binary(
name = "apollostarter",
embed = [":apollostarter_lib"],
visibility = ["//visibility:public"],
)

View File

@ -1,20 +0,0 @@
load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container(
base = "//bases/bazel/go",
files = [
"//apollo/cmd/apollostarter",
],
image_name = "apollostarter",
)
peridot_k8s(
name = "apollostarter",
src = "deploy.jsonnet",
outs = RESFDEPLOY_OUTS_MIGRATE,
chart_yaml = "Chart.yaml",
values_yaml = "values.yaml",
deps = [
"//ci",
],
)

View File

@ -1,6 +0,0 @@
apiVersion: v2
name: apollostarter
description: Helm chart for apollostarter
type: application
version: 0.0.1
appVersion: "0.0.1"

View File

@ -1,46 +0,0 @@
local resfdeploy = import 'ci/resfdeploy.jsonnet';
local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet';
local site = std.extVar('site');
resfdeploy.new({
name: 'apollostarter',
replicas: 1,
dbname: 'apollo',
backend: true,
migrate: true,
migrate_command: ['/bin/sh'],
migrate_args: ['-c', 'exit 0'],
legacyDb: true,
command: '/bundle/apollostarter',
image: kubernetes.tag('apollostarter'),
tag: kubernetes.version,
dsn: {
name: 'APOLLOSTARTER_DATABASE_URL',
value: db.dsn_legacy('apollo', false, 'apollostarter'),
},
requests: if kubernetes.prod() then {
cpu: '1',
memory: '2G',
},
ports: [
{
name: 'http',
containerPort: 31209,
protocol: 'TCP',
},
],
health: {
port: 31209,
},
env: [
{
name: 'APOLLOSTARTER_PRODUCTION',
value: if kubernetes.dev() then 'false' else 'true',
},
$.dsn,
] + temporal.kube_env('APOLLOSTARTER'),
})

View File

@ -1 +0,0 @@
temporalHostPort: workflow-temporal-frontend.workflow.svc.cluster.local:7233

View File

@ -1,153 +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 main
import (
"context"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"go.temporal.io/sdk/client"
"log"
apolloconnector "peridot.resf.org/apollo/db/connector"
"peridot.resf.org/apollo/worker"
commonpb "peridot.resf.org/common"
"peridot.resf.org/temporalutils"
"peridot.resf.org/utils"
)
var root = &cobra.Command{
Use: "apollostarter",
Run: mn,
}
var cnf = utils.NewFlagConfig()
func init() {
cnf.DefaultPort = 31209
cnf.DatabaseName = utils.Pointer[string]("apollo")
cnf.Name = "apollostarter"
temporalutils.AddFlags(root.PersistentFlags())
utils.AddFlags(root.PersistentFlags(), cnf)
}
func mn(_ *cobra.Command, _ []string) {
c, err := temporalutils.NewClient(client.Options{})
if err != nil {
logrus.Fatalln("unable to create Temporal client", err)
}
defer c.Close()
db := apolloconnector.MustAuto()
w, err := worker.NewWorker(&worker.NewWorkerInput{
Temporal: c,
Database: db,
TaskQueue: "apollo-v1-main-queue",
})
defer w.Client.Close()
// Poll Red Hat for new CVEs and advisories every two hours
cveWfOpts := client.StartWorkflowOptions{
ID: "cron_cve_mirror",
TaskQueue: w.TaskQueue,
CronSchedule: "0 */2 * * *",
}
_, err = w.Client.ExecuteWorkflow(context.Background(), cveWfOpts, w.WorkflowController.PollRedHatCVEsWorkflow)
if err != nil {
log.Fatalf("unable to start cve workflow: %v", err)
}
errataWfOpts := client.StartWorkflowOptions{
ID: "cron_errata_mirror",
TaskQueue: w.TaskQueue,
CronSchedule: "0 */2 * * *",
}
_, err = w.Client.ExecuteWorkflow(context.Background(), errataWfOpts, w.WorkflowController.PollRedHatErrataWorkflow)
if err != nil {
log.Fatalf("unable to start errata workflow: %v", err)
}
// Poll unresolved CVE status and update every hour
cveStatusWfOpts := client.StartWorkflowOptions{
ID: "cron_cve_status",
TaskQueue: w.TaskQueue,
CronSchedule: "0 */1 * * *",
}
_, err = w.Client.ExecuteWorkflow(context.Background(), cveStatusWfOpts, w.WorkflowController.UpdateCVEStateWorkflow)
if err != nil {
log.Fatalf("unable to start cve status workflow: %v", err)
}
// Check if CVE is fixed downstream every 10 minutes
cveDownstreamWfOpts := client.StartWorkflowOptions{
ID: "cron_cve_downstream",
TaskQueue: w.TaskQueue,
CronSchedule: "*/10 * * * *",
}
_, err = w.Client.ExecuteWorkflow(context.Background(), cveDownstreamWfOpts, w.WorkflowController.DownstreamCVECheckWorkflow)
if err != nil {
log.Fatalf("unable to start cve downstream workflow: %v", err)
}
// Auto create advisory for fixed CVEs every 30 minutes
cveAdvisoryWfOpts := client.StartWorkflowOptions{
ID: "cron_cve_advisory",
TaskQueue: w.TaskQueue,
CronSchedule: "*/10 * * * *",
}
_, err = w.Client.ExecuteWorkflow(context.Background(), cveAdvisoryWfOpts, w.WorkflowController.AutoCreateAdvisoryWorkflow)
if err != nil {
log.Fatalf("unable to start cve advisory workflow: %v", err)
}
// only added so we get a health endpoint
s := utils.NewGRPCServer(
nil,
func(r *utils.Register) {
err := commonpb.RegisterHealthCheckServiceHandlerFromEndpoint(r.Context, r.Mux, r.Endpoint, r.Options)
if err != nil {
logrus.Fatalf("could not register health service: %v", err)
}
},
func(r *utils.RegisterServer) {
commonpb.RegisterHealthCheckServiceServer(r.Server, &utils.HealthServer{})
},
)
s.WaitGroup.Wait()
}
func main() {
utils.Main()
if err := root.Execute(); err != nil {
log.Fatal(err)
}
}

View File

@ -1,27 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "apolloworker_lib",
srcs = ["main.go"],
importpath = "peridot.resf.org/apollo/cmd/apolloworker",
visibility = ["//visibility:private"],
deps = [
"//apollo/db/connector",
"//apollo/rherrata",
"//apollo/rhsecurity",
"//apollo/worker",
"//apollo/workflow",
"//proto:common",
"//temporalutils",
"//utils",
"//vendor/github.com/sirupsen/logrus",
"//vendor/github.com/spf13/cobra",
"//vendor/go.temporal.io/sdk/client",
],
)
go_binary(
name = "apolloworker",
embed = [":apolloworker_lib"],
visibility = ["//visibility:public"],
)

View File

@ -1,20 +0,0 @@
load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s")
container(
base = "//bases/bazel/go",
files = [
"//apollo/cmd/apolloworker",
],
image_name = "apolloworker",
)
peridot_k8s(
name = "apolloworker",
src = "deploy.jsonnet",
outs = RESFDEPLOY_OUTS_MIGRATE,
chart_yaml = "Chart.yaml",
values_yaml = "values.yaml",
deps = [
"//ci",
],
)

View File

@ -1,6 +0,0 @@
apiVersion: v2
name: apolloworker
description: Helm chart for apolloworker
type: application
version: 0.0.1
appVersion: "0.0.1"

View File

@ -1,46 +0,0 @@
local resfdeploy = import 'ci/resfdeploy.jsonnet';
local db = import 'ci/db.jsonnet';
local kubernetes = import 'ci/kubernetes.jsonnet';
local temporal = import 'ci/temporal.jsonnet';
local utils = import 'ci/utils.jsonnet';
local site = std.extVar('site');
resfdeploy.new({
name: 'apolloworker',
replicas: 1,
dbname: 'apollo',
backend: true,
migrate: true,
migrate_command: ['/bin/sh'],
migrate_args: ['-c', 'exit 0'],
legacyDb: true,
command: '/bundle/apolloworker',
image: kubernetes.tag('apolloworker'),
tag: kubernetes.version,
dsn: {
name: 'APOLLOWORKER_DATABASE_URL',
value: db.dsn_legacy('apollo', false, 'apolloworker'),
},
requests: if kubernetes.prod() then {
cpu: '1',
memory: '2G',
},
ports: [
{
name: 'http',
containerPort: 29209,
protocol: 'TCP',
},
],
health: {
port: 29209,
},
env: [
{
name: 'APOLLOWORKER_PRODUCTION',
value: if kubernetes.dev() then 'false' else 'true',
},
$.dsn,
] + temporal.kube_env('APOLLOWORKER'),
})

View File

@ -1 +0,0 @@
temporalHostPort: workflow-temporal-frontend.workflow.svc.cluster.local:7233

View File

@ -1,143 +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 main
import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"go.temporal.io/sdk/client"
"log"
apolloconnector "peridot.resf.org/apollo/db/connector"
"peridot.resf.org/apollo/rherrata"
"peridot.resf.org/apollo/rhsecurity"
"peridot.resf.org/apollo/worker"
"peridot.resf.org/apollo/workflow"
commonpb "peridot.resf.org/common"
"peridot.resf.org/temporalutils"
"peridot.resf.org/utils"
"sync"
)
var root = &cobra.Command{
Use: "apolloworker",
Run: mn,
}
var cnf = utils.NewFlagConfig()
func init() {
cnf.DefaultPort = 29209
cnf.DatabaseName = utils.Pointer[string]("apollo")
cnf.Name = "apolloworker"
pflags := root.PersistentFlags()
pflags.String("vendor", "Rocky Enterprise Software Foundation", "Vendor name that is publishing the advisories")
temporalutils.AddFlags(root.PersistentFlags())
utils.AddFlags(root.PersistentFlags(), cnf)
}
func mn(_ *cobra.Command, _ []string) {
c, err := temporalutils.NewClient(client.Options{})
if err != nil {
logrus.Fatalln("unable to create Temporal client", err)
}
defer c.Close()
db := apolloconnector.MustAuto()
options := []workflow.Option{
workflow.WithSecurityAPI(rhsecurity.NewAPIClient(rhsecurity.NewConfiguration()).DefaultApi),
workflow.WithErrataAPI(rherrata.NewClient()),
}
w, err := worker.NewWorker(
&worker.NewWorkerInput{
Temporal: c,
Database: db,
TaskQueue: "apollo-v1-main-queue",
},
options...,
)
defer w.Client.Close()
w.Worker.RegisterWorkflow(w.WorkflowController.AutoCreateAdvisoryWorkflow)
w.Worker.RegisterWorkflow(w.WorkflowController.DownstreamCVECheckWorkflow)
w.Worker.RegisterWorkflow(w.WorkflowController.PollRedHatCVEsWorkflow)
w.Worker.RegisterWorkflow(w.WorkflowController.PollRedHatErrataWorkflow)
w.Worker.RegisterWorkflow(w.WorkflowController.UpdateCVEStateWorkflow)
w.Worker.RegisterActivity(w.WorkflowController.AutoCreateAdvisoryActivity)
w.Worker.RegisterActivity(w.WorkflowController.GetAllShortCodesActivity)
w.Worker.RegisterActivity(w.WorkflowController.DownstreamCVECheckActivity)
w.Worker.RegisterActivity(w.WorkflowController.PollCVEProcessShortCodeActivity)
w.Worker.RegisterActivity(w.WorkflowController.ProcessRedHatErrataShortCodeActivity)
w.Worker.RegisterActivity(w.WorkflowController.UpdateCVEStateActivity)
w.Worker.RegisterWorkflow(w.WorkflowController.CollectCVEDataWorkflow)
w.Worker.RegisterActivity(w.WorkflowController.CollectCVEDataActivity)
var wg sync.WaitGroup
wg.Add(2)
go func() {
w.Run()
wg.Done()
}()
go func() {
// only added so we get a health endpoint
s := utils.NewGRPCServer(
nil,
func(r *utils.Register) {
err := commonpb.RegisterHealthCheckServiceHandlerFromEndpoint(r.Context, r.Mux, r.Endpoint, r.Options)
if err != nil {
logrus.Fatalf("could not register health service: %v", err)
}
},
func(r *utils.RegisterServer) {
commonpb.RegisterHealthCheckServiceServer(r.Server, &utils.HealthServer{})
},
)
s.WaitGroup.Wait()
wg.Done()
}()
wg.Wait()
}
func main() {
utils.Main()
if err := root.Execute(); err != nil {
log.Fatal(err)
}
}

View File

@ -1,19 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "db",
srcs = [
"convert.go",
"db.go",
],
importpath = "peridot.resf.org/apollo/db",
visibility = ["//visibility:public"],
deps = [
"//apollo/proto/v1:pb",
"//utils",
"//vendor/github.com/jmoiron/sqlx/types",
"//vendor/github.com/lib/pq",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
"@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
],
)

View File

@ -1,14 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "connector",
srcs = ["connector.go"],
importpath = "peridot.resf.org/apollo/db/connector",
visibility = ["//visibility:public"],
deps = [
"//apollo/db",
"//apollo/db/psql",
"//utils",
"//vendor/github.com/sirupsen/logrus",
],
)

View File

@ -1,50 +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 apolloconnector
import (
"github.com/sirupsen/logrus"
apollodb "peridot.resf.org/apollo/db"
apollopsql "peridot.resf.org/apollo/db/psql"
"peridot.resf.org/utils"
)
// MustAuto automatically returns the correct access interface or fatally fails
func MustAuto() apollodb.Access {
dbType := utils.GetDbType()
switch dbType {
case utils.DbPostgres:
return apollopsql.New()
default:
logrus.Fatal("invalid database url supplied")
return nil
}
}

View File

@ -1,155 +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 apollodb
import (
"fmt"
"google.golang.org/protobuf/types/known/timestamppb"
"google.golang.org/protobuf/types/known/wrapperspb"
apollopb "peridot.resf.org/apollo/pb"
"strings"
)
func DTOAdvisoryToPB(sc *Advisory) *apollopb.Advisory {
var errataType string
switch apollopb.Advisory_Type(sc.Type) {
case apollopb.Advisory_TYPE_SECURITY:
errataType = "SA"
break
case apollopb.Advisory_TYPE_BUGFIX:
errataType = "BA"
break
case apollopb.Advisory_TYPE_ENHANCEMENT:
errataType = "EA"
break
default:
errataType = "UNK"
break
}
var publishedAt *timestamppb.Timestamp
if sc.PublishedAt.Valid {
publishedAt = timestamppb.New(sc.PublishedAt.Time)
}
ret := &apollopb.Advisory{
Type: apollopb.Advisory_Type(sc.Type),
ShortCode: sc.ShortCodeCode,
Name: fmt.Sprintf("%s%s-%d:%d", sc.ShortCodeCode, errataType, sc.Year, sc.Num),
Synopsis: sc.Synopsis,
Severity: apollopb.Advisory_Severity(sc.Severity),
Topic: sc.Topic,
Description: sc.Description,
AffectedProducts: sc.AffectedProducts,
Fixes: nil,
Cves: []*apollopb.CVE{},
References: sc.References,
PublishedAt: publishedAt,
Rpms: nil,
RebootSuggested: sc.RebootSuggested,
}
if sc.Solution.Valid {
ret.Solution = &wrapperspb.StringValue{Value: sc.Solution.String}
}
for _, cve := range sc.Cves {
split := strings.SplitN(cve, ":::", 6)
ret.Cves = append(ret.Cves, &apollopb.CVE{
Name: split[2],
SourceBy: wrapperspb.String(split[0]),
SourceLink: wrapperspb.String(split[1]),
Cvss3ScoringVector: wrapperspb.String(split[3]),
Cvss3BaseScore: wrapperspb.String(split[4]),
Cwe: wrapperspb.String(split[5]),
})
}
if len(sc.Fixes) > 0 {
ret.Fixes = []*apollopb.Fix{}
}
for _, fix := range sc.Fixes {
split := strings.SplitN(fix, ":::", 4)
ret.Fixes = append(ret.Fixes, &apollopb.Fix{
Ticket: wrapperspb.String(split[0]),
SourceBy: wrapperspb.String(split[1]),
SourceLink: wrapperspb.String(split[2]),
Description: wrapperspb.String(split[3]),
})
}
if len(sc.RPMs) > 0 {
ret.Rpms = map[string]*apollopb.RPMs{}
}
for _, rpm := range sc.RPMs {
split := strings.SplitN(rpm, ":::", 2)
nvra := split[0]
productName := split[1]
if ret.Rpms[productName] == nil {
ret.Rpms[productName] = &apollopb.RPMs{}
}
ret.Rpms[productName].Nvras = append(ret.Rpms[productName].Nvras, nvra)
}
return ret
}
func DTOListAdvisoriesToPB(scs []*Advisory) []*apollopb.Advisory {
var ret []*apollopb.Advisory
for _, v := range scs {
ret = append(ret, DTOAdvisoryToPB(v))
}
return ret
}
func DTOCVEToPB(cve *CVE) *apollopb.CVE {
ret := &apollopb.CVE{
Name: cve.ID,
}
if cve.SourceBy.Valid {
ret.SourceBy = wrapperspb.String(cve.SourceBy.String)
}
if cve.SourceLink.Valid {
ret.SourceLink = wrapperspb.String(cve.SourceLink.String)
}
return ret
}
func DTOListCVEsToPB(cves []*CVE) []*apollopb.CVE {
var ret []*apollopb.CVE
for _, v := range cves {
ret = append(ret, DTOCVEToPB(v))
}
return ret
}

View File

@ -1,251 +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 apollodb
import (
"database/sql"
"github.com/jmoiron/sqlx/types"
"github.com/lib/pq"
apollopb "peridot.resf.org/apollo/pb"
"peridot.resf.org/utils"
"time"
)
// ShortCode is the DTO struct for `resf.apollo.ShortCode`
type ShortCode struct {
Code string `json:"code" db:"code"`
Mode int8 `json:"mode" db:"mode"`
CreatedAt *time.Time `json:"createdAt" db:"created_at"`
ArchivedAt sql.NullTime `json:"archivedAt" db:"archived_at"`
}
// Advisory is the DTO struct for `resf.apollo.Advisory`
type Advisory struct {
ID int64 `db:"id"`
CreatedAt *time.Time `db:"created_at"`
Year int `db:"year"`
Num int `db:"num"`
Synopsis string `db:"synopsis"`
Topic string `db:"topic"`
Severity int `db:"severity"`
Type int `db:"type"`
Description string `db:"description"`
Solution sql.NullString `db:"solution"`
RedHatIssuedAt sql.NullTime `db:"redhat_issued_at"`
ShortCodeCode string `db:"short_code_code"`
RebootSuggested bool `db:"reboot_suggested"`
PublishedAt sql.NullTime `db:"published_at"`
AffectedProducts pq.StringArray `db:"affected_products"`
Fixes pq.StringArray `db:"fixes"`
Cves pq.StringArray `db:"cves"`
CveIds pq.StringArray `db:"cve_ids"`
References pq.StringArray `db:"references"`
RPMs pq.StringArray `db:"rpms"`
BuildArtifacts pq.StringArray `db:"build_artifacts"`
// Only used for list/search queries
Total int64 `json:"total" db:"total"`
}
// CVE is the DTO struct for `resf.apollo.CVE`
type CVE struct {
ID string `db:"id"`
CreatedAt *time.Time `db:"created_at"`
AdvisoryId sql.NullInt64 `db:"advisory_id"`
ShortCode string `db:"short_code_code"`
SourceBy sql.NullString `db:"source_by"`
SourceLink sql.NullString `db:"source_link"`
Content types.NullJSONText `db:"content"`
AffectedProductId sql.NullInt64 `db:"affected_product_id"`
}
// AffectedProduct is the DTO struct for `resf.apollo.AffectedProduct`
type AffectedProduct struct {
ID int64 `db:"id"`
ProductID int64 `db:"product_id"`
CveID sql.NullString `db:"cve_id"`
State int `db:"state"`
Version string `db:"version"`
Package string `db:"package"`
Advisory sql.NullString `db:"advisory"`
}
// Product is the DTO struct for `resf.apollo.Product`
type Product struct {
ID int64 `db:"id"`
Name string `db:"name"`
CurrentFullVersion string `db:"current_full_version"`
RedHatMajorVersion sql.NullInt32 `db:"redhat_major_version"`
ShortCode string `db:"short_code_code"`
Archs pq.StringArray `db:"archs"`
MirrorFromDate sql.NullTime `json:"mirrorFromDate" db:"mirror_from_date"`
RedHatProductPrefix sql.NullString `json:"redHatProductPrefix" db:"redhat_product_prefix"`
Cpe sql.NullString `json:"cpe" db:"cpe"`
EolAt sql.NullTime `json:"eolAt" db:"eol_at"`
BuildSystem string `json:"buildSystem" db:"build_system"`
BuildSystemEndpoint string `json:"buildSystemEndpoint" db:"build_system_endpoint"`
KojiCompose sql.NullString `json:"kojiCompose" db:"koji_compose"`
KojiModuleCompose sql.NullString `json:"kojiModuleCompose" db:"koji_module_compose"`
PeridotProjectID sql.NullString `json:"peridotProjectID" db:"peridot_project_id"`
}
type BuildReference struct {
ID int64 `db:"id"`
AffectedProductId int64 `db:"affected_product_id"`
Rpm string `db:"rpm"`
SrcRpm string `db:"src_rpm"`
CveID string `db:"cve_id"`
Sha256Sum string `db:"sha256_sum"`
KojiID sql.NullString `db:"koji_id"`
PeridotID sql.NullString `db:"peridot_id"`
}
type Fix struct {
ID int64 `db:"id"`
Ticket sql.NullString `db:"ticket"`
SourceBy sql.NullString `db:"source_by"`
SourceLink sql.NullString `db:"source_link"`
Description sql.NullString `db:"description"`
}
type AdvisoryReference struct {
ID int64 `db:"advisory_reference"`
URL string `db:"url"`
AdvisoryId int64 `db:"advisory_id"`
}
type MirrorState struct {
ShortCode string `db:"short_code_code"`
LastSync sql.NullTime `db:"last_sync"`
ErrataAfter sql.NullTime `db:"errata_after"`
}
type AdvisoryCVE struct {
AdvisoryID int64 `db:"advisory_id"`
CveID string `db:"cve_id"`
}
type AdvisoryFix struct {
AdvisoryID int64 `db:"advisory_id"`
FixID int64 `db:"fix_id"`
}
type IgnoredUpstreamPackage struct {
ID int64 `db:"id"`
ProductID int64 `db:"product_id"`
Package string `db:"package"`
}
type RebootSuggestedPackage struct {
CreatedAt *time.Time `db:"created_at"`
Name string `db:"name"`
}
type AdvisoryRPM struct {
AdvisoryID int64 `db:"advisory_id"`
Name string `db:"name"`
ProductID int64 `db:"product_id"`
}
type Access interface {
GetAllShortCodes() ([]*ShortCode, error)
GetShortCodeByCode(code string) (*ShortCode, error)
CreateShortCode(code string, mode apollopb.ShortCode_Mode) (*ShortCode, error)
GetAllAdvisories(filters *apollopb.AdvisoryFilters, page int32, limit int32) ([]*Advisory, error)
// Advisory is a broad entity with lots of fields
// mustafa: It is in my opinion better to accept the same struct
// to create and update it.
// Obviously fields like ID and CreatedAt cannot be overridden
// The Create and Update methods for advisory do not return
// the following fields:
// - AffectedProducts
// - Fixes
// - Cves
// - References
CreateAdvisory(advisory *Advisory) (*Advisory, error)
// Update cannot override the RedHatIssuedAt field for mirrored advisories
UpdateAdvisory(advisory *Advisory) (*Advisory, error)
GetAdvisoryByCodeAndYearAndNum(code string, year int, num int) (*Advisory, error)
GetAllUnresolvedCVEs() ([]*CVE, error)
GetPendingAffectedProducts() ([]*AffectedProduct, error)
GetAllCVEsFixedDownstream() ([]*CVE, error)
GetCVEByID(id string) (*CVE, error)
GetAllCVEs() ([]*CVE, error)
CreateCVE(cveId string, shortCode string, sourceBy *string, sourceLink *string, content types.NullJSONText) (*CVE, error)
SetCVEContent(cveId string, content types.JSONText) error
GetProductsByShortCode(code string) ([]*Product, error)
GetProductByNameAndShortCode(product string, code string) (*Product, error)
GetProductByID(id int64) (*Product, error)
CreateProduct(name string, currentFullVersion string, redHatMajorVersion *int32, code string, archs []string) (*Product, error)
GetAllAffectedProductsByCVE(cve string) ([]*AffectedProduct, error)
GetAffectedProductByCVEAndPackage(cve string, pkg string) (*AffectedProduct, error)
GetAffectedProductByAdvisory(advisory string) (*AffectedProduct, error)
GetAffectedProductByID(id int64) (*AffectedProduct, error)
CreateAffectedProduct(productId int64, cveId string, state int, version string, pkg string, advisory *string) (*AffectedProduct, error)
UpdateAffectedProductStateAndPackageAndAdvisory(id int64, state int, pkg string, advisory *string) error
DeleteAffectedProduct(id int64) error
CreateFix(ticket string, sourceBy string, sourceLink string, description string) (int64, error)
// This will return nil rather than an error if no rows are found
GetMirrorState(code string) (*MirrorState, error)
UpdateMirrorState(code string, lastSync *time.Time) error
UpdateMirrorStateErrata(code string, lastSync *time.Time) error
GetMaxLastSync() (*time.Time, error)
CreateBuildReference(affectedProductId int64, rpm string, srcRpm string, cveId string, sha256Sum string, kojiId *string, peridotId *string) (*BuildReference, error)
CreateAdvisoryReference(advisoryId int64, url string) error
GetAllIgnoredPackagesByProductID(productID int64) ([]string, error)
GetAllRebootSuggestedPackages() ([]string, error)
// These add methods is treated like an upsert. They're only added if one doesn't exist
AddAdvisoryFix(advisoryId int64, fixId int64) error
AddAdvisoryCVE(advisoryId int64, cveId string) error
AddAdvisoryRPM(advisoryId int64, name string, productID int64) error
Begin() (utils.Tx, error)
UseTransaction(tx utils.Tx) Access
}

View File

@ -1,14 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "mock",
srcs = ["mock.go"],
importpath = "peridot.resf.org/apollo/db/mock",
visibility = ["//visibility:public"],
deps = [
"//apollo/db",
"//apollo/proto/v1:pb",
"//utils",
"//vendor/github.com/jmoiron/sqlx/types",
],
)

View File

@ -1,774 +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 apollomock
import (
"database/sql"
"fmt"
"github.com/jmoiron/sqlx/types"
apollodb "peridot.resf.org/apollo/db"
apollopb "peridot.resf.org/apollo/pb"
"peridot.resf.org/utils"
"time"
)
type Access struct {
ShortCodes []*apollodb.ShortCode
Advisories []*apollodb.Advisory
Cves []*apollodb.CVE
Fixes []*apollodb.Fix
AdvisoryReferences []*apollodb.AdvisoryReference
Products []*apollodb.Product
AffectedProducts []*apollodb.AffectedProduct
BuildReferences []*apollodb.BuildReference
MirrorStates []*apollodb.MirrorState
AdvisoryCVEs []*apollodb.AdvisoryCVE
AdvisoryFixes []*apollodb.AdvisoryFix
IgnoredUpstreamPackages []*apollodb.IgnoredUpstreamPackage
RebootSuggestedPackages []*apollodb.RebootSuggestedPackage
AdvisoryRPMs []*apollodb.AdvisoryRPM
}
func New() *Access {
return &Access{
ShortCodes: []*apollodb.ShortCode{},
Advisories: []*apollodb.Advisory{},
Cves: []*apollodb.CVE{},
Fixes: []*apollodb.Fix{},
AdvisoryReferences: []*apollodb.AdvisoryReference{},
Products: []*apollodb.Product{},
AffectedProducts: []*apollodb.AffectedProduct{},
BuildReferences: []*apollodb.BuildReference{},
MirrorStates: []*apollodb.MirrorState{},
AdvisoryCVEs: []*apollodb.AdvisoryCVE{},
AdvisoryFixes: []*apollodb.AdvisoryFix{},
IgnoredUpstreamPackages: []*apollodb.IgnoredUpstreamPackage{},
RebootSuggestedPackages: []*apollodb.RebootSuggestedPackage{},
AdvisoryRPMs: []*apollodb.AdvisoryRPM{},
}
}
func (a *Access) GetAllShortCodes() ([]*apollodb.ShortCode, error) {
return a.ShortCodes, nil
}
func (a *Access) GetShortCodeByCode(code string) (*apollodb.ShortCode, error) {
for _, val := range a.ShortCodes {
if val.Code == code {
return val, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) CreateShortCode(code string, mode apollopb.ShortCode_Mode) (*apollodb.ShortCode, error) {
now := time.Now()
shortCode := apollodb.ShortCode{
Code: code,
Mode: int8(mode),
CreatedAt: &now,
ArchivedAt: sql.NullTime{},
}
a.ShortCodes = append(a.ShortCodes, &shortCode)
return &shortCode, nil
}
func (a *Access) getAdvisoriesWithJoin(filter func(*apollodb.Advisory) bool) []*apollodb.Advisory {
var advisories []*apollodb.Advisory
for _, val := range a.Advisories {
if filter(val) {
advisories = append(advisories, val)
}
}
if len(advisories) == 0 {
return advisories
}
for _, advisory := range advisories {
advisory.AffectedProducts = []string{}
advisory.Fixes = []string{}
advisory.Cves = []string{}
advisory.References = []string{}
advisory.RPMs = []string{}
advisory.BuildArtifacts = []string{}
for _, advisoryCve := range a.AdvisoryCVEs {
if advisoryCve.AdvisoryID != advisory.ID {
continue
}
for _, buildReference := range a.BuildReferences {
if buildReference.CveID == advisoryCve.CveID {
advisory.BuildArtifacts = append(advisory.BuildArtifacts, fmt.Sprintf("%s:::%s", buildReference.Rpm, buildReference.SrcRpm))
}
}
for _, cve := range a.Cves {
if cve.ID == advisoryCve.CveID {
cveString := fmt.Sprintf("%s:::%s:::%s", cve.SourceBy.String, cve.SourceLink.String, cve.ID)
if !utils.StrContains(cveString, advisory.Cves) {
advisory.Cves = append(advisory.Cves, cveString)
}
}
}
for _, val := range a.AffectedProducts {
if val.CveID.String == advisoryCve.CveID {
for _, product := range a.Products {
if val.ProductID == product.ID {
if !utils.StrContains(product.Name, advisory.AffectedProducts) {
advisory.AffectedProducts = append(advisory.AffectedProducts, product.Name)
}
}
}
}
}
}
for _, advisoryFix := range a.AdvisoryFixes {
if advisoryFix.AdvisoryID != advisory.ID {
continue
}
for _, fix := range a.Fixes {
if fix.ID == advisoryFix.FixID {
if !utils.StrContains(fix.Ticket.String, advisory.Fixes) {
advisory.Fixes = append(advisory.Fixes, fix.Ticket.String)
}
}
}
}
for _, advisoryReference := range a.AdvisoryReferences {
if advisoryReference.AdvisoryId != advisory.ID {
continue
}
if !utils.StrContains(advisoryReference.URL, advisory.References) {
advisory.References = append(advisory.References, advisoryReference.URL)
}
}
for _, advisoryRPM := range a.AdvisoryRPMs {
if advisoryRPM.AdvisoryID != advisory.ID {
continue
}
if !utils.StrContains(advisoryRPM.Name, advisory.RPMs) {
advisory.RPMs = append(advisory.RPMs, advisoryRPM.Name)
}
}
}
return advisories
}
func (a *Access) GetAllAdvisories(filters *apollopb.AdvisoryFilters, page int32, limit int32) ([]*apollodb.Advisory, error) {
return a.getAdvisoriesWithJoin(func(advisory *apollodb.Advisory) bool {
if filters.Product != nil {
if !utils.StrContains(filters.Product.Value, advisory.AffectedProducts) {
return false
}
}
if advisory.PublishedAt.Valid {
if filters.Before != nil {
if advisory.PublishedAt.Time.After(filters.Before.AsTime()) {
return false
}
}
if filters.After != nil {
if advisory.PublishedAt.Time.Before(filters.After.AsTime()) {
return false
}
}
}
if filters.IncludeUnpublished != nil {
if !filters.IncludeUnpublished.Value && !advisory.PublishedAt.Valid {
return false
}
} else {
if !advisory.PublishedAt.Valid {
return false
}
}
if advisory.Fixes != nil && len(advisory.Fixes) < 1 {
return false
}
return true
}), nil
}
func (a *Access) GetAdvisoryByCodeAndYearAndNum(code string, year int, num int) (*apollodb.Advisory, error) {
advisories := a.getAdvisoriesWithJoin(func(advisory *apollodb.Advisory) bool {
if advisory.ShortCodeCode == code && advisory.Year == year && advisory.Num == num {
return true
}
return false
})
if len(advisories) == 0 {
return nil, sql.ErrNoRows
}
advisory := advisories[0]
if advisory.Fixes != nil && len(advisory.Fixes) < 1 {
return nil, fmt.Errorf("Expected advisory fixes. Was empty.")
}
return advisory, nil
}
func (a *Access) CreateAdvisory(advisory *apollodb.Advisory) (*apollodb.Advisory, error) {
var lastId int64 = 1
if len(a.Advisories) > 0 {
lastId = a.Advisories[len(a.Advisories)-1].ID + 1
}
now := time.Now()
ret := &apollodb.Advisory{
ID: lastId,
CreatedAt: &now,
Year: advisory.Year,
Num: advisory.Num,
Synopsis: advisory.Synopsis,
Topic: advisory.Topic,
Severity: advisory.Severity,
Type: advisory.Type,
Description: advisory.Description,
Solution: advisory.Solution,
RedHatIssuedAt: advisory.RedHatIssuedAt,
ShortCodeCode: advisory.ShortCodeCode,
PublishedAt: advisory.PublishedAt,
}
return ret, nil
}
func (a *Access) UpdateAdvisory(advisory *apollodb.Advisory) (*apollodb.Advisory, error) {
for _, val := range a.Advisories {
if val.ID == advisory.ID {
val.Year = advisory.Year
val.Num = advisory.Num
val.Synopsis = advisory.Synopsis
val.Topic = advisory.Topic
val.Severity = advisory.Severity
val.Type = advisory.Type
val.Description = advisory.Description
val.Solution = advisory.Solution
val.ShortCodeCode = advisory.ShortCodeCode
val.PublishedAt = advisory.PublishedAt
return val, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) GetAllUnresolvedCVEs() ([]*apollodb.CVE, error) {
var cves []*apollodb.CVE
var addedCVEIds []string
for _, cve := range a.Cves {
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.CveID.String == cve.ID {
switch affectedProduct.State {
case
int(apollopb.AffectedProduct_STATE_UNDER_INVESTIGATION_UPSTREAM),
int(apollopb.AffectedProduct_STATE_UNDER_INVESTIGATION_DOWNSTREAM),
int(apollopb.AffectedProduct_STATE_AFFECTED_UPSTREAM),
int(apollopb.AffectedProduct_STATE_AFFECTED_DOWNSTREAM):
nCve := *cve
nCve.AffectedProductId = sql.NullInt64{Valid: true, Int64: affectedProduct.ID}
cves = append(cves, &nCve)
break
}
}
}
}
for _, cve := range a.Cves {
if !utils.StrContains(cve.ID, addedCVEIds) {
cves = append(cves, cve)
}
}
return cves, nil
}
func (a *Access) GetPendingAffectedProducts() ([]*apollodb.AffectedProduct, error) {
var ret []*apollodb.AffectedProduct
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.State == int(apollopb.AffectedProduct_STATE_FIXED_UPSTREAM) {
ret = append(ret, affectedProduct)
}
}
return ret, nil
}
func (a *Access) GetAllCVEsFixedDownstream() ([]*apollodb.CVE, error) {
var cves []*apollodb.CVE
for _, cve := range a.Cves {
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.CveID.String == cve.ID {
if affectedProduct.State == int(apollopb.AffectedProduct_STATE_FIXED_DOWNSTREAM) {
nCve := *cve
nCve.AffectedProductId = sql.NullInt64{Valid: true, Int64: affectedProduct.ID}
cves = append(cves, &nCve)
break
}
}
}
}
return cves, nil
}
func (a *Access) GetCVEByID(id string) (*apollodb.CVE, error) {
for _, cve := range a.Cves {
if cve.ID == id {
return cve, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) GetAllCVEs() ([]*apollodb.CVE, error) {
return a.Cves, nil
}
func (a *Access) CreateCVE(cveId string, shortCode string, sourceBy *string, sourceLink *string, content types.NullJSONText) (*apollodb.CVE, error) {
var sby sql.NullString
var sl sql.NullString
if sourceBy != nil {
sby.String = *sourceBy
sby.Valid = true
}
if sourceLink != nil {
sl.String = *sourceLink
sl.Valid = true
}
now := time.Now()
cve := &apollodb.CVE{
ID: cveId,
CreatedAt: &now,
AdvisoryId: sql.NullInt64{},
ShortCode: shortCode,
SourceBy: sby,
SourceLink: sl,
Content: content,
}
a.Cves = append(a.Cves, cve)
return cve, nil
}
func (a *Access) SetCVEContent(cveId string, content types.JSONText) error {
for _, cve := range a.Cves {
if cve.ID == cveId {
cve.Content = types.NullJSONText{Valid: true, JSONText: content}
return nil
}
}
return sql.ErrNoRows
}
func (a *Access) GetProductsByShortCode(code string) ([]*apollodb.Product, error) {
var products []*apollodb.Product
for _, product := range a.Products {
if product.ShortCode == code {
products = append(products, product)
}
}
return products, nil
}
func (a *Access) GetProductByNameAndShortCode(name string, code string) (*apollodb.Product, error) {
for _, product := range a.Products {
if product.Name == name && product.ShortCode == code {
return product, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) GetProductByID(id int64) (*apollodb.Product, error) {
for _, product := range a.Products {
if product.ID == id {
return product, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) CreateProduct(name string, currentFullVersion string, redHatMajorVersion *int32, code string, archs []string) (*apollodb.Product, error) {
var lastId int64 = 1
if len(a.Products) > 0 {
lastId = a.Products[len(a.Products)-1].ID + 1
}
var rhmv sql.NullInt32
if redHatMajorVersion != nil {
rhmv.Int32 = *redHatMajorVersion
rhmv.Valid = true
}
product := &apollodb.Product{
ID: lastId,
Name: name,
CurrentFullVersion: currentFullVersion,
RedHatMajorVersion: rhmv,
ShortCode: code,
Archs: archs,
MirrorFromDate: sql.NullTime{},
RedHatProductPrefix: sql.NullString{},
}
a.Products = append(a.Products, product)
return product, nil
}
func (a *Access) GetAllAffectedProductsByCVE(cve string) ([]*apollodb.AffectedProduct, error) {
var affectedProducts []*apollodb.AffectedProduct
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.CveID.String == cve {
affectedProducts = append(affectedProducts, affectedProduct)
}
}
return affectedProducts, nil
}
func (a *Access) GetAffectedProductByCVEAndPackage(cve string, pkg string) (*apollodb.AffectedProduct, error) {
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.CveID.String == cve && affectedProduct.Package == pkg {
return affectedProduct, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) GetAffectedProductByAdvisory(advisory string) (*apollodb.AffectedProduct, error) {
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.Advisory.String == advisory {
return affectedProduct, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) GetAffectedProductByID(id int64) (*apollodb.AffectedProduct, error) {
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.ID == id {
return affectedProduct, nil
}
}
return nil, sql.ErrNoRows
}
func (a *Access) CreateAffectedProduct(productId int64, cveId string, state int, version string, pkg string, advisory *string) (*apollodb.AffectedProduct, error) {
var lastId int64 = 1
if len(a.AffectedProducts) > 0 {
lastId = a.AffectedProducts[len(a.AffectedProducts)-1].ID + 1
}
var adv sql.NullString
if advisory != nil {
adv.String = *advisory
adv.Valid = true
}
affectedProduct := &apollodb.AffectedProduct{
ID: lastId,
ProductID: productId,
CveID: sql.NullString{Valid: true, String: cveId},
State: state,
Version: version,
Package: pkg,
Advisory: adv,
}
a.AffectedProducts = append(a.AffectedProducts, affectedProduct)
return affectedProduct, nil
}
func (a *Access) UpdateAffectedProductStateAndPackageAndAdvisory(id int64, state int, pkg string, advisory *string) error {
for _, affectedProduct := range a.AffectedProducts {
if affectedProduct.ID == id {
affectedProduct.State = state
affectedProduct.Package = pkg
var adv sql.NullString
if advisory != nil {
adv.String = *advisory
adv.Valid = true
}
affectedProduct.Advisory = adv
return nil
}
}
return sql.ErrNoRows
}
func (a *Access) DeleteAffectedProduct(id int64) error {
var index *int
for i, affectedProduct := range a.AffectedProducts {
if affectedProduct.ID == id {
index = &i
}
}
if index == nil {
return sql.ErrNoRows
}
a.AffectedProducts = append(a.AffectedProducts[:*index], a.AffectedProducts[*index+1:]...)
return nil
}
func (a *Access) CreateFix(ticket string, sourceBy string, sourceLink string, description string) (int64, error) {
var lastId int64 = 1
if len(a.Fixes) > 0 {
lastId = a.Fixes[len(a.Fixes)-1].ID + 1
}
fix := &apollodb.Fix{
ID: lastId,
Ticket: sql.NullString{Valid: true, String: ticket},
SourceBy: sql.NullString{Valid: true, String: sourceBy},
SourceLink: sql.NullString{Valid: true, String: sourceLink},
Description: sql.NullString{Valid: true, String: description},
}
a.Fixes = append(a.Fixes, fix)
return lastId, nil
}
func (a *Access) GetMirrorState(code string) (*apollodb.MirrorState, error) {
var lastSync *apollodb.MirrorState
for _, mirrorState := range a.MirrorStates {
if mirrorState.ShortCode == code {
if mirrorState.LastSync.Valid {
lastSync = mirrorState
}
}
}
if lastSync == nil {
return nil, sql.ErrNoRows
}
return lastSync, nil
}
func (a *Access) UpdateMirrorState(code string, lastSync *time.Time) error {
for _, mirrorState := range a.MirrorStates {
if mirrorState.ShortCode == code {
mirrorState.LastSync.Time = *lastSync
mirrorState.LastSync.Valid = true
return nil
}
}
mirrorState := &apollodb.MirrorState{
ShortCode: code,
LastSync: sql.NullTime{Valid: true, Time: *lastSync},
}
a.MirrorStates = append(a.MirrorStates, mirrorState)
return nil
}
func (a *Access) UpdateMirrorStateErrata(code string, lastSync *time.Time) error {
for _, mirrorState := range a.MirrorStates {
if mirrorState.ShortCode == code {
mirrorState.ErrataAfter.Time = *lastSync
mirrorState.ErrataAfter.Valid = true
return nil
}
}
mirrorState := &apollodb.MirrorState{
ShortCode: code,
ErrataAfter: sql.NullTime{Valid: true, Time: *lastSync},
}
a.MirrorStates = append(a.MirrorStates, mirrorState)
return nil
}
func (a *Access) GetMaxLastSync() (*time.Time, error) {
var maxLastSync *time.Time
for _, mirrorState := range a.MirrorStates {
if mirrorState.LastSync.Valid {
if maxLastSync == nil || mirrorState.LastSync.Time.After(*maxLastSync) {
maxLastSync = &mirrorState.LastSync.Time
}
}
}
if maxLastSync == nil {
return nil, sql.ErrNoRows
}
return maxLastSync, nil
}
func (a *Access) CreateBuildReference(affectedProductId int64, rpm string, srcRpm string, cveId string, sha256Sum string, kojiId *string, peridotId *string) (*apollodb.BuildReference, error) {
var lastId int64 = 1
if len(a.BuildReferences) > 0 {
lastId = a.BuildReferences[len(a.BuildReferences)-1].ID + 1
}
buildReference := &apollodb.BuildReference{
ID: lastId,
AffectedProductId: affectedProductId,
Rpm: rpm,
SrcRpm: srcRpm,
CveID: cveId,
Sha256Sum: sha256Sum,
}
if kojiId != nil {
buildReference.KojiID = sql.NullString{Valid: true, String: *kojiId}
}
if peridotId != nil {
buildReference.PeridotID = sql.NullString{Valid: true, String: *peridotId}
}
a.BuildReferences = append(a.BuildReferences, buildReference)
return buildReference, nil
}
func (a *Access) CreateAdvisoryReference(advisoryId int64, url string) error {
var lastId int64 = 1
if len(a.AdvisoryReferences) > 0 {
lastId = a.AdvisoryReferences[len(a.AdvisoryReferences)-1].ID + 1
}
advisoryReference := &apollodb.AdvisoryReference{
ID: lastId,
URL: url,
AdvisoryId: advisoryId,
}
a.AdvisoryReferences = append(a.AdvisoryReferences, advisoryReference)
return nil
}
func (a *Access) GetAllIgnoredPackagesByProductID(productID int64) ([]string, error) {
var packages []string
for _, ignoredPackage := range a.IgnoredUpstreamPackages {
if ignoredPackage.ProductID == productID {
packages = append(packages, ignoredPackage.Package)
}
}
return packages, nil
}
func (a *Access) GetAllRebootSuggestedPackages() ([]string, error) {
var packages []string
for _, p := range a.RebootSuggestedPackages {
packages = append(packages, p.Name)
}
return packages, nil
}
func (a *Access) AddAdvisoryFix(advisoryId int64, fixId int64) error {
advisoryFix := &apollodb.AdvisoryFix{
AdvisoryID: advisoryId,
FixID: fixId,
}
a.AdvisoryFixes = append(a.AdvisoryFixes, advisoryFix)
return nil
}
func (a *Access) AddAdvisoryCVE(advisoryId int64, cveId string) error {
advisoryCVE := &apollodb.AdvisoryCVE{
AdvisoryID: advisoryId,
CveID: cveId,
}
a.AdvisoryCVEs = append(a.AdvisoryCVEs, advisoryCVE)
return nil
}
func (a *Access) AddAdvisoryRPM(advisoryId int64, name string, productID int64) error {
advisoryRPM := &apollodb.AdvisoryRPM{
AdvisoryID: advisoryId,
Name: name,
ProductID: productID,
}
a.AdvisoryRPMs = append(a.AdvisoryRPMs, advisoryRPM)
return nil
}
func (a *Access) Begin() (utils.Tx, error) {
return &utils.MockTx{}, nil
}
func (a *Access) UseTransaction(_ utils.Tx) apollodb.Access {
return a
}

View File

@ -1,15 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "psql",
srcs = ["psql.go"],
importpath = "peridot.resf.org/apollo/db/psql",
visibility = ["//visibility:public"],
deps = [
"//apollo/db",
"//apollo/proto/v1:pb",
"//utils",
"//vendor/github.com/jmoiron/sqlx",
"//vendor/github.com/jmoiron/sqlx/types",
],
)

View File

@ -1,797 +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 apollopsql
import (
"database/sql"
"github.com/jmoiron/sqlx/types"
apollodb "peridot.resf.org/apollo/db"
apollopb "peridot.resf.org/apollo/pb"
"time"
"github.com/jmoiron/sqlx"
"peridot.resf.org/utils"
)
type Access struct {
db *sqlx.DB
query utils.SqlQuery
}
func New() *Access {
pgx := utils.PgInitx()
return &Access{
db: pgx,
query: pgx,
}
}
func (a *Access) GetAllShortCodes() ([]*apollodb.ShortCode, error) {
var shortCodes []*apollodb.ShortCode
err := a.query.Select(
&shortCodes,
`
select
code,
mode,
created_at,
archived_at
from short_codes
order by created_at desc
`,
)
if err != nil {
return nil, err
}
return shortCodes, nil
}
func (a *Access) GetShortCodeByCode(code string) (*apollodb.ShortCode, error) {
var shortCode apollodb.ShortCode
err := a.query.Get(&shortCode, "select code, mode, created_at from short_codes where code = $1", code)
if err != nil {
return nil, err
}
return &shortCode, nil
}
func (a *Access) CreateShortCode(code string, mode apollopb.ShortCode_Mode) (*apollodb.ShortCode, error) {
var shortCode apollodb.ShortCode
err := a.query.Get(&shortCode, "insert into short_codes (code, mode) values ($1, $2) returning code, mode, created_at", code, int(mode))
if err != nil {
return nil, err
}
return &shortCode, nil
}
func (a *Access) GetAllAdvisories(filters *apollopb.AdvisoryFilters, page int32, limit int32) ([]*apollodb.Advisory, error) {
if filters == nil {
filters = &apollopb.AdvisoryFilters{}
}
var advisories []*apollodb.Advisory
err := a.query.Select(
&advisories,
`
select
a.id,
a.created_at,
a.year,
a.num,
a.synopsis,
a.topic,
a.severity,
a.type,
a.description,
a.solution,
a.redhat_issued_at,
a.short_code_code,
a.reboot_suggested,
a.published_at,
array_remove(array_agg(distinct p.name), NULL) as affected_products,
(select array_agg(distinct(f.ticket || ':::' || f.source_by || ':::' || f.source_link || ':::' || f.description)) from advisory_fixes adf inner join fixes f on f.id = adf.fix_id where adf.advisory_id = a.id) as fixes,
(select array_agg(distinct(
case when c.content is null then c.source_by || ':::' || c.source_link || ':::' || c.id || ':::::::::'
else c.source_by || ':::' || c.source_link || ':::' || c.id || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_scoring_vector') || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_base_score') || ':::' || jsonb_extract_path_text(c.content, 'cwe')
end
)) from advisory_cves ac inner join cves c on c.id = ac.cve_id where ac.advisory_id = a.id) as cves,
(select array_agg(distinct(url)) from advisory_references where advisory_id = a.id) as references,
case when $4 :: bool = true then array(select distinct concat(rpm, ':::', src_rpm) from build_references where affected_product_id in (select id from affected_products where advisory = 'RH' || (case when a.type=1 then 'SA' when a.type=2 then 'BA' else 'EA' end) || '-' || a.year || ':' || a.num))
else array [] :: text[]
end as build_artifacts,
case when $7 :: bool = true then array(select distinct(ar.name || ':::' || p.name) from advisory_rpms ar inner join products p on p.id = ar.product_id where advisory_id = a.id)
else array [] :: text[]
end as rpms,
count(a.*) over() as total
from advisories a
inner join affected_products ap on ap.advisory = 'RH' || (case when a.type=1 then 'SA' when a.type=2 then 'BA' else 'EA' end) || '-' || a.year || ':' || a.num
inner join products p on ap.product_id = p.id
where
($1 :: text is null or p.name = $1 :: text)
and ($2 :: timestamp is null or a.published_at < $2 :: timestamp)
and ($3 :: timestamp is null or a.published_at > $3 :: timestamp)
and (a.published_at is not null or $4 :: bool = true)
and ($5 :: text is null or exists (select cve_id from advisory_cves where advisory_id = a.id and cve_id ilike '%' || $5 :: text || '%'))
and ($6 :: text is null or a.synopsis ilike '%' || $6 :: text || '%')
and ($8 :: text is null or ((a.synopsis ilike '%' || $8 :: text || '%') or (a.topic ilike '%' || $8 :: text || '%') or (a.description ilike '%' || $8 :: text || '%') or (a.solution ilike '%' || $8 :: text || '%') or exists (select cve_id from advisory_cves where advisory_id = a.id and cve_id ilike '%' || $8 :: text || '%') or (a.short_code_code || (case when a.type=1 then 'SA' when a.type=2 then 'BA' else 'EA' end) || '-' || a.year || ':' || a.num ilike '%' || $8 :: text || '%')))
and ($9 :: numeric = 0 or a.severity = $9 :: numeric)
and ($10 :: numeric = 0 or a.type = $10 :: numeric)
group by a.id
order by a.published_at desc
limit $11 offset $12
`,
utils.StringValueToNullString(filters.Product),
utils.TimestampToNullTime(filters.Before),
utils.TimestampToNullTime(filters.After),
utils.BoolValueP(filters.IncludeUnpublished),
utils.StringValueToNullString(filters.Cve),
utils.StringValueToNullString(filters.Synopsis),
utils.BoolValueP(filters.IncludeRpms),
utils.StringValueToNullString(filters.Keyword),
int32(filters.Severity),
int32(filters.Type),
utils.UnlimitedLimit(limit),
utils.GetOffset(page, limit),
)
if err != nil {
return nil, err
}
return advisories, nil
}
func (a *Access) GetAdvisoryByCodeAndYearAndNum(code string, year int, num int) (*apollodb.Advisory, error) {
var advisory apollodb.Advisory
err := a.query.Get(
&advisory,
`
select
a.id,
a.created_at,
a.year,
a.num,
a.synopsis,
a.topic,
a.severity,
a.type,
a.description,
a.solution,
a.redhat_issued_at,
a.short_code_code,
a.reboot_suggested,
a.published_at,
array_remove(array_agg(distinct p.name), NULL) as affected_products,
(select array_agg(distinct(f.ticket || ':::' || f.source_by || ':::' || f.source_link || ':::' || f.description)) from advisory_fixes adf inner join fixes f on f.id = adf.fix_id where adf.advisory_id = a.id) as fixes,
(select array_agg(distinct(
case when c.content is null then c.source_by || ':::' || c.source_link || ':::' || c.id || ':::::::::'
else c.source_by || ':::' || c.source_link || ':::' || c.id || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_scoring_vector') || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_base_score') || ':::' || jsonb_extract_path_text(c.content, 'cwe')
end
)) from advisory_cves ac inner join cves c on c.id = ac.cve_id where ac.advisory_id = a.id) as cves,
(select array_agg(distinct(url)) from advisory_references where advisory_id = a.id) as references,
(select array_agg(distinct(ar.name || ':::' || p.name)) from advisory_rpms ar inner join products p on p.id = ar.product_id where advisory_id = a.id) as rpms
from advisories a
inner join affected_products ap on ap.advisory = 'RH' || (case when a.type=1 then 'SA' when a.type=2 then 'BA' else 'EA' end) || '-' || a.year || ':' || a.num
inner join products p on ap.product_id = p.id
where
a.year = $1
and a.num = $2
and a.short_code_code = $3
group by a.id
`,
year,
num,
code,
)
if err != nil {
return nil, err
}
return &advisory, nil
}
func (a *Access) CreateAdvisory(advisory *apollodb.Advisory) (*apollodb.Advisory, error) {
var ret apollodb.Advisory
var redHatIssuedAt *time.Time
var publishedAt *time.Time
if advisory.RedHatIssuedAt.Valid {
redHatIssuedAt = &advisory.RedHatIssuedAt.Time
}
if advisory.PublishedAt.Valid {
publishedAt = &advisory.PublishedAt.Time
}
err := a.query.Get(
&ret,
`
insert into advisories
(year, num, synopsis, topic, severity, type, description, solution,
redhat_issued_at, short_code_code, reboot_suggested, published_at)
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
returning
id,
created_at,
year,
num,
synopsis,
topic,
severity,
type,
description,
solution,
redhat_issued_at,
short_code_code,
reboot_suggested,
published_at
`,
advisory.Year,
advisory.Num,
advisory.Synopsis,
advisory.Topic,
advisory.Severity,
advisory.Type,
advisory.Description,
advisory.Solution,
redHatIssuedAt,
advisory.ShortCodeCode,
advisory.RebootSuggested,
publishedAt,
)
if err != nil {
return nil, err
}
return &ret, nil
}
func (a *Access) UpdateAdvisory(advisory *apollodb.Advisory) (*apollodb.Advisory, error) {
var ret apollodb.Advisory
var publishedAt *time.Time
if advisory.PublishedAt.Valid {
publishedAt = &advisory.PublishedAt.Time
}
err := a.query.Get(
&ret,
`
update advisories
set
year = $1,
num = $2,
synopsis = $3,
topic = $4,
severity = $5,
type = $6,
description = $7,
solution = $8,
short_code_code = $9,
reboot_suggested = $10,
published_at = $11
where
id = $12
returning
id,
created_at,
year,
num,
synopsis,
topic,
severity,
type,
description,
solution,
redhat_issued_at,
short_code_code,
reboot_suggested,
published_at
`,
advisory.Year,
advisory.Num,
advisory.Synopsis,
advisory.Topic,
advisory.Severity,
advisory.Type,
advisory.Description,
advisory.Solution,
advisory.ShortCodeCode,
advisory.RebootSuggested,
publishedAt,
advisory.ID,
)
if err != nil {
return nil, err
}
return &ret, nil
}
func (a *Access) GetAllUnresolvedCVEs() ([]*apollodb.CVE, error) {
var cves []*apollodb.CVE
err := a.query.Select(
&cves,
`
select
c.id,
c.created_at,
c.short_code_code,
c.source_by,
c.source_link,
c.content,
ap.id as affected_product_id
from cves c
left join affected_products ap on ap.cve_id = c.id
where (ap.state is null or ap.state in (1, 2, 8, 9))
`,
)
if err != nil {
return nil, err
}
return cves, nil
}
func (a *Access) GetPendingAffectedProducts() ([]*apollodb.AffectedProduct, error) {
var ret []*apollodb.AffectedProduct
err := a.query.Select(
&ret,
`
select
ap.id,
ap.product_id,
ap.cve_id,
ap.state,
ap.version,
ap.package,
ap.advisory
from affected_products ap
where ap.state = 3
`,
)
if err != nil {
return nil, err
}
return ret, nil
}
func (a *Access) GetAllCVEsFixedDownstream() ([]*apollodb.CVE, error) {
var cves []*apollodb.CVE
err := a.query.Select(
&cves,
`
select
c.id,
c.created_at,
c.short_code_code,
c.source_by,
c.source_link,
c.content,
ap.id as affected_product_id
from cves c
inner join affected_products ap on ap.cve_id = c.id
where
ap.state = 4
`,
)
if err != nil {
return nil, err
}
return cves, nil
}
func (a *Access) GetCVEByID(id string) (*apollodb.CVE, error) {
var cve apollodb.CVE
err := a.query.Get(&cve, "select id, created_at, short_code_code, source_by, source_link, content from cves where id = $1", id)
if err != nil {
return nil, err
}
return &cve, nil
}
func (a *Access) GetAllCVEs() ([]*apollodb.CVE, error) {
var cves []*apollodb.CVE
err := a.query.Select(&cves, "select id, created_at, short_code_code, source_by, source_link, content from cves")
if err != nil {
return nil, err
}
return cves, nil
}
func (a *Access) CreateCVE(cveId string, shortCode string, sourceBy *string, sourceLink *string, content types.NullJSONText) (*apollodb.CVE, error) {
var cve apollodb.CVE
err := a.query.Get(&cve, "insert into cves (id, short_code_code, source_by, source_link, content) values ($1, $2, $3, $4, $5) returning id, created_at, short_code_code, source_by, source_link, content", cveId, shortCode, sourceBy, sourceLink, content)
if err != nil {
return nil, err
}
return &cve, nil
}
func (a *Access) SetCVEContent(cveId string, content types.JSONText) error {
_, err := a.query.Exec("update cves set content = $1 where id = $2", content, cveId)
return err
}
func (a *Access) GetProductsByShortCode(code string) ([]*apollodb.Product, error) {
var products []*apollodb.Product
err := a.query.Select(
&products,
`
select
id,
name,
current_full_version,
redhat_major_version,
short_code_code,
archs,
mirror_from_date,
redhat_product_prefix,
cpe,
eol_at,
build_system,
build_system_endpoint,
koji_compose,
koji_module_compose,
peridot_project_id
from products
where
short_code_code = $1
and (eol_at < now() or eol_at is null)
`,
code,
)
if err != nil {
return nil, err
}
return products, nil
}
func (a *Access) GetProductByNameAndShortCode(name string, code string) (*apollodb.Product, error) {
var product apollodb.Product
err := a.query.Get(
&product,
`
select
id,
name,
current_full_version,
redhat_major_version,
short_code_code,
archs,
mirror_from_date,
redhat_product_prefix,
cpe,
eol_at,
build_system,
build_system_endpoint,
koji_compose,
koji_module_compose,
peridot_project_id
from products
where
name = $1
and short_code_code = $2
`,
name,
code,
)
if err != nil {
return nil, err
}
return &product, nil
}
func (a *Access) GetProductByID(id int64) (*apollodb.Product, error) {
var product apollodb.Product
err := a.query.Get(
&product,
`
select
id,
name,
current_full_version,
redhat_major_version,
short_code_code,
archs,
mirror_from_date,
redhat_product_prefix,
cpe,
eol_at,
build_system,
build_system_endpoint,
koji_compose,
koji_module_compose,
peridot_project_id
from products
where
id = $1
`,
id,
)
if err != nil {
return nil, err
}
return &product, nil
}
func (a *Access) CreateProduct(name string, currentFullVersion string, redHatMajorVersion *int32, code string, archs []string) (*apollodb.Product, error) {
var product apollodb.Product
err := a.query.Get(&product, "insert into products (name, current_full_version, redhat_major_version, short_code_code, archs) values ($1, $2, $3, $4) returning id, name, current_full_version, redhat_major_version, short_code_code, archs", name, currentFullVersion, redHatMajorVersion, code, archs)
if err != nil {
return nil, err
}
return &product, nil
}
func (a *Access) GetAllAffectedProductsByCVE(cve string) ([]*apollodb.AffectedProduct, error) {
var affectedProducts []*apollodb.AffectedProduct
err := a.query.Select(&affectedProducts, "select id, product_id, cve_id, state, version, package, advisory from affected_products where cve_id = $1", cve)
if err != nil {
return nil, err
}
return affectedProducts, nil
}
func (a *Access) GetAffectedProductByCVEAndPackage(cve string, pkg string) (*apollodb.AffectedProduct, error) {
var affectedProduct apollodb.AffectedProduct
err := a.query.Get(&affectedProduct, "select id, product_id, cve_id, state, version, package, advisory from affected_products where cve_id = $1 and package = $2", cve, pkg)
if err != nil {
return nil, err
}
return &affectedProduct, nil
}
func (a *Access) GetAffectedProductByAdvisory(advisory string) (*apollodb.AffectedProduct, error) {
var affectedProduct apollodb.AffectedProduct
err := a.query.Get(&affectedProduct, "select id, product_id, cve_id, state, version, package, advisory from affected_products where advisory = $1", advisory)
if err != nil {
return nil, err
}
return &affectedProduct, nil
}
func (a *Access) GetAffectedProductByID(id int64) (*apollodb.AffectedProduct, error) {
var affectedProduct apollodb.AffectedProduct
err := a.query.Get(&affectedProduct, "select id, product_id, cve_id, state, version, package, advisory from affected_products where id = $1", id)
if err != nil {
return nil, err
}
return &affectedProduct, nil
}
func (a *Access) CreateAffectedProduct(productId int64, cveId string, state int, version string, pkg string, advisory *string) (*apollodb.AffectedProduct, error) {
var affectedProduct apollodb.AffectedProduct
err := a.query.Get(&affectedProduct, "insert into affected_products (product_id, cve_id, state, version, package, advisory) values ($1, $2, $3, $4, $5, $6) returning id, product_id, cve_id, state, version, package, advisory", productId, cveId, state, version, pkg, advisory)
if err != nil {
return nil, err
}
return &affectedProduct, nil
}
func (a *Access) UpdateAffectedProductStateAndPackageAndAdvisory(id int64, state int, pkg string, advisory *string) error {
_, err := a.query.Exec(
`
update affected_products
set
state = $1,
package = $2,
advisory = $3
where id = $4
`,
state,
pkg,
advisory,
id,
)
return err
}
func (a *Access) DeleteAffectedProduct(id int64) error {
_, err := a.query.Exec(
`
delete from affected_products
where id = $1
`,
id,
)
return err
}
func (a *Access) CreateFix(ticket string, sourceBy string, sourceLink, description string) (int64, error) {
var id int64
err := a.query.Get(&id, "insert into fixes (ticket, source_by, source_link, description) values ($1, $2, $3, $4) returning id", ticket, sourceBy, sourceLink, description)
return id, err
}
func (a *Access) GetMirrorState(code string) (*apollodb.MirrorState, error) {
var lastSync apollodb.MirrorState
err := a.query.Get(&lastSync, "select short_code_code, last_sync, errata_after from mirror_state where short_code_code = $1", code)
if err != nil {
if err == sql.ErrNoRows {
return nil, nil
}
return nil, err
}
return &lastSync, nil
}
func (a *Access) UpdateMirrorState(code string, lastSync *time.Time) error {
_, err := a.query.Exec(
`
insert into mirror_state (short_code_code, last_sync)
values ($1, $2)
on conflict (short_code_code) do
update
set last_sync = EXCLUDED.last_sync
`,
code,
lastSync,
)
return err
}
func (a *Access) UpdateMirrorStateErrata(code string, lastSync *time.Time) error {
_, err := a.query.Exec(
`
insert into mirror_state (short_code_code, errata_after)
values ($1, $2)
on conflict (short_code_code) do
update
set errata_after = EXCLUDED.errata_after
`,
code,
lastSync,
)
return err
}
func (a *Access) GetMaxLastSync() (*time.Time, error) {
var lastSync time.Time
err := a.query.Get(&lastSync, "select max(last_sync) from mirror_state")
if err != nil {
return nil, err
}
return &lastSync, nil
}
func (a *Access) CreateBuildReference(affectedProductId int64, rpm string, srcRpm string, cveId string, sha256Sum string, kojiId *string, peridotId *string) (*apollodb.BuildReference, error) {
var buildReference apollodb.BuildReference
err := a.query.Get(
&buildReference,
`
insert into build_references
(affected_product_id, rpm, src_rpm, cve_id, sha256_sum, koji_id, peridot_id)
values ($1, $2, $3, $4, $5, $6, $7)
returning id, affected_product_id, rpm, src_rpm, cve_id, sha256_sum, koji_id, peridot_id
`,
affectedProductId,
rpm,
srcRpm,
cveId,
sha256Sum,
kojiId,
peridotId,
)
if err != nil {
return nil, err
}
return &buildReference, nil
}
func (a *Access) CreateAdvisoryReference(advisoryId int64, url string) error {
_, err := a.query.Exec("insert into advisory_references (advisory_id, url) values ($1, $2)", advisoryId, url)
return err
}
func (a *Access) GetAllIgnoredPackagesByProductID(productID int64) ([]string, error) {
var packages []string
err := a.query.Select(&packages, "select package from ignored_upstream_packages where product_id = $1", productID)
if err != nil {
return nil, err
}
return packages, nil
}
func (a *Access) GetAllRebootSuggestedPackages() ([]string, error) {
var packages []string
err := a.query.Select(&packages, "select name from reboot_suggested_packages")
if err != nil {
return nil, err
}
return packages, nil
}
func (a *Access) AddAdvisoryFix(advisoryId int64, fixId int64) error {
_, err := a.query.Exec("insert into advisory_fixes (advisory_id, fix_id) values ($1, $2) on conflict do nothing", advisoryId, fixId)
if err != nil {
return err
}
return nil
}
func (a *Access) AddAdvisoryCVE(advisoryId int64, cveId string) error {
_, err := a.query.Exec("insert into advisory_cves (advisory_id, cve_id) values ($1, $2) on conflict do nothing", advisoryId, cveId)
if err != nil {
return err
}
return nil
}
func (a *Access) AddAdvisoryRPM(advisoryId int64, name string, productID int64) error {
_, err := a.query.Exec("insert into advisory_rpms (advisory_id, name, product_id) values ($1, $2, $3) on conflict do nothing", advisoryId, name, productID)
if err != nil {
return err
}
return nil
}
func (a *Access) Begin() (utils.Tx, error) {
tx, err := a.db.Beginx()
if err != nil {
return nil, err
}
return tx, nil
}
func (a *Access) UseTransaction(tx utils.Tx) apollodb.Access {
newAccess := *a
newAccess.query = tx
return &newAccess
}

View File

@ -1,26 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "impl",
srcs = [
"advisory.go",
"server.go",
],
importpath = "peridot.resf.org/apollo/impl/v1",
visibility = ["//visibility:public"],
deps = [
"//apollo/db",
"//apollo/proto/v1:pb",
"//apollo/rpmutils",
"//proto:common",
"//utils",
"//vendor/github.com/gorilla/feeds",
"//vendor/github.com/sirupsen/logrus",
"//vendor/github.com/spf13/viper",
"@go_googleapis//google/api:httpbody_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
],
)

View File

@ -1,185 +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 apolloimpl
import (
"context"
"database/sql"
"fmt"
"github.com/gorilla/feeds"
"github.com/sirupsen/logrus"
"google.golang.org/genproto/googleapis/api/httpbody"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
apollodb "peridot.resf.org/apollo/db"
apollopb "peridot.resf.org/apollo/pb"
"peridot.resf.org/apollo/rpmutils"
"peridot.resf.org/utils"
"strconv"
"time"
)
// ListAdvisories returns advisories with given filters
func (s *Server) ListAdvisories(_ context.Context, req *apollopb.ListAdvisoriesRequest) (*apollopb.ListAdvisoriesResponse, error) {
if err := req.ValidateAll(); err != nil {
return nil, err
}
if req.Filters != nil {
req.Filters.IncludeUnpublished = nil
}
page := utils.MinPage(req.Page)
limit := utils.MinLimit(req.Limit)
ret, err := s.db.GetAllAdvisories(req.Filters, page, limit)
if err != nil {
s.log.Errorf("could not get advisories, error: %s", err)
return nil, status.Error(codes.Internal, "failed to list advisories")
}
total := int64(0)
if len(ret) > 0 {
total = ret[0].Total
}
var lastUpdatedPb *timestamppb.Timestamp
lastUpdated, err := s.db.GetMaxLastSync()
if err != nil && err != sql.ErrNoRows {
s.log.Errorf("could not get last sync time, error: %s", err)
return nil, status.Error(codes.Internal, "failed to get last updated")
}
if lastUpdated != nil {
lastUpdatedPb = timestamppb.New(*lastUpdated)
}
return &apollopb.ListAdvisoriesResponse{
Advisories: apollodb.DTOListAdvisoriesToPB(ret),
Total: total,
Page: page,
Size: limit,
LastUpdated: lastUpdatedPb,
}, nil
}
// ListAdvisoriesRSS returns advisories in RSS format. Only returns latest 25 published advisories
func (s *Server) ListAdvisoriesRSS(_ context.Context, req *apollopb.ListAdvisoriesRSSRequest) (*httpbody.HttpBody, error) {
if err := req.ValidateAll(); err != nil {
return nil, err
}
if req.Filters == nil {
req.Filters = &apollopb.AdvisoryFilters{}
}
req.Filters.IncludeUnpublished = nil
ret, err := s.db.GetAllAdvisories(req.Filters, 0, 25)
if err != nil {
s.log.Errorf("could not get advisories, error: %s", err)
return nil, status.Error(codes.Internal, "failed to list advisories")
}
total := int64(0)
if len(ret) > 0 {
total = ret[0].Total
}
var updated time.Time
if total != 0 {
updated = ret[0].PublishedAt.Time
}
feed := &feeds.Feed{
Title: "Apollo Security RSS Feed",
Link: &feeds.Link{Href: s.homepage},
Description: "Security advisories issued using Apollo Errata Management",
Author: &feeds.Author{
Name: "Rocky Enterprise Software Foundation, Inc.",
Email: "releng@rockylinux.org",
},
Updated: updated,
Items: []*feeds.Item{},
Copyright: "(C) Rocky Enterprise Software Foundation, Inc. 2022. All rights reserved. CVE sources are copyright of their respective owners.",
}
if s.rssFeedTitle != "" {
feed.Title = s.rssFeedTitle
}
if s.rssFeedDescription != "" {
feed.Description = s.rssFeedDescription
}
for _, a := range ret {
dtoToPB := apollodb.DTOAdvisoryToPB(a)
item := &feeds.Item{
Title: fmt.Sprintf("%s: %s", dtoToPB.Name, a.Synopsis),
Link: &feeds.Link{Href: fmt.Sprintf("%s/%s", s.homepage, dtoToPB.Name)},
Description: a.Topic,
Id: fmt.Sprintf("%d", a.ID),
Created: a.PublishedAt.Time,
}
feed.Items = append(feed.Items, item)
}
rss, err := feed.ToRss()
if err != nil {
s.log.Errorf("could not generate RSS feed, error: %s", err)
return nil, status.Error(codes.Internal, "failed to generate RSS feed")
}
return &httpbody.HttpBody{
ContentType: "application/rss+xml",
Data: []byte(rss),
}, nil
}
// GetAdvisory returns a single advisory by name
func (s *Server) GetAdvisory(_ context.Context, req *apollopb.GetAdvisoryRequest) (*apollopb.GetAdvisoryResponse, error) {
if err := req.ValidateAll(); err != nil {
return nil, err
}
advisoryId := rpmutils.AdvisoryId().FindStringSubmatch(req.Id)
code := advisoryId[1]
year, err := strconv.Atoi(advisoryId[3])
if err != nil {
return nil, status.Error(codes.InvalidArgument, "invalid year")
}
num, err := strconv.Atoi(advisoryId[4])
if err != nil {
return nil, status.Error(codes.InvalidArgument, "invalid num")
}
advisory, err := s.db.GetAdvisoryByCodeAndYearAndNum(code, year, num)
if err != nil {
logrus.Error(err)
}
if err != nil || !advisory.PublishedAt.Valid {
return nil, utils.CouldNotFindObject
}
return &apollopb.GetAdvisoryResponse{
Advisory: apollodb.DTOAdvisoryToPB(advisory),
}, nil
}

View File

@ -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 apolloimpl
import (
"context"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"google.golang.org/grpc"
apollodb "peridot.resf.org/apollo/db"
apollopb "peridot.resf.org/apollo/pb"
commonpb "peridot.resf.org/common"
"peridot.resf.org/utils"
)
type Server struct {
apollopb.UnimplementedApolloServiceServer
log *logrus.Logger
db apollodb.Access
rssFeedTitle string
rssFeedDescription string
homepage string
}
// NewServer creates a new Apollo server.
func NewServer(db apollodb.Access) *Server {
return &Server{
log: logrus.New(),
db: db,
rssFeedTitle: "RESF Errata Feed",
rssFeedDescription: "Advisories issued by the Rocky Enterprise Software Foundation",
homepage: viper.GetString("homepage"),
}
}
func (s *Server) interceptor(ctx context.Context, req interface{}, usi *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
n := utils.EndInterceptor
return n(ctx, req, usi, handler)
}
func (s *Server) Run() {
res := utils.NewGRPCServer(
&utils.GRPCOptions{
Interceptor: s.interceptor,
},
func(r *utils.Register) {
endpoints := []utils.GrpcEndpointRegister{
commonpb.RegisterHealthCheckServiceHandlerFromEndpoint,
apollopb.RegisterApolloServiceHandlerFromEndpoint,
}
for _, endpoint := range endpoints {
err := endpoint(r.Context, r.Mux, r.Endpoint, r.Options)
if err != nil {
s.log.Fatalf("could not register handler - %v", err)
}
}
},
func(r *utils.RegisterServer) {
commonpb.RegisterHealthCheckServiceServer(r.Server, &utils.HealthServer{})
apollopb.RegisterApolloServiceServer(r.Server, s)
},
)
defer res.Cancel()
res.WaitGroup.Wait()
}

View File

@ -1,33 +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.
*/
drop table short_codes;

View File

@ -1,40 +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.
*/
create table short_codes
(
code text not null primary key,
mode numeric not null,
created_at timestamp default now() not null,
archived_at timestamp
);

View File

@ -1,33 +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.
*/
drop table products;

View File

@ -1,51 +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.
*/
create table products
(
id bigserial primary key,
name text not null,
current_full_version text not null,
redhat_major_version numeric,
short_code_code text references short_codes (code) not null,
archs text[] not null,
mirror_from_date timestamp,
redhat_product_prefix text,
cpe text,
eol_at timestamp,
build_system text not null,
build_system_endpoint text not null,
koji_compose text,
koji_module_compose text,
peridot_project_id text
)

View File

@ -1,33 +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.
*/
drop table advisories;

View File

@ -1,52 +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.
*/
create table advisories
(
id bigserial primary key not null,
created_at timestamp default now() not null,
year numeric not null,
num numeric not null,
synopsis text not null,
topic text not null,
severity numeric not null,
type numeric not null,
description text not null,
solution text null,
redhat_issued_at timestamp null,
short_code_code text references short_codes (code) not null,
reboot_suggested bool default false not null,
published_at timestamp null
)

View File

@ -1,33 +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.
*/
drop table cves;

View File

@ -1,41 +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.
*/
create table cves
(
id text primary key,
created_at timestamp default now() not null,
short_code_code text references short_codes (code) not null,
source_by text,
source_link text
)

View File

@ -1,33 +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.
*/
drop table fixes;

View File

@ -1,40 +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.
*/
create table fixes
(
id bigserial primary key,
ticket text,
source_by text,
source_link text,
description text
)

View File

@ -1,33 +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.
*/
drop table advisory_references;

View File

@ -1,38 +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.
*/
create table advisory_references
(
id bigserial primary key,
url text not null,
advisory_id bigint references advisories (id) not null
)

View File

@ -1,33 +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.
*/
drop table affected_products;

View File

@ -1,42 +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.
*/
create table affected_products
(
id bigserial primary key,
product_id bigint references products (id) not null,
cve_id text references cves (id) not null,
state numeric not null,
version text not null,
package text not null,
advisory text
)

View File

@ -1,33 +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.
*/
drop table build_references;

View File

@ -1,43 +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.
*/
create table build_references
(
id bigserial primary key,
affected_product_id bigint references affected_products (id),
rpm text not null,
src_rpm text not null,
cve_id text references cves (id) not null,
sha256_sum text not null,
koji_id text,
peridot_id text
)

View File

@ -1,33 +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.
*/
drop table mirror_state;

View File

@ -1,38 +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.
*/
create table mirror_state
(
short_code_code text references short_codes (code) primary key,
last_sync timestamp,
errata_after timestamp
);

View File

@ -1,33 +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.
*/
drop table advisory_cves;

View File

@ -1,39 +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.
*/
create table advisory_cves
(
advisory_id bigint references advisories (id) not null,
cve_id text references cves (id) not null,
unique (advisory_id, cve_id)
)

View File

@ -1,33 +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.
*/
drop table advisory_fixes;

View File

@ -1,39 +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.
*/
create table advisory_fixes
(
advisory_id bigint references advisories (id) not null,
fix_id bigint references fixes (id) not null,
unique (advisory_id, fix_id)
)

View File

@ -1,33 +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.
*/
drop table ignored_upstream_packages;

View File

@ -1,38 +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.
*/
create table ignored_upstream_packages
(
id bigserial primary key,
product_id bigint references products (id) not null,
package text not null
);

View File

@ -1,33 +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.
*/
drop table advisory_rpms;

View File

@ -1,40 +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.
*/
create table advisory_rpms
(
advisory_id bigint references advisories (id) not null,
name text not null,
product_id bigint references products (id) not null,
unique (advisory_id, name)
)

View File

@ -1,33 +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.
*/
drop table updateinfo_history;

View File

@ -1,37 +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.
*/
create table updateinfo_history
(
repo text primary key,
xml text not null
);

View File

@ -1 +0,0 @@
drop table reboot_suggested_packages;

View File

@ -1,6 +0,0 @@
create table reboot_suggested_packages
(
created_at timestamp default now() not null,
name text unique not null
)

View File

@ -1,9 +0,0 @@
drop index affected_products_advisoryx;
drop index affected_products_product_idx;
drop index advisory_fixes_advisory_idx;
drop index advisory_fixes_fix_idx;
drop index advisory_cves_advisory_idx;
drop index advisory_cves_cve_idx;
drop index advisory_references_advisory_idx;
drop index advisory_rpms_advisory_idx;
drop index advisory_rpms_product_idx;

View File

@ -1,9 +0,0 @@
create index affected_products_advisoryx on affected_products (advisory);
create index affected_products_product_idx on affected_products (product_id);
create index advisory_fixes_advisory_idx on advisory_fixes (advisory_id);
create index advisory_fixes_fix_idx on advisory_fixes (fix_id);
create index advisory_cves_advisory_idx on advisory_cves (advisory_id);
create index advisory_cves_cve_idx on advisory_cves (cve_id);
create index advisory_references_advisory_idx on advisory_references (advisory_id);
create index advisory_rpms_advisory_idx on advisory_rpms (advisory_id);
create index advisory_rpms_product_idx on advisory_rpms (product_id);

View File

@ -1 +0,0 @@
alter table cves drop column content;

View File

@ -1 +0,0 @@
alter table cves add column content jsonb;

View File

@ -1,5 +0,0 @@
package(default_visibility = ["//visibility:public"])
load("//rules_resf:defs.bzl", "migration_tar")
migration_tar()

View File

@ -1,65 +0,0 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2:defs.bzl", "protoc_gen_openapiv2")
load("@openapi_tools_generator_bazel//:defs.bzl", "openapi_generator")
proto_library(
name = "apollopb_proto",
srcs = [
"advisory.proto",
"affected_product.proto",
"apollo.proto",
"build.proto",
"cve.proto",
"fix.proto",
"short_code.proto",
],
visibility = ["//visibility:public"],
deps = [
"@com_envoyproxy_protoc_gen_validate//validate:validate_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
"@go_googleapis//google/api:annotations_proto",
"@go_googleapis//google/api:httpbody_proto",
],
)
go_proto_library(
name = "apollopb_go_proto",
compilers = [
"//:go_apiv2",
"//:go_grpc",
"//:go_validate",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
],
importpath = "peridot.resf.org/apollo/pb",
proto = ":apollopb_proto",
visibility = ["//visibility:public"],
deps = [
"@com_envoyproxy_protoc_gen_validate//validate:validate_go_proto",
"@go_googleapis//google/api:annotations_go_proto",
"@go_googleapis//google/api:httpbody_go_proto",
],
)
go_library(
name = "pb",
embed = [":apollopb_go_proto"],
importpath = "peridot.resf.org/apollo/pb",
visibility = ["//visibility:public"],
)
protoc_gen_openapiv2(
name = "openapi",
proto = ":apollopb_proto",
simple_operation_ids = True,
single_output = True,
)
openapi_generator(
name = "client_typescript",
generator = "typescript-fetch",
spec = ":openapi",
visibility = ["//visibility:public"],
)

View File

@ -1,112 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "apollo/proto/v1/cve.proto";
import "apollo/proto/v1/fix.proto";
option go_package = "peridot.resf.org/apollo/pb;apollopb";
message RPMs {
repeated string nvras = 1;
}
// Advisory
//
// Product advisory
message Advisory {
enum Type {
TYPE_UNKNOWN = 0;
TYPE_SECURITY = 1;
TYPE_BUGFIX = 2;
TYPE_ENHANCEMENT = 3;
}
// Type
//
// Type of advisory
Type type = 1;
// Short code
//
// Errata prefix or short code
// Example: RLBA, RLEA, RLSA
string short_code = 2;
// Name
//
// Full errata name
// Example: RLBA-2021:0001, RLSA-2021:0002
string name = 3;
// Synopsis
//
// Short description of advisory
string synopsis = 4;
enum Severity {
SEVERITY_UNKNOWN = 0;
SEVERITY_LOW = 1;
SEVERITY_MODERATE = 2;
SEVERITY_IMPORTANT = 3;
SEVERITY_CRITICAL = 4;
}
// Severity
//
// Severity of advisory. Used only for security advisories
Severity severity = 5;
// Topic
//
// Topic of advisory
// Example: An update for the go-toolset:rhel8 module is now available for Rocky Linux 8.
string topic = 6;
// Description
//
// Description of advisory. Contains information about changes and package.
string description = 7;
// Solution
//
// How to solve the advisory. Contains information about how to apply the advisory changes
google.protobuf.StringValue solution = 8;
// Affected products
//
// A list of affected products
repeated string affected_products = 9;
// Fixes
//
// A list of tickets from upstream bug trackers
repeated Fix fixes = 10;
// CVEs
//
// A list of CVEs assigned to this advisory
repeated CVE cves = 11;
// References
//
// General references used in this advisory
repeated string references = 12;
// Published at
//
// Timestamp the advisory is published at
google.protobuf.Timestamp published_at = 13;
// RPMs
//
// Affected RPMs
map<string, RPMs> rpms = 14;
// Reboot suggested
//
// Whether a system reboot should be suggested after applying this advisory
bool reboot_suggested = 15;
}

View File

@ -1,41 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
import "google/protobuf/wrappers.proto";
option go_package = "peridot.resf.org/apollo/pb;apollopb";
message AffectedProduct {
int64 product_id = 1;
google.protobuf.StringValue cve_id = 2;
string version = 3;
enum State {
STATE_UNKNOWN = 0;
// CVE only affects downstream
STATE_UNDER_INVESTIGATION_DOWNSTREAM = 1;
// CVE affecting upstream and a fix still hasn't been issued
STATE_UNDER_INVESTIGATION_UPSTREAM = 2;
// CVE has been fixed upstream
STATE_FIXED_UPSTREAM = 3;
// CVE has been fixed downstream
// At this stage the CVE can be included in errata
STATE_FIXED_DOWNSTREAM = 4;
// CVE will NOT be fixed upstream
STATE_WILL_NOT_FIX_UPSTREAM = 5;
// CVE will NOT be fixed downstream
// This will probably never happen with Core, but may happen for SIGs
STATE_WILL_NOT_FIX_DOWNSTREAM = 6;
// CVE is out of support scope
STATE_OUT_OF_SUPPORT_SCOPE = 7;
// CVE affects product and upstream is working on a fix
STATE_AFFECTED_UPSTREAM = 8;
// CVE affects product and a fix is being worked out
STATE_AFFECTED_DOWNSTREAM = 9;
}
State state = 4;
string package = 5;
google.protobuf.StringValue advisory = 6;
}

View File

@ -1,161 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "validate/validate.proto";
import "apollo/proto/v1/advisory.proto";
option go_package = "peridot.resf.org/apollo/pb;apollopb";
service ApolloService {
// ListAdvisories
//
// Return a list of advisories by given filters.
// No filters returns all advisories
// This method is paginated
rpc ListAdvisories (ListAdvisoriesRequest) returns (ListAdvisoriesResponse) {
option (google.api.http) = {
get: "/v2/advisories"
};
}
// ListAdvisoriesRSS
//
// Same as ListAdvisories but returns an RSS feed
// Only returns 25 latest advisories
// Supports filters
rpc ListAdvisoriesRSS (ListAdvisoriesRSSRequest) returns (google.api.HttpBody) {
option (google.api.http) = {
get: "/v2/advisories:rss"
};
}
// GetAdvisory
//
// Returns an advisory with given ID if found, else returns NotFound
rpc GetAdvisory (GetAdvisoryRequest) returns (GetAdvisoryResponse) {
option (google.api.http) = {
get: "/v2/advisories/{id=*}"
};
}
}
message AdvisoryFilters {
// Product
//
// The product to fetch advisories for
// For example: Rocky Linux 8
google.protobuf.StringValue product = 1;
// Before
//
// Advisories published before timestamp
google.protobuf.Timestamp before = 2;
// After
//
// Advisories published after timestamp
google.protobuf.Timestamp after = 3;
// Include unpublished
//
// Whether to include unpublished advisories
// apollo/impl never respects this, but internal services
// may rely on this
google.protobuf.BoolValue include_unpublished = 4;
// CVE
//
// Only return advisories with given CVE
google.protobuf.StringValue cve = 5;
// Synopsis
//
// Only return advisories if synopsis contains given text
google.protobuf.StringValue synopsis = 6;
// Include RPMs
//
// Includes RPMs in list response (slow)
google.protobuf.BoolValue include_rpms = 7;
// Keyword
//
// Searches all fields for given keyword
google.protobuf.StringValue keyword = 8;
// Severity
//
// Only return advisories with given severity
Advisory.Severity severity = 9;
// Type
//
// Only return advisories with given type
Advisory.Type type = 10;
}
// ListAdvisoriesRequest
//
// Request body for `ListAdvisories`
// All fields are optional
message ListAdvisoriesRequest {
// Filters for the given query
// No filters returns all advisories
AdvisoryFilters filters = 1;
int32 page = 2;
int32 limit = 3 [(validate.rules).int32.lte = 100];
}
// ListAdvisoriesResponse
//
// Response body for `ListAdvisories`
message ListAdvisoriesResponse {
repeated Advisory advisories = 1;
// Total packages from server
int64 total = 2;
// Limit from request
int32 size = 3;
// Current page
int32 page = 4;
// Last updated
google.protobuf.Timestamp last_updated = 5;
}
// ListAdvisoriesRSSRequest
// Request body for `ListAdvisoriesRSS`
// All fields are optional
message ListAdvisoriesRSSRequest {
// Filters for the given query
// No filters returns all advisories
AdvisoryFilters filters = 1;
}
// GetAdvisoryRequest
//
// Request body for `GetAdvisory`
message GetAdvisoryRequest {
// ID
//
// Errata ID
// Example: RLSA:2021-1515
string id = 1 [(validate.rules).string = {
pattern: "^(.+)([SEB]A)-([0-9]{4}):([0-9]+)$",
}];
}
// GetAdvisoryResponse
//
// Response body for `GetAdvisory`
message GetAdvisoryResponse {
Advisory advisory = 1;
}

View File

@ -1,13 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
option go_package = "peridot.resf.org/apollo/pb;apollopb";
enum BuildStatus {
BUILD_STATUS_UNKNOWN = 0;
BUILD_STATUS_FIXED = 1;
BUILD_STATUS_NOT_FIXED = 2;
BUILD_STATUS_WILL_NOT_FIX = 3;
BUILD_STATUS_SKIP = 4;
}

View File

@ -1,28 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
import "google/protobuf/wrappers.proto";
option go_package = "peridot.resf.org/apollo/pb;apollopb";
message CVE {
string name = 1;
google.protobuf.StringValue source_by = 2;
google.protobuf.StringValue source_link = 3;
google.protobuf.StringValue cvss3_scoring_vector = 4;
google.protobuf.StringValue cvss3_base_score = 5;
google.protobuf.StringValue cwe = 6;
}
message ListUnresolvedCVEsRequest {}
message ListUnresolvedCVEsResponse {
repeated CVE cves = 1;
}
message ListFixedCVEsRequest {}
message ListFixedCVEsResponse {
repeated CVE cves = 1;
}

View File

@ -1,14 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
import "google/protobuf/wrappers.proto";
option go_package = "peridot.resf.org/apollo/pb;apollopb";
message Fix {
google.protobuf.StringValue ticket = 1;
google.protobuf.StringValue source_by = 2;
google.protobuf.StringValue source_link = 3;
google.protobuf.StringValue description = 4;
}

View File

@ -1,29 +0,0 @@
syntax = "proto3";
package resf.apollo.v1;
option go_package = "peridot.resf.org/apollo/pb;apollopb";
message ShortCode {
// Code
//
// Full short code
string code = 1;
enum Mode {
MODE_UNKNOWN = 0;
MODE_PUBLISH = 1;
MODE_MIRROR = 2;
}
// Mode
//
// Mode for short code
// Currently only publish and mirror is supported
Mode mode = 2;
// Archived
//
// Whether the short code is archived or not
// An archived short code CANNOT be used to issue errata
bool archived = 3;
}

View File

@ -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",
],
)

View File

@ -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
}

View File

@ -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
}

View File

@ -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, "<br/>")
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, "<br/>")...)
})
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
}

View File

@ -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])
}

View File

@ -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
}

View File

@ -1,697 +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.
-->
<div class='print-single'>
<dl class='details'>
<dt>Issued:</dt>
<dd>2021-07-16</dd>
<dt>Updated:</dt>
<dd>2021-07-16</dd>
</dl>
<h1>RHBA-2021:2759 - Bug Fix Advisory</h1>
<div id='tabs'>
<ul class='nav nav-tabs'>
<li><a role="tab" data-taggle="tab" href="#overview">Overview</a></li>
<li><a role="tab" data-toggle="tab" href="#packages">Updated Packages</a></li>
</ul>
<div class='tab-content'>
<div class='tab-pane' id='overview'>
<div class='cp-grid' data-cp-grid='xs-1-cols md-2-cols lg-2-cols'>
<div class='cp-grid-item'>
<div class='push-bottom' id='synpopsis'>
<h2>Synopsis</h2>
<p>firefox bugfix update</p>
</div>
<div id='type-severity'>
<h2>Type/Severity</h2>
<p>Bug Fix Advisory</p>
</div>
</div>
<div class='cp-grid-item'>
<div class='panel panel-info'>
<div class='panel-heading'>
<h2 class='panel-title'>Red Hat Insights patch analysis</h2>
</div>
<div class='panel-body'>
<p>Identify and remediate systems affected by this advisory.</p>
<p>
<a target="_blank" href="https://cloud.redhat.com/insights/patch/advisories/RHBA-2021:2759">View affected systems</a>
</p>
</div>
</div>
</div>
</div>
<div id='topic'>
<h2>Topic</h2>
<p>An update for firefox is now available for Red Hat Enterprise Linux 8.</p>
</div>
<div id='description'>
<h2>Description</h2>
<p>Mozilla Firefox is an open-source web browser, designed for standards<br />compliance, performance, and portability.<br /></p><p>This update upgrades Firefox to version 78.12.0 ESR.<br /></p><p>Bug Fix(es) and Enhancement(s):<br /></p><ul><li> Cannot reach websites after update from 78.11.0-3 to 78.12.0-1 (BZ#1983018)</li></ul>
</div>
<div id='solution'>
<h2>Solution</h2>
<p>Before applying this update, make sure all previously released errata<br />relevant to your system have been applied.<br /></p><p>For details on how to apply this update, refer to:<br /></p><p><a href="https://access.redhat.com/articles/11258" target="_blank">https://access.redhat.com/articles/11258</a></p>
</div>
<div id='affected_products'>
<h2>Affected Products</h2>
<ul>
<li>
Red Hat Enterprise Linux for x86_64 8 x86_64
</li>
<li>
Red Hat Enterprise Linux for x86_64 - Extended Update Support 8.4 x86_64
</li>
<li>
Red Hat Enterprise Linux Server - AUS 8.4 x86_64
</li>
<li>
Red Hat Enterprise Linux for IBM z Systems 8 s390x
</li>
<li>
Red Hat Enterprise Linux for IBM z Systems - Extended Update Support 8.4 s390x
</li>
<li>
Red Hat Enterprise Linux for Power, little endian 8 ppc64le
</li>
<li>
Red Hat Enterprise Linux for Power, little endian - Extended Update Support 8.4 ppc64le
</li>
<li>
Red Hat Enterprise Linux Server - TUS 8.4 x86_64
</li>
<li>
Red Hat Enterprise Linux for ARM 64 8 aarch64
</li>
<li>
Red Hat Enterprise Linux for ARM 64 - Extended Update Support 8.4 aarch64
</li>
<li>
Red Hat Enterprise Linux Server (for IBM Power LE) - Update Services for SAP Solutions 8.4 ppc64le
</li>
<li>
Red Hat Enterprise Linux Server - Update Services for SAP Solutions 8.4 x86_64
</li>
</ul>
</div>
<div id='fixes'>
<h2>Fixes</h2>
<ul>
<li>
<a target="_blank" href="https://bugzilla.redhat.com/show_bug.cgi?id=1983018">BZ - 1983018</a>
- Cannot reach websites after update from 78.11.0-3 to 78.12.0-1 [rhel-8.4.0.z]
</li>
</ul>
</div>
<div id='cves'>
<h2>CVEs</h2>
<p>
<span class='no-details'>(none)</span>
</p>
</div>
<div id='references'>
<h2>References</h2>
<p>
<span class='no-details'>(none)</span>
</p>
</div>
</div>
<div class='tab-pane' id='packages'>
<div class="push-top alert alert-info" role="alert">
<strong>
Note:
</strong>
More recent versions of these packages may be available.
Click a package name for more details.
</div>
<h2>Red Hat Enterprise Linux for x86_64 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for x86_64 - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server - AUS 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for IBM z Systems 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">s390x</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 40697d7bacf45b06063b60f8b5bd1f640e8b9aa6653151b69fe290f3b1dac77e</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 4963ee8c61103f4072634f7e4c89e70ef4540300e41db28eb81c7d9f31f20868</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 8079617c093dbd76c45e9f09cf7bd19f170d9d2adbe45c913e4e0c5ea03c4932</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for IBM z Systems - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">s390x</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 40697d7bacf45b06063b60f8b5bd1f640e8b9aa6653151b69fe290f3b1dac77e</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 4963ee8c61103f4072634f7e4c89e70ef4540300e41db28eb81c7d9f31f20868</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 8079617c093dbd76c45e9f09cf7bd19f170d9d2adbe45c913e4e0c5ea03c4932</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for Power, little endian 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">ppc64le</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: d98a5004873909d9ab659d0090580367e1a89e67dbc6a1344aa62ea410a3735b</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 5239bad414f02fe5ea3402a0de2f3c10d3f47feec74590e4bbecaa390a43ac7c</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: fd1122a830c1e0e853a90a30779f015e3ae91ac64d082791492942ebc3619408</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for Power, little endian - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">ppc64le</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: d98a5004873909d9ab659d0090580367e1a89e67dbc6a1344aa62ea410a3735b</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 5239bad414f02fe5ea3402a0de2f3c10d3f47feec74590e4bbecaa390a43ac7c</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: fd1122a830c1e0e853a90a30779f015e3ae91ac64d082791492942ebc3619408</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server - TUS 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for ARM 64 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">aarch64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: 4a884d2cf1f2d2da10bfe3010e6323a698ac137270ff2bf4f6f5f3bfd74389ae</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: ff8b84361bc20665fec33e85391cef9240aadaf15088cd6655357ccbb94f2665</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: fb9986dd21e71ffc2bbafedc6b8519ba10fb677184061fb6a94c84087a737a2d</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for ARM 64 - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">aarch64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: 4a884d2cf1f2d2da10bfe3010e6323a698ac137270ff2bf4f6f5f3bfd74389ae</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: ff8b84361bc20665fec33e85391cef9240aadaf15088cd6655357ccbb94f2665</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: fb9986dd21e71ffc2bbafedc6b8519ba10fb677184061fb6a94c84087a737a2d</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server (for IBM Power LE) - Update Services for SAP Solutions 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">ppc64le</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: d98a5004873909d9ab659d0090580367e1a89e67dbc6a1344aa62ea410a3735b</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 5239bad414f02fe5ea3402a0de2f3c10d3f47feec74590e4bbecaa390a43ac7c</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: fd1122a830c1e0e853a90a30779f015e3ae91ac64d082791492942ebc3619408</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server - Update Services for SAP Solutions 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 699f6e268abc89b28e1131d049599288b302d8b24a71b1e64a3a343fdd6c5742</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 34bda31ae3c35bc48cbd616659f8c23587436e090520054e0b626182cfcf5ad5</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 9254fa5e0593d0a2c1a3d22b1c7976b23631e216f0b8b9176af0e71507a26c0f</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-2.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 486cd967c1e7a70a2c9585b2e24553119640f6ac36b39de47b9d687264e91537</td>
</tr>
</table>
</div>
</div>
</div>
<p class='contact'>
The Red Hat security contact is <a href="mailto:secalert@redhat.com">secalert@redhat.com</a>.
More contact details at <a href="https://access.redhat.com/security/team/contact/">https://access.redhat.com/security/team/contact/</a>.
</p>
</div>
</div>
</div>
<!-- CP_PRIMER_FOOTER -->
</div>
</main>
</div>
<!--googleoff: all-->
<div id="to-top"><a class="btn_slideto" href="#masthead" aria-label="Back to Top"><span class="web-icon-upload"></span></a></div>
<footer class="footer-main">
<div class="footer-top">
<div class="container">
<div class="brand">
<a href="https://redhat.com">
<svg class="rh-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613 145">
<defs>
<style>
.rh-logo-hat {
fill: #e00;
}
.rh-logo-type {
fill: #fff;
}
</style>
</defs>
<title>Red Hat</title>
<path
class="rh-logo-hat"
d="M127.47,83.49c12.51,0,30.61-2.58,30.61-17.46a14,14,0,0,0-.31-3.42l-7.45-32.36c-1.72-7.12-3.23-10.35-15.73-16.6C124.89,8.69,103.76.5,97.51.5,91.69.5,90,8,83.06,8c-6.68,0-11.64-5.6-17.89-5.6-6,0-9.91,4.09-12.93,12.5,0,0-8.41,23.72-9.49,27.16A6.43,6.43,0,0,0,42.53,44c0,9.22,36.3,39.45,84.94,39.45M160,72.07c1.73,8.19,1.73,9.05,1.73,10.13,0,14-15.74,21.77-36.43,21.77C78.54,104,37.58,76.6,37.58,58.49a18.45,18.45,0,0,1,1.51-7.33C22.27,52,.5,55,.5,74.22c0,31.48,74.59,70.28,133.65,70.28,45.28,0,56.7-20.48,56.7-36.65,0-12.72-11-27.16-30.83-35.78"/>
<path class="rh-logo-band"
d="M160,72.07c1.73,8.19,1.73,9.05,1.73,10.13,0,14-15.74,21.77-36.43,21.77C78.54,104,37.58,76.6,37.58,58.49a18.45,18.45,0,0,1,1.51-7.33l3.66-9.06A6.43,6.43,0,0,0,42.53,44c0,9.22,36.3,39.45,84.94,39.45,12.51,0,30.61-2.58,30.61-17.46a14,14,0,0,0-.31-3.42Z"/>
<path
class="rh-logo-type"
d="M579.74,92.8c0,11.89,7.15,17.67,20.19,17.67a52.11,52.11,0,0,0,11.89-1.68V95a24.84,24.84,0,0,1-7.68,1.16c-5.37,0-7.36-1.68-7.36-6.73V68.3h15.56V54.1H596.78v-18l-17,3.68V54.1H568.49V68.3h11.25Zm-53,.32c0-3.68,3.69-5.47,9.26-5.47a43.12,43.12,0,0,1,10.1,1.26v7.15a21.51,21.51,0,0,1-10.63,2.63c-5.46,0-8.73-2.1-8.73-5.57m5.2,17.56c6,0,10.84-1.26,15.36-4.31v3.37h16.82V74.08c0-13.56-9.14-21-24.39-21-8.52,0-16.94,2-26,6.1l6.1,12.52c6.52-2.74,12-4.42,16.83-4.42,7,0,10.62,2.73,10.62,8.31v2.73a49.53,49.53,0,0,0-12.62-1.58c-14.31,0-22.93,6-22.93,16.73,0,9.78,7.78,17.24,20.19,17.24m-92.44-.94h18.09V80.92h30.29v28.82H506V36.12H487.93V64.41H457.64V36.12H439.55ZM370.62,81.87c0-8,6.31-14.1,14.62-14.1A17.22,17.22,0,0,1,397,72.09V91.54A16.36,16.36,0,0,1,385.24,96c-8.2,0-14.62-6.1-14.62-14.09m26.61,27.87h16.83V32.44l-17,3.68V57.05a28.3,28.3,0,0,0-14.2-3.68c-16.19,0-28.92,12.51-28.92,28.5a28.25,28.25,0,0,0,28.4,28.6,25.12,25.12,0,0,0,14.93-4.83ZM320,67c5.36,0,9.88,3.47,11.67,8.83H308.47C310.15,70.3,314.36,67,320,67M291.33,82c0,16.2,13.25,28.82,30.28,28.82,9.36,0,16.2-2.53,23.25-8.42l-11.26-10c-2.63,2.74-6.52,4.21-11.14,4.21a14.39,14.39,0,0,1-13.68-8.83h39.65V83.55c0-17.67-11.88-30.39-28.08-30.39a28.57,28.57,0,0,0-29,28.81M262,51.58c6,0,9.36,3.78,9.36,8.31S268,68.2,262,68.2H244.11V51.58Zm-36,58.16h18.09V82.92h13.77l13.89,26.82H292l-16.2-29.45a22.27,22.27,0,0,0,13.88-20.72c0-13.25-10.41-23.45-26-23.45H226Z"/>
</svg>
</a>
</div>
<div role="navigation">
<h3>Quick Links</h3>
<ul>
<li><a class="download-software" href="https://access.redhat.com/downloads/">Downloads</a></li>
<li><a class="manage-subscriptions" href="https://access.redhat.com/management">Subscriptions</a></li>
<li><a class="support-cases" href="https://access.redhat.com/support">Support Cases</a></li>
<li><a class="customer-service" href="https://access.redhat.com/support/customer-service">Customer Service</a></li>
<li><a class="quick-docs" href="https://access.redhat.com/documentation">Product Documentation</a></li>
</ul>
</div>
<div role="navigation">
<h3>Help</h3>
<ul>
<li><a class="contact-us" href="https://access.redhat.com/support/contact/">Contact Us</a></li>
<li><a class="cp-faqs" href="https://access.redhat.com/articles/33844">Customer Portal FAQ</a></li>
<li><a class="login-problems" href="https://access.redhat.com/help/login_assistance">Log-in Assistance</a></li>
</ul>
</div>
<div role="navigation">
<h3>Site Info</h3>
<ul>
<li><a class="trust-red-hat" href="https://www.redhat.com/en/trust">Trust Red Hat</a></li>
<li><a class="browser-support-policy" href="https://access.redhat.com/help/browsers/">Browser Support Policy</a></li>
<li><a class="accessibility" href="https://access.redhat.com/help/accessibility/">Accessibility</a></li>
<li><a class="recognition" href="https://access.redhat.com/recognition/">Awards and Recognition</a></li>
<li><a class="colophon" href="https://access.redhat.com/help/colophon/">Colophon</a></li>
</ul>
</div>
<div role="navigation">
<h3>Related Sites</h3>
<ul>
<li><a href="https://www.redhat.com/" class="red-hat-com">redhat.com</a></li>
<li><a href="https://www.openshift.com" class="openshift-com">openshift.com</a></li>
<li><a href="http://developers.redhat.com/" class="red-hat-developers">developers.redhat.com</a></li>
<li><a href="https://connect.redhat.com/" class="partner-connect">connect.redhat.com</a></li>
<li><a href="https://cloud.redhat.com/" class="cloud-com">cloud.redhat.com</a></li>
</ul>
</div>
<div role="navigation">
<h3>About</h3>
<ul>
<li><a href="https://access.redhat.com/subscription-value" class="subscription-value">Red Hat Subscription Value</a></li>
<li><a href="https://www.redhat.com/about/" class="about-red-hat">About Red Hat</a></li>
<li><a href="http://jobs.redhat.com" class="about-jobs">Red Hat Jobs</a></li>
</ul>
</div>
</div>
</div>
<div class="anchor">
<div class="container">
<div class="status-legal">
<a hidden href="https://status.redhat.com" class="status-page-widget">
<span class="status-description"></span>
<span class="status-dot shape-circle"></span>
</a>
<div class="legal-copyright">
<div class="copyright">Copyright © 2021 Red Hat, Inc.</div>
<div role="navigation" class="legal">
<ul>
<li><a href="http://www.redhat.com/en/about/privacy-policy" class="privacy-policy">Privacy Statement</a></li>
<li><a href="https://access.redhat.com/help/terms/" class="terms-of-use">Customer Portal Terms of Use</a></li>
<li><a href="http://www.redhat.com/en/about/all-policies-guidelines" class="all-policies">All Policies and Guidelines</a></li>
<li><a id="teconsent"></a></li>
</ul>
</div>
</div>
</div>
<div class="social">
<a href="http://www.redhat.com/summit/" class="summit">
<img src="https://access.redhat.com/chrome_themes/nimbus/img/rh-summit-red-a.svg" alt="Red Hat Summit" />
</a>
<div class="social-media">
<a href="https://twitter.com/RedHatSupport" class="sm-icon twitter"><span class="nicon-twitter"></span><span class="offscreen">Twitter</span></a>
<a href="https://www.facebook.com/RedHatSupport" class="sm-icon facebook"><span class="nicon-facebook"></span><span class="offscreen">Facebook</span></a>
</div>
</div>
</div>
</div>
</footer>
<!-- TrustArc -->
<div id="consent_blackbar"></div>
<!--googleon: all-->
</div>
<!-- /CP_PRIMER_FOOTER -->
</body>
</html>

View File

@ -1,710 +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.
-->
<div class='print-single'>
<dl class='details'>
<dt>Issued:</dt>
<dd>2021-07-15</dd>
<dt>Updated:</dt>
<dd>2021-07-15</dd>
</dl>
<h1>RHSA-2021:2743 - Security Advisory</h1>
<div id='tabs'>
<ul class='nav nav-tabs'>
<li><a role="tab" data-taggle="tab" href="#overview">Overview</a></li>
<li><a role="tab" data-toggle="tab" href="#packages">Updated Packages</a></li>
</ul>
<div class='tab-content'>
<div class='tab-pane' id='overview'>
<div class='cp-grid' data-cp-grid='xs-1-cols md-2-cols lg-2-cols'>
<div class='cp-grid-item'>
<div class='push-bottom' id='synpopsis'>
<h2>Synopsis</h2>
<p>Important: firefox security update</p>
</div>
<div id='type-severity'>
<h2>Type/Severity</h2>
<p>Security Advisory: Important</p>
</div>
</div>
<div class='cp-grid-item'>
<div class='panel panel-info'>
<div class='panel-heading'>
<h2 class='panel-title'>Red Hat Insights patch analysis</h2>
</div>
<div class='panel-body'>
<p>Identify and remediate systems affected by this advisory.</p>
<p>
<a target="_blank" href="https://cloud.redhat.com/insights/patch/advisories/RHSA-2021:2743">View affected systems</a>
</p>
</div>
</div>
</div>
</div>
<div id='topic'>
<h2>Topic</h2>
<p>An update for firefox is now available for Red Hat Enterprise Linux 8.<br /></p><p>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.</p>
</div>
<div id='description'>
<h2>Description</h2>
<p>Mozilla Firefox is an open-source web browser, designed for standards compliance, performance, and portability.<br /></p><p>This update upgrades Firefox to version 78.12.0 ESR.<br /></p><p>Security Fix(es):<br /></p><ul><li> Mozilla: Use-after-free in accessibility features of a document (CVE-2021-29970)</li>
<li> Mozilla: Memory safety bugs fixed in Firefox 90 and Firefox ESR 78.12 (CVE-2021-29976)</li>
<li> chromium-browser: Out of bounds write in ANGLE (CVE-2021-30547)</li>
</ul><p>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.</p>
</div>
<div id='solution'>
<h2>Solution</h2>
<p>For details on how to apply this update, which includes the changes described in this advisory, refer to:<br /></p><p><a href="https://access.redhat.com/articles/11258" target="_blank">https://access.redhat.com/articles/11258</a> </p><p>After installing the update, Firefox must be restarted for the changes to take effect.</p>
</div>
<div id='affected_products'>
<h2>Affected Products</h2>
<ul>
<li>
Red Hat Enterprise Linux for x86_64 8 x86_64
</li>
<li>
Red Hat Enterprise Linux for x86_64 - Extended Update Support 8.4 x86_64
</li>
<li>
Red Hat Enterprise Linux Server - AUS 8.4 x86_64
</li>
<li>
Red Hat Enterprise Linux for IBM z Systems 8 s390x
</li>
<li>
Red Hat Enterprise Linux for IBM z Systems - Extended Update Support 8.4 s390x
</li>
<li>
Red Hat Enterprise Linux for Power, little endian 8 ppc64le
</li>
<li>
Red Hat Enterprise Linux for Power, little endian - Extended Update Support 8.4 ppc64le
</li>
<li>
Red Hat Enterprise Linux Server - TUS 8.4 x86_64
</li>
<li>
Red Hat Enterprise Linux for ARM 64 8 aarch64
</li>
<li>
Red Hat Enterprise Linux for ARM 64 - Extended Update Support 8.4 aarch64
</li>
<li>
Red Hat Enterprise Linux Server (for IBM Power LE) - Update Services for SAP Solutions 8.4 ppc64le
</li>
<li>
Red Hat Enterprise Linux Server - Update Services for SAP Solutions 8.4 x86_64
</li>
</ul>
</div>
<div id='fixes'>
<h2>Fixes</h2>
<ul>
<li>
<a target="_blank" href="https://bugzilla.redhat.com/show_bug.cgi?id=1970109">BZ - 1970109</a>
- CVE-2021-30547 chromium-browser: Out of bounds write in ANGLE
</li>
<li>
<a target="_blank" href="https://bugzilla.redhat.com/show_bug.cgi?id=1982013">BZ - 1982013</a>
- CVE-2021-29970 Mozilla: Use-after-free in accessibility features of a document
</li>
<li>
<a target="_blank" href="https://bugzilla.redhat.com/show_bug.cgi?id=1982014">BZ - 1982014</a>
- CVE-2021-29976 Mozilla: Memory safety bugs fixed in Firefox 90 and Firefox ESR 78.12
</li>
</ul>
</div>
<div id='cves'>
<h2>CVEs</h2>
<ul>
<li><a target="_blank" href="https://www.redhat.com/security/data/cve/CVE-2021-29970.html">CVE-2021-29970</a></li>
<li><a target="_blank" href="https://www.redhat.com/security/data/cve/CVE-2021-29976.html">CVE-2021-29976</a></li>
<li><a target="_blank" href="https://www.redhat.com/security/data/cve/CVE-2021-30547.html">CVE-2021-30547</a></li>
</ul>
</div>
<div id='references'>
<h2>References</h2>
<ul>
<li><a target="_blank" href="https://access.redhat.com/security/updates/classification/#important">https://access.redhat.com/security/updates/classification/#important</a></li>
</ul>
</div>
</div>
<div class='tab-pane' id='packages'>
<div class="push-top alert alert-info" role="alert">
<strong>
Note:
</strong>
More recent versions of these packages may be available.
Click a package name for more details.
</div>
<h2>Red Hat Enterprise Linux for x86_64 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: b695560e4d71e756e4f23300b3799dbf9a0501d438a1cfa6cc60e17204ef4b9f</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: cd469dda0b92c02ce97ab7189588e609e366bc27814af793c719324b2ca7de90</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 98cb2bf96336d22a822f0efb612c9ef8bf8e7c39c6b6e90e15f86dfdb8730d68</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for x86_64 - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: b695560e4d71e756e4f23300b3799dbf9a0501d438a1cfa6cc60e17204ef4b9f</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: cd469dda0b92c02ce97ab7189588e609e366bc27814af793c719324b2ca7de90</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 98cb2bf96336d22a822f0efb612c9ef8bf8e7c39c6b6e90e15f86dfdb8730d68</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server - AUS 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: b695560e4d71e756e4f23300b3799dbf9a0501d438a1cfa6cc60e17204ef4b9f</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: cd469dda0b92c02ce97ab7189588e609e366bc27814af793c719324b2ca7de90</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 98cb2bf96336d22a822f0efb612c9ef8bf8e7c39c6b6e90e15f86dfdb8730d68</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for IBM z Systems 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">s390x</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: c4d8fd21d5b6fb375a31a5008dee39125468db10fc2578f9184ca709b0649124</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 3e14dbd2ea086ca9bf8999b66e108e15897b7b9fa37b2958098e2f9999c69b5c</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 4d9a3b46a1b4932bb9ad618c6b16389c6ed22a7a50d544c354389521e5cac5ca</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for IBM z Systems - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">s390x</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: c4d8fd21d5b6fb375a31a5008dee39125468db10fc2578f9184ca709b0649124</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 3e14dbd2ea086ca9bf8999b66e108e15897b7b9fa37b2958098e2f9999c69b5c</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.s390x.rpm
</td>
<td class="checksum">SHA-256: 4d9a3b46a1b4932bb9ad618c6b16389c6ed22a7a50d544c354389521e5cac5ca</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for Power, little endian 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">ppc64le</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 53be1f8f91b3e0ff3110f78c3eddabbbc2da618a0a03898dba8a4ed2e1e79c64</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 2bd8c3c8cad9e90485a44fcc6c2aae2d504a30ee8611c45e699cf3b6efcbfe9a</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: bf8399647be6b276ec3db408f11c89ed2e067b78fb7be019a5df85fad68e7efc</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for Power, little endian - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">ppc64le</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 53be1f8f91b3e0ff3110f78c3eddabbbc2da618a0a03898dba8a4ed2e1e79c64</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 2bd8c3c8cad9e90485a44fcc6c2aae2d504a30ee8611c45e699cf3b6efcbfe9a</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: bf8399647be6b276ec3db408f11c89ed2e067b78fb7be019a5df85fad68e7efc</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server - TUS 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: b695560e4d71e756e4f23300b3799dbf9a0501d438a1cfa6cc60e17204ef4b9f</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: cd469dda0b92c02ce97ab7189588e609e366bc27814af793c719324b2ca7de90</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 98cb2bf96336d22a822f0efb612c9ef8bf8e7c39c6b6e90e15f86dfdb8730d68</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for ARM 64 8</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">aarch64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: 9c2212b6759ffc7e929608b93dbea308f805fc41e3a6ef86e18225fe64fad1a2</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: f540717a77978630bbc2e87f6b19b2187455cfcccdcb5e95906cc601e36aceef</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: dffacf744c6ebc840fc71a3876eb09acdafdf94c4b574e3cfc9fa858fe9163d7</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux for ARM 64 - Extended Update Support 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">aarch64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: 9c2212b6759ffc7e929608b93dbea308f805fc41e3a6ef86e18225fe64fad1a2</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: f540717a77978630bbc2e87f6b19b2187455cfcccdcb5e95906cc601e36aceef</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.aarch64.rpm
</td>
<td class="checksum">SHA-256: dffacf744c6ebc840fc71a3876eb09acdafdf94c4b574e3cfc9fa858fe9163d7</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server (for IBM Power LE) - Update Services for SAP Solutions 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">ppc64le</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 53be1f8f91b3e0ff3110f78c3eddabbbc2da618a0a03898dba8a4ed2e1e79c64</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: 2bd8c3c8cad9e90485a44fcc6c2aae2d504a30ee8611c45e699cf3b6efcbfe9a</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.ppc64le.rpm
</td>
<td class="checksum">SHA-256: bf8399647be6b276ec3db408f11c89ed2e067b78fb7be019a5df85fad68e7efc</td>
</tr>
</table>
<h2>Red Hat Enterprise Linux Server - Update Services for SAP Solutions 8.4</h2>
<table class="files">
<tr>
<th colspan="2">SRPM</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.src.rpm
</td>
<td class="checksum">SHA-256: 2fdab145c121ce9d3775caa1acb3d8e8aefc147e97125a317b5f570855bc7db4</td>
</tr>
<tr>
<th colspan="2">x86_64</th>
</tr>
<tr>
<td class="name">
firefox-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: b695560e4d71e756e4f23300b3799dbf9a0501d438a1cfa6cc60e17204ef4b9f</td>
</tr>
<tr>
<td class="name">
firefox-debuginfo-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: cd469dda0b92c02ce97ab7189588e609e366bc27814af793c719324b2ca7de90</td>
</tr>
<tr>
<td class="name">
firefox-debugsource-78.12.0-1.el8_4.x86_64.rpm
</td>
<td class="checksum">SHA-256: 98cb2bf96336d22a822f0efb612c9ef8bf8e7c39c6b6e90e15f86dfdb8730d68</td>
</tr>
</table>
</div>
</div>
</div>
<p class='contact'>
The Red Hat security contact is <a href="mailto:secalert@redhat.com">secalert@redhat.com</a>.
More contact details at <a href="https://access.redhat.com/security/team/contact/">https://access.redhat.com/security/team/contact/</a>.
</p>
</div>
</div>
</div>
<!-- CP_PRIMER_FOOTER -->
</div>
</main>
</div>
<!--googleoff: all-->
<div id="to-top"><a class="btn_slideto" href="#masthead" aria-label="Back to Top"><span class="web-icon-upload"></span></a></div>
<footer class="footer-main">
<div class="footer-top">
<div class="container">
<div class="brand">
<a href="https://redhat.com">
<svg class="rh-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613 145">
<defs>
<style>
.rh-logo-hat {
fill: #e00;
}
.rh-logo-type {
fill: #fff;
}
</style>
</defs>
<title>Red Hat</title>
<path
class="rh-logo-hat"
d="M127.47,83.49c12.51,0,30.61-2.58,30.61-17.46a14,14,0,0,0-.31-3.42l-7.45-32.36c-1.72-7.12-3.23-10.35-15.73-16.6C124.89,8.69,103.76.5,97.51.5,91.69.5,90,8,83.06,8c-6.68,0-11.64-5.6-17.89-5.6-6,0-9.91,4.09-12.93,12.5,0,0-8.41,23.72-9.49,27.16A6.43,6.43,0,0,0,42.53,44c0,9.22,36.3,39.45,84.94,39.45M160,72.07c1.73,8.19,1.73,9.05,1.73,10.13,0,14-15.74,21.77-36.43,21.77C78.54,104,37.58,76.6,37.58,58.49a18.45,18.45,0,0,1,1.51-7.33C22.27,52,.5,55,.5,74.22c0,31.48,74.59,70.28,133.65,70.28,45.28,0,56.7-20.48,56.7-36.65,0-12.72-11-27.16-30.83-35.78"/>
<path class="rh-logo-band"
d="M160,72.07c1.73,8.19,1.73,9.05,1.73,10.13,0,14-15.74,21.77-36.43,21.77C78.54,104,37.58,76.6,37.58,58.49a18.45,18.45,0,0,1,1.51-7.33l3.66-9.06A6.43,6.43,0,0,0,42.53,44c0,9.22,36.3,39.45,84.94,39.45,12.51,0,30.61-2.58,30.61-17.46a14,14,0,0,0-.31-3.42Z"/>
<path
class="rh-logo-type"
d="M579.74,92.8c0,11.89,7.15,17.67,20.19,17.67a52.11,52.11,0,0,0,11.89-1.68V95a24.84,24.84,0,0,1-7.68,1.16c-5.37,0-7.36-1.68-7.36-6.73V68.3h15.56V54.1H596.78v-18l-17,3.68V54.1H568.49V68.3h11.25Zm-53,.32c0-3.68,3.69-5.47,9.26-5.47a43.12,43.12,0,0,1,10.1,1.26v7.15a21.51,21.51,0,0,1-10.63,2.63c-5.46,0-8.73-2.1-8.73-5.57m5.2,17.56c6,0,10.84-1.26,15.36-4.31v3.37h16.82V74.08c0-13.56-9.14-21-24.39-21-8.52,0-16.94,2-26,6.1l6.1,12.52c6.52-2.74,12-4.42,16.83-4.42,7,0,10.62,2.73,10.62,8.31v2.73a49.53,49.53,0,0,0-12.62-1.58c-14.31,0-22.93,6-22.93,16.73,0,9.78,7.78,17.24,20.19,17.24m-92.44-.94h18.09V80.92h30.29v28.82H506V36.12H487.93V64.41H457.64V36.12H439.55ZM370.62,81.87c0-8,6.31-14.1,14.62-14.1A17.22,17.22,0,0,1,397,72.09V91.54A16.36,16.36,0,0,1,385.24,96c-8.2,0-14.62-6.1-14.62-14.09m26.61,27.87h16.83V32.44l-17,3.68V57.05a28.3,28.3,0,0,0-14.2-3.68c-16.19,0-28.92,12.51-28.92,28.5a28.25,28.25,0,0,0,28.4,28.6,25.12,25.12,0,0,0,14.93-4.83ZM320,67c5.36,0,9.88,3.47,11.67,8.83H308.47C310.15,70.3,314.36,67,320,67M291.33,82c0,16.2,13.25,28.82,30.28,28.82,9.36,0,16.2-2.53,23.25-8.42l-11.26-10c-2.63,2.74-6.52,4.21-11.14,4.21a14.39,14.39,0,0,1-13.68-8.83h39.65V83.55c0-17.67-11.88-30.39-28.08-30.39a28.57,28.57,0,0,0-29,28.81M262,51.58c6,0,9.36,3.78,9.36,8.31S268,68.2,262,68.2H244.11V51.58Zm-36,58.16h18.09V82.92h13.77l13.89,26.82H292l-16.2-29.45a22.27,22.27,0,0,0,13.88-20.72c0-13.25-10.41-23.45-26-23.45H226Z"/>
</svg>
</a>
</div>
<div role="navigation">
<h3>Quick Links</h3>
<ul>
<li><a class="download-software" href="https://access.redhat.com/downloads/">Downloads</a></li>
<li><a class="manage-subscriptions" href="https://access.redhat.com/management">Subscriptions</a></li>
<li><a class="support-cases" href="https://access.redhat.com/support">Support Cases</a></li>
<li><a class="customer-service" href="https://access.redhat.com/support/customer-service">Customer Service</a></li>
<li><a class="quick-docs" href="https://access.redhat.com/documentation">Product Documentation</a></li>
</ul>
</div>
<div role="navigation">
<h3>Help</h3>
<ul>
<li><a class="contact-us" href="https://access.redhat.com/support/contact/">Contact Us</a></li>
<li><a class="cp-faqs" href="https://access.redhat.com/articles/33844">Customer Portal FAQ</a></li>
<li><a class="login-problems" href="https://access.redhat.com/help/login_assistance">Log-in Assistance</a></li>
</ul>
</div>
<div role="navigation">
<h3>Site Info</h3>
<ul>
<li><a class="trust-red-hat" href="https://www.redhat.com/en/trust">Trust Red Hat</a></li>
<li><a class="browser-support-policy" href="https://access.redhat.com/help/browsers/">Browser Support Policy</a></li>
<li><a class="accessibility" href="https://access.redhat.com/help/accessibility/">Accessibility</a></li>
<li><a class="recognition" href="https://access.redhat.com/recognition/">Awards and Recognition</a></li>
<li><a class="colophon" href="https://access.redhat.com/help/colophon/">Colophon</a></li>
</ul>
</div>
<div role="navigation">
<h3>Related Sites</h3>
<ul>
<li><a href="https://www.redhat.com/" class="red-hat-com">redhat.com</a></li>
<li><a href="https://www.openshift.com" class="openshift-com">openshift.com</a></li>
<li><a href="http://developers.redhat.com/" class="red-hat-developers">developers.redhat.com</a></li>
<li><a href="https://connect.redhat.com/" class="partner-connect">connect.redhat.com</a></li>
<li><a href="https://cloud.redhat.com/" class="cloud-com">cloud.redhat.com</a></li>
</ul>
</div>
<div role="navigation">
<h3>About</h3>
<ul>
<li><a href="https://access.redhat.com/subscription-value" class="subscription-value">Red Hat Subscription Value</a></li>
<li><a href="https://www.redhat.com/about/" class="about-red-hat">About Red Hat</a></li>
<li><a href="http://jobs.redhat.com" class="about-jobs">Red Hat Jobs</a></li>
</ul>
</div>
</div>
</div>
<div class="anchor">
<div class="container">
<div class="status-legal">
<a hidden href="https://status.redhat.com" class="status-page-widget">
<span class="status-description"></span>
<span class="status-dot shape-circle"></span>
</a>
<div class="legal-copyright">
<div class="copyright">Copyright © 2021 Red Hat, Inc.</div>
<div role="navigation" class="legal">
<ul>
<li><a href="http://www.redhat.com/en/about/privacy-policy" class="privacy-policy">Privacy Statement</a></li>
<li><a href="https://access.redhat.com/help/terms/" class="terms-of-use">Customer Portal Terms of Use</a></li>
<li><a href="http://www.redhat.com/en/about/all-policies-guidelines" class="all-policies">All Policies and Guidelines</a></li>
<li><a id="teconsent"></a></li>
</ul>
</div>
</div>
</div>
<div class="social">
<a href="http://www.redhat.com/summit/" class="summit">
<img src="https://access.redhat.com/chrome_themes/nimbus/img/rh-summit-red-a.svg" alt="Red Hat Summit" />
</a>
<div class="social-media">
<a href="https://twitter.com/RedHatSupport" class="sm-icon twitter"><span class="nicon-twitter"></span><span class="offscreen">Twitter</span></a>
<a href="https://www.facebook.com/RedHatSupport" class="sm-icon facebook"><span class="nicon-facebook"></span><span class="offscreen">Facebook</span></a>
</div>
</div>
</div>
</div>
</footer>
<!-- TrustArc -->
<div id="consent_blackbar"></div>
<!--googleon: all-->
</div>
<!-- /CP_PRIMER_FOOTER -->
</body>
</html>

View File

@ -1,22 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "rhsecurity",
srcs = [
"api_default.go",
"client.go",
"configuration.go",
"gen.go",
"model_cve.go",
"model_cve_detailed.go",
"model_cve_detailed_affected_release.go",
"model_cve_detailed_bugzilla.go",
"model_cve_detailed_cvss3.go",
"model_cve_detailed_package_state.go",
"response.go",
"utils.go",
],
importpath = "peridot.resf.org/apollo/rhsecurity",
visibility = ["//visibility:public"],
deps = ["//vendor/golang.org/x/oauth2"],
)

View File

@ -1,119 +0,0 @@
# Go API client for rhsecurity
Unofficial OpenAPI definitions for Red Hat Security Data API
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
- API version: 1.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation
Install the following dependencies:
```shell
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
```
Put the package under your project folder and add the following in import:
```golang
import sw "./rhsecurity"
```
To use a proxy, set the environment variable `HTTP_PROXY`:
```golang
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```
## Configuration of Server URL
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
### Select Server Configuration
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
```golang
ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)
```
### Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
```golang
ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
"basePath": "v2",
})
```
Note, enum values are always validated and all unused variables are silently ignored.
### URLs Configuration per Operation
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identifield by `"{classname}Service.{nickname}"` string.
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
```
ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
```
## Documentation for API Endpoints
All URIs are relative to *https://access.redhat.com/hydra/rest/securitydata*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**GetCve**](docs/DefaultApi.md#getcve) | **Get** /cve/{CVE}.json | Get specific CVE
*DefaultApi* | [**GetCves**](docs/DefaultApi.md#getcves) | **Get** /cve.json | Get CVEs
## Documentation For Models
- [CVE](docs/CVE.md)
- [CVEDetailed](docs/CVEDetailed.md)
- [CVEDetailedAffectedRelease](docs/CVEDetailedAffectedRelease.md)
- [CVEDetailedBugzilla](docs/CVEDetailedBugzilla.md)
- [CVEDetailedCvss3](docs/CVEDetailedCvss3.md)
- [CVEDetailedPackageState](docs/CVEDetailedPackageState.md)
## Documentation For Authorization
Endpoints do not require authorization.
## Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:
* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`
## Author
mustafa@ctrliq.com

View File

@ -1,427 +0,0 @@
openapi: 3.0.0
x-stoplight:
id: yjn90w5p8y4ly
info:
title: Red Hat Security Data API
version: '1.0'
description: Unofficial OpenAPI definitions for Red Hat Security Data API
contact:
name: Mustafa Gezen
email: mustafa@ctrliq.com
servers:
- url: 'https://access.redhat.com/hydra/rest/securitydata'
paths:
/cve.json:
get:
summary: Get CVEs
tags: []
operationId: get-cves
parameters:
- schema:
type: string
format: date
in: query
name: before
description: 'CVEs before the query date. [ISO 8601 is the expected format]'
- schema:
type: string
format: date
in: query
name: after
description: 'CVEs after the query date. [ISO 8601 is the expected format]'
- schema:
type: string
in: query
name: ids
description: CVEs for Ids separated by comma
- schema:
type: string
in: query
name: bug
description: CVEs for Bugzilla Ids
- schema:
type: string
in: query
name: advisory
description: CVEs for advisory
- schema:
type: string
in: query
name: severity
description: CVEs for severity
- schema:
type: string
in: query
name: package
description: CVEs which affect the package
- schema:
type: string
in: query
name: product
description: CVEs which affect the product. The parameter supports Perl compatible regular expressions.
- schema:
type: string
in: query
name: cwe
description: CVEs with CWE
- schema:
type: number
in: query
name: cvss_score
description: CVEs with CVSS score greater than or equal to this value
- schema:
type: string
in: query
name: cvss3_score
description: CVEs with CVSSv3 score greater than or equal to this value
- schema:
type: number
in: query
name: page
description: CVEs for page number
- schema:
type: number
in: query
name: per_page
description: Number of CVEs to return per page
- schema:
type: number
in: query
name: created_days_ago
description: Index of CVEs definitions created days ago
description: List all the recent CVEs when no parameter is passed. Returns a convenience object as response with very minimum attributes.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CVE'
parameters: []
'/cve/{CVE}.json':
parameters:
- schema:
type: string
name: CVE
in: path
required: true
get:
summary: Get specific CVE
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CVEDetailed'
operationId: get-cve
description: Retrieve full CVE details
components:
schemas:
CVE:
description: CVE model used in listing
type: object
x-examples:
example-1:
CVE: CVE-2020-24489
severity: important
public_date: '2021-06-08T17:00:00Z'
advisories:
- 'RHSA-2021:2307'
- 'RHSA-2021:2306'
- 'RHSA-2021:2305'
- 'RHSA-2021:2304'
- 'RHSA-2021:2519'
- 'RHSA-2021:2308'
- 'RHSA-2021:2299'
- 'RHSA-2021:2303'
- 'RHSA-2021:2302'
- 'RHSA-2021:2522'
- 'RHSA-2021:2301'
- 'RHSA-2021:2300'
bugzilla: '1962650'
bugzilla_description: 'CVE-2020-24489 hw: vt-d related privilege escalation'
cvss_score: null
cvss_scoring_vector: null
CWE: CWE-459
affected_packages:
- 'microcode_ctl-4:20191115-4.20210525.1.el8_2'
- 'microcode_ctl-2:2.1-12.37.el7_2'
- 'redhat-virtualization-host-0:4.3.16-20210615.0.el7_9'
- 'microcode_ctl-2:2.1-53.16.el7_7'
- 'microcode_ctl-4:20210216-1.20210525.1.el8_4'
- 'microcode_ctl-2:2.1-16.40.el7_3'
- 'microcode_ctl-2:1.17-33.33.el6_10'
- 'microcode_ctl-4:20190618-1.20210525.1.el8_1'
- 'microcode_ctl-2:2.1-22.39.el7_4'
- 'microcode_ctl-2:2.1-73.9.el7_9'
- 'microcode_ctl-2:2.1-47.21.el7_6'
resource_url: 'https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2020-24489.json'
cvss3_scoring_vector: 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H'
cvss3_score: '8.8'
properties:
CVE:
type: string
minLength: 1
severity:
type: string
minLength: 1
public_date:
type: string
minLength: 1
advisories:
type: array
items:
type: string
bugzilla:
type: string
minLength: 1
bugzilla_description:
type: string
minLength: 1
cvss_score:
type: number
cvss_scoring_vector:
type: string
CWE:
type: string
minLength: 1
affected_packages:
type: array
items:
type: string
resource_url:
type: string
minLength: 1
cvss3_scoring_vector:
type: string
minLength: 1
cvss3_score:
type: string
minLength: 1
required:
- CVE
- severity
- public_date
- advisories
- bugzilla
- bugzilla_description
- CWE
- affected_packages
- resource_url
- cvss3_scoring_vector
- cvss3_score
CVEDetailed:
description: CVE model used when retrieving a specific CVE
type: object
x-examples:
example-1:
threat_severity: Important
public_date: '2021-06-08T17:00:00Z'
bugzilla:
description: 'CVE-2020-24489 hw: vt-d related privilege escalation'
id: '1962650'
url: 'https://bugzilla.redhat.com/show_bug.cgi?id=1962650'
cvss3:
cvss3_base_score: '8.8'
cvss3_scoring_vector: 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H'
status: verified
cwe: CWE-459
details:
- Incomplete cleanup in some Intel(R) VT-d products may allow an authenticated user to potentially enable escalation of privilege via local access.
- A flaw was found in Intel® VT-d products. Entries from the context cache on some types of context cache invalidations may not be properly invalidated which may allow an authenticated user to potentially enable escalation of privilege via local access. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
acknowledgement: Red Hat would like to thank Intel for reporting this issue.
affected_release:
- product_name: Red Hat Enterprise Linux 6 Extended Lifecycle Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2299'
cpe: 'cpe:/o:redhat:rhel_els:6'
package: 'microcode_ctl-2:1.17-33.33.el6_10'
- product_name: Red Hat Enterprise Linux 7
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2305'
cpe: 'cpe:/o:redhat:enterprise_linux:7'
package: 'microcode_ctl-2:2.1-73.9.el7_9'
- product_name: Red Hat Enterprise Linux 7.2 Advanced Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2300'
cpe: 'cpe:/o:redhat:rhel_aus:7.2'
package: 'microcode_ctl-2:2.1-12.37.el7_2'
- product_name: Red Hat Enterprise Linux 7.3 Advanced Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2302'
cpe: 'cpe:/o:redhat:rhel_aus:7.3'
package: 'microcode_ctl-2:2.1-16.40.el7_3'
- product_name: Red Hat Enterprise Linux 7.4 Advanced Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2301'
cpe: 'cpe:/o:redhat:rhel_aus:7.4'
package: 'microcode_ctl-2:2.1-22.39.el7_4'
- product_name: Red Hat Enterprise Linux 7.4 Telco Extended Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2301'
cpe: 'cpe:/o:redhat:rhel_tus:7.4'
package: 'microcode_ctl-2:2.1-22.39.el7_4'
- product_name: Red Hat Enterprise Linux 7.4 Update Services for SAP Solutions
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2301'
cpe: 'cpe:/o:redhat:rhel_e4s:7.4'
package: 'microcode_ctl-2:2.1-22.39.el7_4'
- product_name: Red Hat Enterprise Linux 7.6 Advanced Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2303'
cpe: 'cpe:/o:redhat:rhel_aus:7.6'
package: 'microcode_ctl-2:2.1-47.21.el7_6'
- product_name: Red Hat Enterprise Linux 7.6 Telco Extended Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2303'
cpe: 'cpe:/o:redhat:rhel_tus:7.6'
package: 'microcode_ctl-2:2.1-47.21.el7_6'
- product_name: Red Hat Enterprise Linux 7.6 Update Services for SAP Solutions
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2303'
cpe: 'cpe:/o:redhat:rhel_e4s:7.6'
package: 'microcode_ctl-2:2.1-47.21.el7_6'
- product_name: Red Hat Enterprise Linux 7.7 Extended Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2304'
cpe: 'cpe:/o:redhat:rhel_eus:7.7'
package: 'microcode_ctl-2:2.1-53.16.el7_7'
- product_name: Red Hat Enterprise Linux 8
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2308'
cpe: 'cpe:/o:redhat:enterprise_linux:8'
package: 'microcode_ctl-4:20210216-1.20210525.1.el8_4'
- product_name: Red Hat Enterprise Linux 8.1 Extended Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2306'
cpe: 'cpe:/o:redhat:rhel_eus:8.1'
package: 'microcode_ctl-4:20190618-1.20210525.1.el8_1'
- product_name: Red Hat Enterprise Linux 8.2 Extended Update Support
release_date: '2021-06-09T00:00:00Z'
advisory: 'RHSA-2021:2307'
cpe: 'cpe:/o:redhat:rhel_eus:8.2'
package: 'microcode_ctl-4:20191115-4.20210525.1.el8_2'
- product_name: Red Hat Virtualization 4 for Red Hat Enterprise Linux 7
release_date: '2021-06-22T00:00:00Z'
advisory: 'RHSA-2021:2519'
cpe: 'cpe:/o:redhat:enterprise_linux:7::hypervisor'
package: 'redhat-virtualization-host-0:4.3.16-20210615.0.el7_9'
- product_name: Red Hat Virtualization 4 for Red Hat Enterprise Linux 8
release_date: '2021-06-22T00:00:00Z'
advisory: 'RHSA-2021:2522'
cpe: 'cpe:/o:redhat:enterprise_linux:8::hypervisor'
name: CVE-2020-24489
csaw: false
properties:
threat_severity:
type: string
minLength: 1
public_date:
type: string
minLength: 1
bugzilla:
type: object
required:
- description
- id
- url
properties:
description:
type: string
minLength: 1
id:
type: string
minLength: 1
url:
type: string
minLength: 1
cvss3:
type: object
required:
- cvss3_base_score
- cvss3_scoring_vector
- status
properties:
cvss3_base_score:
type: string
minLength: 1
cvss3_scoring_vector:
type: string
minLength: 1
status:
type: string
minLength: 1
cwe:
type: string
minLength: 1
details:
type: array
items:
type: string
acknowledgement:
type: string
minLength: 1
affected_release:
type: array
uniqueItems: true
minItems: 1
items:
type: object
properties:
product_name:
type: string
minLength: 1
release_date:
type: string
minLength: 1
advisory:
type: string
minLength: 1
cpe:
type: string
minLength: 1
package:
type: string
minLength: 1
required:
- product_name
- release_date
- advisory
- cpe
name:
type: string
minLength: 1
csaw:
type: boolean
package_state:
type: array
items:
type: object
properties:
product_name:
type: string
fix_state:
type: string
package_name:
type: string
cpe:
type: string
required:
- product_name
- fix_state
- package_name
- cpe
required:
- threat_severity
- public_date
- bugzilla
- cvss3
- cwe
- details
- acknowledgement
- name
- csaw

View File

@ -1,380 +0,0 @@
/*
* Red Hat Security Data API
*
* Unofficial OpenAPI definitions for Red Hat Security Data API
*
* API version: 1.0
* Contact: mustafa@ctrliq.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package rhsecurity
import (
"bytes"
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"strings"
)
// Linger please
var (
_ _context.Context
)
type DefaultApi interface {
/*
* GetCve Get specific CVE
* Retrieve full CVE details
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param cVE
* @return ApiGetCveRequest
*/
GetCve(ctx _context.Context, cVE string) ApiGetCveRequest
/*
* GetCveExecute executes the request
* @return CVEDetailed
*/
GetCveExecute(r ApiGetCveRequest) (CVEDetailed, *_nethttp.Response, error)
/*
* GetCves Get CVEs
* List all the recent CVEs when no parameter is passed. Returns a convenience object as response with very minimum attributes.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetCvesRequest
*/
GetCves(ctx _context.Context) ApiGetCvesRequest
/*
* GetCvesExecute executes the request
* @return []CVE
*/
GetCvesExecute(r ApiGetCvesRequest) ([]CVE, *_nethttp.Response, error)
}
// DefaultApiService DefaultApi service
type DefaultApiService service
type ApiGetCveRequest struct {
ctx _context.Context
ApiService DefaultApi
cVE string
}
func (r ApiGetCveRequest) Execute() (CVEDetailed, *_nethttp.Response, error) {
return r.ApiService.GetCveExecute(r)
}
/*
* GetCve Get specific CVE
* Retrieve full CVE details
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param cVE
* @return ApiGetCveRequest
*/
func (a *DefaultApiService) GetCve(ctx _context.Context, cVE string) ApiGetCveRequest {
return ApiGetCveRequest{
ApiService: a,
ctx: ctx,
cVE: cVE,
}
}
/*
* Execute executes the request
* @return CVEDetailed
*/
func (a *DefaultApiService) GetCveExecute(r ApiGetCveRequest) (CVEDetailed, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue CVEDetailed
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCve")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/cve/{CVE}.json"
localVarPath = strings.Replace(localVarPath, "{"+"CVE"+"}", _neturl.PathEscape(parameterToString(r.cVE, "")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetCvesRequest struct {
ctx _context.Context
ApiService DefaultApi
before *string
after *string
ids *string
bug *string
advisory *string
severity *string
package_ *string
product *string
cwe *string
cvssScore *float32
cvss3Score *string
page *float32
perPage *float32
createdDaysAgo *float32
}
func (r ApiGetCvesRequest) Before(before string) ApiGetCvesRequest {
r.before = &before
return r
}
func (r ApiGetCvesRequest) After(after string) ApiGetCvesRequest {
r.after = &after
return r
}
func (r ApiGetCvesRequest) Ids(ids string) ApiGetCvesRequest {
r.ids = &ids
return r
}
func (r ApiGetCvesRequest) Bug(bug string) ApiGetCvesRequest {
r.bug = &bug
return r
}
func (r ApiGetCvesRequest) Advisory(advisory string) ApiGetCvesRequest {
r.advisory = &advisory
return r
}
func (r ApiGetCvesRequest) Severity(severity string) ApiGetCvesRequest {
r.severity = &severity
return r
}
func (r ApiGetCvesRequest) Package_(package_ string) ApiGetCvesRequest {
r.package_ = &package_
return r
}
func (r ApiGetCvesRequest) Product(product string) ApiGetCvesRequest {
r.product = &product
return r
}
func (r ApiGetCvesRequest) Cwe(cwe string) ApiGetCvesRequest {
r.cwe = &cwe
return r
}
func (r ApiGetCvesRequest) CvssScore(cvssScore float32) ApiGetCvesRequest {
r.cvssScore = &cvssScore
return r
}
func (r ApiGetCvesRequest) Cvss3Score(cvss3Score string) ApiGetCvesRequest {
r.cvss3Score = &cvss3Score
return r
}
func (r ApiGetCvesRequest) Page(page float32) ApiGetCvesRequest {
r.page = &page
return r
}
func (r ApiGetCvesRequest) PerPage(perPage float32) ApiGetCvesRequest {
r.perPage = &perPage
return r
}
func (r ApiGetCvesRequest) CreatedDaysAgo(createdDaysAgo float32) ApiGetCvesRequest {
r.createdDaysAgo = &createdDaysAgo
return r
}
func (r ApiGetCvesRequest) Execute() ([]CVE, *_nethttp.Response, error) {
return r.ApiService.GetCvesExecute(r)
}
/*
* GetCves Get CVEs
* List all the recent CVEs when no parameter is passed. Returns a convenience object as response with very minimum attributes.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetCvesRequest
*/
func (a *DefaultApiService) GetCves(ctx _context.Context) ApiGetCvesRequest {
return ApiGetCvesRequest{
ApiService: a,
ctx: ctx,
}
}
/*
* Execute executes the request
* @return []CVE
*/
func (a *DefaultApiService) GetCvesExecute(r ApiGetCvesRequest) ([]CVE, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []CVE
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCves")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/cve.json"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.before != nil {
localVarQueryParams.Add("before", parameterToString(*r.before, ""))
}
if r.after != nil {
localVarQueryParams.Add("after", parameterToString(*r.after, ""))
}
if r.ids != nil {
localVarQueryParams.Add("ids", parameterToString(*r.ids, ""))
}
if r.bug != nil {
localVarQueryParams.Add("bug", parameterToString(*r.bug, ""))
}
if r.advisory != nil {
localVarQueryParams.Add("advisory", parameterToString(*r.advisory, ""))
}
if r.severity != nil {
localVarQueryParams.Add("severity", parameterToString(*r.severity, ""))
}
if r.package_ != nil {
localVarQueryParams.Add("package", parameterToString(*r.package_, ""))
}
if r.product != nil {
localVarQueryParams.Add("product", parameterToString(*r.product, ""))
}
if r.cwe != nil {
localVarQueryParams.Add("cwe", parameterToString(*r.cwe, ""))
}
if r.cvssScore != nil {
localVarQueryParams.Add("cvss_score", parameterToString(*r.cvssScore, ""))
}
if r.cvss3Score != nil {
localVarQueryParams.Add("cvss3_score", parameterToString(*r.cvss3Score, ""))
}
if r.page != nil {
localVarQueryParams.Add("page", parameterToString(*r.page, ""))
}
if r.perPage != nil {
localVarQueryParams.Add("per_page", parameterToString(*r.perPage, ""))
}
if r.createdDaysAgo != nil {
localVarQueryParams.Add("created_days_ago", parameterToString(*r.createdDaysAgo, ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}

View File

@ -1,536 +0,0 @@
/*
* Red Hat Security Data API
*
* Unofficial OpenAPI definitions for Red Hat Security Data API
*
* API version: 1.0
* Contact: mustafa@ctrliq.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package rhsecurity
import (
"bytes"
"context"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/http/httputil"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"unicode/utf8"
"golang.org/x/oauth2"
)
var (
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
)
// APIClient manages communication with the Red Hat Security Data API API v1.0
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
common service // Reuse a single struct instead of allocating one for each service on the heap.
// API Services
DefaultApi DefaultApi
}
type service struct {
client *APIClient
}
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
// optionally a custom http.Client to allow for advanced features such as caching.
func NewAPIClient(cfg *Configuration) *APIClient {
if cfg.HTTPClient == nil {
cfg.HTTPClient = http.DefaultClient
}
c := &APIClient{}
c.cfg = cfg
c.common.client = c
// API Services
c.DefaultApi = (*DefaultApiService)(&c.common)
return c
}
func atoi(in string) (int, error) {
return strconv.Atoi(in)
}
// selectHeaderContentType select a content type from the available list.
func selectHeaderContentType(contentTypes []string) string {
if len(contentTypes) == 0 {
return ""
}
if contains(contentTypes, "application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
// selectHeaderAccept join all accept types and return
func selectHeaderAccept(accepts []string) string {
if len(accepts) == 0 {
return ""
}
if contains(accepts, "application/json") {
return "application/json"
}
return strings.Join(accepts, ",")
}
// contains is a case insenstive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
return true
}
}
return false
}
// Verify optional parameters are of the correct type.
func typeCheckParameter(obj interface{}, expected string, name string) error {
// Make sure there is an object.
if obj == nil {
return nil
}
// Check the type is as expected.
if reflect.TypeOf(obj).String() != expected {
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
}
return nil
}
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func parameterToString(obj interface{}, collectionFormat string) string {
var delimiter string
switch collectionFormat {
case "pipes":
delimiter = "|"
case "ssv":
delimiter = " "
case "tsv":
delimiter = "\t"
case "csv":
delimiter = ","
}
if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
} else if t, ok := obj.(time.Time); ok {
return t.Format(time.RFC3339)
}
return fmt.Sprintf("%v", obj)
}
// helper for converting interface{} parameters to json strings
func parameterToJson(obj interface{}) (string, error) {
jsonBuf, err := json.Marshal(obj)
if err != nil {
return "", err
}
return string(jsonBuf), err
}
// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
if c.cfg.Debug {
dump, err := httputil.DumpRequestOut(request, true)
if err != nil {
return nil, err
}
log.Printf("\n%s\n", string(dump))
}
resp, err := c.cfg.HTTPClient.Do(request)
if err != nil {
return resp, err
}
if c.cfg.Debug {
dump, err := httputil.DumpResponse(resp, true)
if err != nil {
return resp, err
}
log.Printf("\n%s\n", string(dump))
}
return resp, err
}
// Allow modification of underlying config for alternate implementations and testing
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
func (c *APIClient) GetConfig() *Configuration {
return c.cfg
}
// prepareRequest build the request
func (c *APIClient) prepareRequest(
ctx context.Context,
path string, method string,
postBody interface{},
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
formFileName string,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
var body *bytes.Buffer
// Detect postBody type and post.
if postBody != nil {
contentType := headerParams["Content-Type"]
if contentType == "" {
contentType = detectContentType(postBody)
headerParams["Content-Type"] = contentType
}
body, err = setBody(postBody, contentType)
if err != nil {
return nil, err
}
}
// add form parameters and file if available.
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
if body != nil {
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
}
body = &bytes.Buffer{}
w := multipart.NewWriter(body)
for k, v := range formParams {
for _, iv := range v {
if strings.HasPrefix(k, "@") { // file
err = addFile(w, k[1:], iv)
if err != nil {
return nil, err
}
} else { // form value
w.WriteField(k, iv)
}
}
}
if len(fileBytes) > 0 && fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
if err != nil {
return nil, err
}
_, err = part.Write(fileBytes)
if err != nil {
return nil, err
}
}
// Set the Boundary in the Content-Type
headerParams["Content-Type"] = w.FormDataContentType()
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
w.Close()
}
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
if body != nil {
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
}
body = &bytes.Buffer{}
body.WriteString(formParams.Encode())
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
}
// Setup path and query parameters
url, err := url.Parse(path)
if err != nil {
return nil, err
}
// Override request host, if applicable
if c.cfg.Host != "" {
url.Host = c.cfg.Host
}
// Override request scheme, if applicable
if c.cfg.Scheme != "" {
url.Scheme = c.cfg.Scheme
}
// Adding Query Param
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
query.Add(k, iv)
}
}
// Encode the parameters.
url.RawQuery = query.Encode()
// Generate a new request
if body != nil {
localVarRequest, err = http.NewRequest(method, url.String(), body)
} else {
localVarRequest, err = http.NewRequest(method, url.String(), nil)
}
if err != nil {
return nil, err
}
// add header parameters, if any
if len(headerParams) > 0 {
headers := http.Header{}
for h, v := range headerParams {
headers.Set(h, v)
}
localVarRequest.Header = headers
}
// Add the user agent to the request.
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
if ctx != nil {
// add context to the request
localVarRequest = localVarRequest.WithContext(ctx)
// Walk through any authentication.
// OAuth2 authentication
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
// We were able to grab an oauth2 token from the context
var latestToken *oauth2.Token
if latestToken, err = tok.Token(); err != nil {
return nil, err
}
latestToken.SetAuthHeader(localVarRequest)
}
// Basic HTTP Authentication
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
}
// AccessToken Authentication
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
}
}
for header, value := range c.cfg.DefaultHeader {
localVarRequest.Header.Add(header, value)
}
return localVarRequest, nil
}
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
if len(b) == 0 {
return nil
}
if s, ok := v.(*string); ok {
*s = string(b)
return nil
}
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err
}
return nil
}
if jsonCheck.MatchString(contentType) {
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
return err
}
} else {
return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
}
} else if err = json.Unmarshal(b, v); err != nil { // simple model
return err
}
return nil
}
return errors.New("undefined response type")
}
// Add a file to the multipart request
func addFile(w *multipart.Writer, fieldName, path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
if err != nil {
return err
}
_, err = io.Copy(part, file)
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
bodyBuf = &bytes.Buffer{}
}
if reader, ok := body.(io.Reader); ok {
_, err = bodyBuf.ReadFrom(reader)
} else if fp, ok := body.(**os.File); ok {
_, err = bodyBuf.ReadFrom(*fp)
} else if b, ok := body.([]byte); ok {
_, err = bodyBuf.Write(b)
} else if s, ok := body.(string); ok {
_, err = bodyBuf.WriteString(s)
} else if s, ok := body.(*string); ok {
_, err = bodyBuf.WriteString(*s)
} else if jsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if xmlCheck.MatchString(contentType) {
err = xml.NewEncoder(bodyBuf).Encode(body)
}
if err != nil {
return nil, err
}
if bodyBuf.Len() == 0 {
err = fmt.Errorf("Invalid body type %s\n", contentType)
return nil, err
}
return bodyBuf, nil
}
// detectContentType method is used to figure out `Request.Body` content type for request header
func detectContentType(body interface{}) string {
contentType := "text/plain; charset=utf-8"
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"
default:
if b, ok := body.([]byte); ok {
contentType = http.DetectContentType(b)
} else if kind == reflect.Slice {
contentType = "application/json; charset=utf-8"
}
}
return contentType
}
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
type cacheControl map[string]string
func parseCacheControl(headers http.Header) cacheControl {
cc := cacheControl{}
ccHeader := headers.Get("Cache-Control")
for _, part := range strings.Split(ccHeader, ",") {
part = strings.Trim(part, " ")
if part == "" {
continue
}
if strings.ContainsRune(part, '=') {
keyval := strings.Split(part, "=")
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
} else {
cc[part] = ""
}
}
return cc
}
// CacheExpires helper function to determine remaining time before repeating a request.
func CacheExpires(r *http.Response) time.Time {
// Figure out when the cache expires.
var expires time.Time
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
if err != nil {
return time.Now()
}
respCacheControl := parseCacheControl(r.Header)
if maxAge, ok := respCacheControl["max-age"]; ok {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
} else {
expires = now.Add(lifetime)
}
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {
expires, err = time.Parse(time.RFC1123, expiresHeader)
if err != nil {
expires = now
}
}
}
return expires
}
func strlen(s string) int {
return utf8.RuneCountInString(s)
}
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
type GenericOpenAPIError struct {
body []byte
error string
model interface{}
}
// Error returns non-empty string if there was an error.
func (e GenericOpenAPIError) Error() string {
return e.error
}
// Body returns the raw bytes of the response
func (e GenericOpenAPIError) Body() []byte {
return e.body
}
// Model returns the unpacked model of the error
func (e GenericOpenAPIError) Model() interface{} {
return e.model
}

View File

@ -1,230 +0,0 @@
/*
* Red Hat Security Data API
*
* Unofficial OpenAPI definitions for Red Hat Security Data API
*
* API version: 1.0
* Contact: mustafa@ctrliq.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package rhsecurity
import (
"context"
"fmt"
"net/http"
"strings"
)
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type contextKey string
func (c contextKey) String() string {
return "auth " + string(c)
}
var (
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")
// ContextBasicAuth takes BasicAuth as authentication for the request.
ContextBasicAuth = contextKey("basic")
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAccessToken = contextKey("accesstoken")
// ContextAPIKeys takes a string apikey as authentication for the request
ContextAPIKeys = contextKey("apiKeys")
// ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request.
ContextHttpSignatureAuth = contextKey("httpsignature")
// ContextServerIndex uses a server configuration from the index.
ContextServerIndex = contextKey("serverIndex")
// ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerIndices = contextKey("serverOperationIndices")
// ContextServerVariables overrides a server configuration variables.
ContextServerVariables = contextKey("serverVariables")
// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextOperationServerVariables = contextKey("serverOperationVariables")
)
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type BasicAuth struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
Key string
Prefix string
}
// ServerVariable stores the information about a server variable
type ServerVariable struct {
Description string
DefaultValue string
EnumValues []string
}
// ServerConfiguration stores the information about a server
type ServerConfiguration struct {
URL string
Description string
Variables map[string]ServerVariable
}
// ServerConfigurations stores multiple ServerConfiguration items
type ServerConfigurations []ServerConfiguration
// Configuration stores the configuration of the API client
type Configuration struct {
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Debug bool `json:"debug,omitempty"`
Servers ServerConfigurations
OperationServers map[string]ServerConfigurations
HTTPClient *http.Client
}
// NewConfiguration returns a new Configuration object
func NewConfiguration() *Configuration {
cfg := &Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Servers: ServerConfigurations{
{
URL: "https://access.redhat.com/hydra/rest/securitydata",
Description: "No description provided",
},
},
OperationServers: map[string]ServerConfigurations{},
}
return cfg
}
// AddDefaultHeader adds a new HTTP header to the default header in the request
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
}
// URL formats template on a index using given variables
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) {
if index < 0 || len(sc) <= index {
return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1)
}
server := sc[index]
url := server.URL
// go through variables and replace placeholders
for name, variable := range server.Variables {
if value, ok := variables[name]; ok {
found := bool(len(variable.EnumValues) == 0)
for _, enumValue := range variable.EnumValues {
if value == enumValue {
found = true
}
}
if !found {
return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
}
url = strings.Replace(url, "{"+name+"}", value, -1)
} else {
url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1)
}
}
return url, nil
}
// ServerURL returns URL based on server settings
func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) {
return c.Servers.URL(index, variables)
}
func getServerIndex(ctx context.Context) (int, error) {
si := ctx.Value(ContextServerIndex)
if si != nil {
if index, ok := si.(int); ok {
return index, nil
}
return 0, reportError("Invalid type %T should be int", si)
}
return 0, nil
}
func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) {
osi := ctx.Value(ContextOperationServerIndices)
if osi != nil {
if operationIndices, ok := osi.(map[string]int); !ok {
return 0, reportError("Invalid type %T should be map[string]int", osi)
} else {
index, ok := operationIndices[endpoint]
if ok {
return index, nil
}
}
}
return getServerIndex(ctx)
}
func getServerVariables(ctx context.Context) (map[string]string, error) {
sv := ctx.Value(ContextServerVariables)
if sv != nil {
if variables, ok := sv.(map[string]string); ok {
return variables, nil
}
return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv)
}
return nil, nil
}
func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) {
osv := ctx.Value(ContextOperationServerVariables)
if osv != nil {
if operationVariables, ok := osv.(map[string]map[string]string); !ok {
return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv)
} else {
variables, ok := operationVariables[endpoint]
if ok {
return variables, nil
}
}
}
return getServerVariables(ctx)
}
// ServerURLWithContext returns a new server URL given an endpoint
func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) {
sc, ok := c.OperationServers[endpoint]
if !ok {
sc = c.Servers
}
if ctx == nil {
return sc.URL(0, nil)
}
index, err := getServerOperationIndex(ctx, endpoint)
if err != nil {
return "", err
}
variables, err := getServerOperationVariables(ctx, endpoint)
if err != nil {
return "", err
}
return sc.URL(index, variables)
}

View File

@ -1,313 +0,0 @@
# CVE
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**CVE** | **string** | |
**Severity** | **string** | |
**PublicDate** | **string** | |
**Advisories** | **[]string** | |
**Bugzilla** | **string** | |
**BugzillaDescription** | **string** | |
**CvssScore** | Pointer to **float32** | | [optional]
**CvssScoringVector** | Pointer to **string** | | [optional]
**CWE** | **string** | |
**AffectedPackages** | **[]string** | |
**ResourceUrl** | **string** | |
**Cvss3ScoringVector** | **string** | |
**Cvss3Score** | **string** | |
## Methods
### NewCVE
`func NewCVE(cVE string, severity string, publicDate string, advisories []string, bugzilla string, bugzillaDescription string, cWE string, affectedPackages []string, resourceUrl string, cvss3ScoringVector string, cvss3Score string, ) *CVE`
NewCVE instantiates a new CVE object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewCVEWithDefaults
`func NewCVEWithDefaults() *CVE`
NewCVEWithDefaults instantiates a new CVE object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetCVE
`func (o *CVE) GetCVE() string`
GetCVE returns the CVE field if non-nil, zero value otherwise.
### GetCVEOk
`func (o *CVE) GetCVEOk() (*string, bool)`
GetCVEOk returns a tuple with the CVE field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCVE
`func (o *CVE) SetCVE(v string)`
SetCVE sets CVE field to given value.
### GetSeverity
`func (o *CVE) GetSeverity() string`
GetSeverity returns the Severity field if non-nil, zero value otherwise.
### GetSeverityOk
`func (o *CVE) GetSeverityOk() (*string, bool)`
GetSeverityOk returns a tuple with the Severity field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetSeverity
`func (o *CVE) SetSeverity(v string)`
SetSeverity sets Severity field to given value.
### GetPublicDate
`func (o *CVE) GetPublicDate() string`
GetPublicDate returns the PublicDate field if non-nil, zero value otherwise.
### GetPublicDateOk
`func (o *CVE) GetPublicDateOk() (*string, bool)`
GetPublicDateOk returns a tuple with the PublicDate field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetPublicDate
`func (o *CVE) SetPublicDate(v string)`
SetPublicDate sets PublicDate field to given value.
### GetAdvisories
`func (o *CVE) GetAdvisories() []string`
GetAdvisories returns the Advisories field if non-nil, zero value otherwise.
### GetAdvisoriesOk
`func (o *CVE) GetAdvisoriesOk() (*[]string, bool)`
GetAdvisoriesOk returns a tuple with the Advisories field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetAdvisories
`func (o *CVE) SetAdvisories(v []string)`
SetAdvisories sets Advisories field to given value.
### GetBugzilla
`func (o *CVE) GetBugzilla() string`
GetBugzilla returns the Bugzilla field if non-nil, zero value otherwise.
### GetBugzillaOk
`func (o *CVE) GetBugzillaOk() (*string, bool)`
GetBugzillaOk returns a tuple with the Bugzilla field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetBugzilla
`func (o *CVE) SetBugzilla(v string)`
SetBugzilla sets Bugzilla field to given value.
### GetBugzillaDescription
`func (o *CVE) GetBugzillaDescription() string`
GetBugzillaDescription returns the BugzillaDescription field if non-nil, zero value otherwise.
### GetBugzillaDescriptionOk
`func (o *CVE) GetBugzillaDescriptionOk() (*string, bool)`
GetBugzillaDescriptionOk returns a tuple with the BugzillaDescription field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetBugzillaDescription
`func (o *CVE) SetBugzillaDescription(v string)`
SetBugzillaDescription sets BugzillaDescription field to given value.
### GetCvssScore
`func (o *CVE) GetCvssScore() float32`
GetCvssScore returns the CvssScore field if non-nil, zero value otherwise.
### GetCvssScoreOk
`func (o *CVE) GetCvssScoreOk() (*float32, bool)`
GetCvssScoreOk returns a tuple with the CvssScore field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvssScore
`func (o *CVE) SetCvssScore(v float32)`
SetCvssScore sets CvssScore field to given value.
### HasCvssScore
`func (o *CVE) HasCvssScore() bool`
HasCvssScore returns a boolean if a field has been set.
### GetCvssScoringVector
`func (o *CVE) GetCvssScoringVector() string`
GetCvssScoringVector returns the CvssScoringVector field if non-nil, zero value otherwise.
### GetCvssScoringVectorOk
`func (o *CVE) GetCvssScoringVectorOk() (*string, bool)`
GetCvssScoringVectorOk returns a tuple with the CvssScoringVector field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvssScoringVector
`func (o *CVE) SetCvssScoringVector(v string)`
SetCvssScoringVector sets CvssScoringVector field to given value.
### HasCvssScoringVector
`func (o *CVE) HasCvssScoringVector() bool`
HasCvssScoringVector returns a boolean if a field has been set.
### GetCWE
`func (o *CVE) GetCWE() string`
GetCWE returns the CWE field if non-nil, zero value otherwise.
### GetCWEOk
`func (o *CVE) GetCWEOk() (*string, bool)`
GetCWEOk returns a tuple with the CWE field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCWE
`func (o *CVE) SetCWE(v string)`
SetCWE sets CWE field to given value.
### GetAffectedPackages
`func (o *CVE) GetAffectedPackages() []string`
GetAffectedPackages returns the AffectedPackages field if non-nil, zero value otherwise.
### GetAffectedPackagesOk
`func (o *CVE) GetAffectedPackagesOk() (*[]string, bool)`
GetAffectedPackagesOk returns a tuple with the AffectedPackages field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetAffectedPackages
`func (o *CVE) SetAffectedPackages(v []string)`
SetAffectedPackages sets AffectedPackages field to given value.
### GetResourceUrl
`func (o *CVE) GetResourceUrl() string`
GetResourceUrl returns the ResourceUrl field if non-nil, zero value otherwise.
### GetResourceUrlOk
`func (o *CVE) GetResourceUrlOk() (*string, bool)`
GetResourceUrlOk returns a tuple with the ResourceUrl field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetResourceUrl
`func (o *CVE) SetResourceUrl(v string)`
SetResourceUrl sets ResourceUrl field to given value.
### GetCvss3ScoringVector
`func (o *CVE) GetCvss3ScoringVector() string`
GetCvss3ScoringVector returns the Cvss3ScoringVector field if non-nil, zero value otherwise.
### GetCvss3ScoringVectorOk
`func (o *CVE) GetCvss3ScoringVectorOk() (*string, bool)`
GetCvss3ScoringVectorOk returns a tuple with the Cvss3ScoringVector field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvss3ScoringVector
`func (o *CVE) SetCvss3ScoringVector(v string)`
SetCvss3ScoringVector sets Cvss3ScoringVector field to given value.
### GetCvss3Score
`func (o *CVE) GetCvss3Score() string`
GetCvss3Score returns the Cvss3Score field if non-nil, zero value otherwise.
### GetCvss3ScoreOk
`func (o *CVE) GetCvss3ScoreOk() (*string, bool)`
GetCvss3ScoreOk returns a tuple with the Cvss3Score field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvss3Score
`func (o *CVE) SetCvss3Score(v string)`
SetCvss3Score sets Cvss3Score field to given value.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,271 +0,0 @@
# CVEDetailed
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ThreatSeverity** | **string** | |
**PublicDate** | **string** | |
**Bugzilla** | [**CVEDetailedBugzilla**](CVEDetailedBugzilla.md) | |
**Cvss3** | [**CVEDetailedCvss3**](CVEDetailedCvss3.md) | |
**Cwe** | **string** | |
**Details** | **[]string** | |
**Acknowledgement** | **string** | |
**AffectedRelease** | Pointer to [**[]CVEDetailedAffectedRelease**](CVEDetailedAffectedRelease.md) | | [optional]
**Name** | **string** | |
**Csaw** | **bool** | |
**PackageState** | Pointer to [**[]CVEDetailedPackageState**](CVEDetailedPackageState.md) | | [optional]
## Methods
### NewCVEDetailed
`func NewCVEDetailed(threatSeverity string, publicDate string, bugzilla CVEDetailedBugzilla, cvss3 CVEDetailedCvss3, cwe string, details []string, acknowledgement string, name string, csaw bool, ) *CVEDetailed`
NewCVEDetailed instantiates a new CVEDetailed object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewCVEDetailedWithDefaults
`func NewCVEDetailedWithDefaults() *CVEDetailed`
NewCVEDetailedWithDefaults instantiates a new CVEDetailed object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetThreatSeverity
`func (o *CVEDetailed) GetThreatSeverity() string`
GetThreatSeverity returns the ThreatSeverity field if non-nil, zero value otherwise.
### GetThreatSeverityOk
`func (o *CVEDetailed) GetThreatSeverityOk() (*string, bool)`
GetThreatSeverityOk returns a tuple with the ThreatSeverity field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetThreatSeverity
`func (o *CVEDetailed) SetThreatSeverity(v string)`
SetThreatSeverity sets ThreatSeverity field to given value.
### GetPublicDate
`func (o *CVEDetailed) GetPublicDate() string`
GetPublicDate returns the PublicDate field if non-nil, zero value otherwise.
### GetPublicDateOk
`func (o *CVEDetailed) GetPublicDateOk() (*string, bool)`
GetPublicDateOk returns a tuple with the PublicDate field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetPublicDate
`func (o *CVEDetailed) SetPublicDate(v string)`
SetPublicDate sets PublicDate field to given value.
### GetBugzilla
`func (o *CVEDetailed) GetBugzilla() CVEDetailedBugzilla`
GetBugzilla returns the Bugzilla field if non-nil, zero value otherwise.
### GetBugzillaOk
`func (o *CVEDetailed) GetBugzillaOk() (*CVEDetailedBugzilla, bool)`
GetBugzillaOk returns a tuple with the Bugzilla field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetBugzilla
`func (o *CVEDetailed) SetBugzilla(v CVEDetailedBugzilla)`
SetBugzilla sets Bugzilla field to given value.
### GetCvss3
`func (o *CVEDetailed) GetCvss3() CVEDetailedCvss3`
GetCvss3 returns the Cvss3 field if non-nil, zero value otherwise.
### GetCvss3Ok
`func (o *CVEDetailed) GetCvss3Ok() (*CVEDetailedCvss3, bool)`
GetCvss3Ok returns a tuple with the Cvss3 field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvss3
`func (o *CVEDetailed) SetCvss3(v CVEDetailedCvss3)`
SetCvss3 sets Cvss3 field to given value.
### GetCwe
`func (o *CVEDetailed) GetCwe() string`
GetCwe returns the Cwe field if non-nil, zero value otherwise.
### GetCweOk
`func (o *CVEDetailed) GetCweOk() (*string, bool)`
GetCweOk returns a tuple with the Cwe field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCwe
`func (o *CVEDetailed) SetCwe(v string)`
SetCwe sets Cwe field to given value.
### GetDetails
`func (o *CVEDetailed) GetDetails() []string`
GetDetails returns the Details field if non-nil, zero value otherwise.
### GetDetailsOk
`func (o *CVEDetailed) GetDetailsOk() (*[]string, bool)`
GetDetailsOk returns a tuple with the Details field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetDetails
`func (o *CVEDetailed) SetDetails(v []string)`
SetDetails sets Details field to given value.
### GetAcknowledgement
`func (o *CVEDetailed) GetAcknowledgement() string`
GetAcknowledgement returns the Acknowledgement field if non-nil, zero value otherwise.
### GetAcknowledgementOk
`func (o *CVEDetailed) GetAcknowledgementOk() (*string, bool)`
GetAcknowledgementOk returns a tuple with the Acknowledgement field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetAcknowledgement
`func (o *CVEDetailed) SetAcknowledgement(v string)`
SetAcknowledgement sets Acknowledgement field to given value.
### GetAffectedRelease
`func (o *CVEDetailed) GetAffectedRelease() []CVEDetailedAffectedRelease`
GetAffectedRelease returns the AffectedRelease field if non-nil, zero value otherwise.
### GetAffectedReleaseOk
`func (o *CVEDetailed) GetAffectedReleaseOk() (*[]CVEDetailedAffectedRelease, bool)`
GetAffectedReleaseOk returns a tuple with the AffectedRelease field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetAffectedRelease
`func (o *CVEDetailed) SetAffectedRelease(v []CVEDetailedAffectedRelease)`
SetAffectedRelease sets AffectedRelease field to given value.
### HasAffectedRelease
`func (o *CVEDetailed) HasAffectedRelease() bool`
HasAffectedRelease returns a boolean if a field has been set.
### GetName
`func (o *CVEDetailed) GetName() string`
GetName returns the Name field if non-nil, zero value otherwise.
### GetNameOk
`func (o *CVEDetailed) GetNameOk() (*string, bool)`
GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetName
`func (o *CVEDetailed) SetName(v string)`
SetName sets Name field to given value.
### GetCsaw
`func (o *CVEDetailed) GetCsaw() bool`
GetCsaw returns the Csaw field if non-nil, zero value otherwise.
### GetCsawOk
`func (o *CVEDetailed) GetCsawOk() (*bool, bool)`
GetCsawOk returns a tuple with the Csaw field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCsaw
`func (o *CVEDetailed) SetCsaw(v bool)`
SetCsaw sets Csaw field to given value.
### GetPackageState
`func (o *CVEDetailed) GetPackageState() []CVEDetailedPackageState`
GetPackageState returns the PackageState field if non-nil, zero value otherwise.
### GetPackageStateOk
`func (o *CVEDetailed) GetPackageStateOk() (*[]CVEDetailedPackageState, bool)`
GetPackageStateOk returns a tuple with the PackageState field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetPackageState
`func (o *CVEDetailed) SetPackageState(v []CVEDetailedPackageState)`
SetPackageState sets PackageState field to given value.
### HasPackageState
`func (o *CVEDetailed) HasPackageState() bool`
HasPackageState returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,140 +0,0 @@
# CVEDetailedAffectedRelease
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ProductName** | **string** | |
**ReleaseDate** | **string** | |
**Advisory** | **string** | |
**Cpe** | **string** | |
**Package** | Pointer to **string** | | [optional]
## Methods
### NewCVEDetailedAffectedRelease
`func NewCVEDetailedAffectedRelease(productName string, releaseDate string, advisory string, cpe string, ) *CVEDetailedAffectedRelease`
NewCVEDetailedAffectedRelease instantiates a new CVEDetailedAffectedRelease object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewCVEDetailedAffectedReleaseWithDefaults
`func NewCVEDetailedAffectedReleaseWithDefaults() *CVEDetailedAffectedRelease`
NewCVEDetailedAffectedReleaseWithDefaults instantiates a new CVEDetailedAffectedRelease object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetProductName
`func (o *CVEDetailedAffectedRelease) GetProductName() string`
GetProductName returns the ProductName field if non-nil, zero value otherwise.
### GetProductNameOk
`func (o *CVEDetailedAffectedRelease) GetProductNameOk() (*string, bool)`
GetProductNameOk returns a tuple with the ProductName field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetProductName
`func (o *CVEDetailedAffectedRelease) SetProductName(v string)`
SetProductName sets ProductName field to given value.
### GetReleaseDate
`func (o *CVEDetailedAffectedRelease) GetReleaseDate() string`
GetReleaseDate returns the ReleaseDate field if non-nil, zero value otherwise.
### GetReleaseDateOk
`func (o *CVEDetailedAffectedRelease) GetReleaseDateOk() (*string, bool)`
GetReleaseDateOk returns a tuple with the ReleaseDate field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetReleaseDate
`func (o *CVEDetailedAffectedRelease) SetReleaseDate(v string)`
SetReleaseDate sets ReleaseDate field to given value.
### GetAdvisory
`func (o *CVEDetailedAffectedRelease) GetAdvisory() string`
GetAdvisory returns the Advisory field if non-nil, zero value otherwise.
### GetAdvisoryOk
`func (o *CVEDetailedAffectedRelease) GetAdvisoryOk() (*string, bool)`
GetAdvisoryOk returns a tuple with the Advisory field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetAdvisory
`func (o *CVEDetailedAffectedRelease) SetAdvisory(v string)`
SetAdvisory sets Advisory field to given value.
### GetCpe
`func (o *CVEDetailedAffectedRelease) GetCpe() string`
GetCpe returns the Cpe field if non-nil, zero value otherwise.
### GetCpeOk
`func (o *CVEDetailedAffectedRelease) GetCpeOk() (*string, bool)`
GetCpeOk returns a tuple with the Cpe field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCpe
`func (o *CVEDetailedAffectedRelease) SetCpe(v string)`
SetCpe sets Cpe field to given value.
### GetPackage
`func (o *CVEDetailedAffectedRelease) GetPackage() string`
GetPackage returns the Package field if non-nil, zero value otherwise.
### GetPackageOk
`func (o *CVEDetailedAffectedRelease) GetPackageOk() (*string, bool)`
GetPackageOk returns a tuple with the Package field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetPackage
`func (o *CVEDetailedAffectedRelease) SetPackage(v string)`
SetPackage sets Package field to given value.
### HasPackage
`func (o *CVEDetailedAffectedRelease) HasPackage() bool`
HasPackage returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,93 +0,0 @@
# CVEDetailedBugzilla
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Description** | **string** | |
**Id** | **string** | |
**Url** | **string** | |
## Methods
### NewCVEDetailedBugzilla
`func NewCVEDetailedBugzilla(description string, id string, url string, ) *CVEDetailedBugzilla`
NewCVEDetailedBugzilla instantiates a new CVEDetailedBugzilla object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewCVEDetailedBugzillaWithDefaults
`func NewCVEDetailedBugzillaWithDefaults() *CVEDetailedBugzilla`
NewCVEDetailedBugzillaWithDefaults instantiates a new CVEDetailedBugzilla object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetDescription
`func (o *CVEDetailedBugzilla) GetDescription() string`
GetDescription returns the Description field if non-nil, zero value otherwise.
### GetDescriptionOk
`func (o *CVEDetailedBugzilla) GetDescriptionOk() (*string, bool)`
GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetDescription
`func (o *CVEDetailedBugzilla) SetDescription(v string)`
SetDescription sets Description field to given value.
### GetId
`func (o *CVEDetailedBugzilla) GetId() string`
GetId returns the Id field if non-nil, zero value otherwise.
### GetIdOk
`func (o *CVEDetailedBugzilla) GetIdOk() (*string, bool)`
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetId
`func (o *CVEDetailedBugzilla) SetId(v string)`
SetId sets Id field to given value.
### GetUrl
`func (o *CVEDetailedBugzilla) GetUrl() string`
GetUrl returns the Url field if non-nil, zero value otherwise.
### GetUrlOk
`func (o *CVEDetailedBugzilla) GetUrlOk() (*string, bool)`
GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetUrl
`func (o *CVEDetailedBugzilla) SetUrl(v string)`
SetUrl sets Url field to given value.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,93 +0,0 @@
# CVEDetailedCvss3
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cvss3BaseScore** | **string** | |
**Cvss3ScoringVector** | **string** | |
**Status** | **string** | |
## Methods
### NewCVEDetailedCvss3
`func NewCVEDetailedCvss3(cvss3BaseScore string, cvss3ScoringVector string, status string, ) *CVEDetailedCvss3`
NewCVEDetailedCvss3 instantiates a new CVEDetailedCvss3 object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewCVEDetailedCvss3WithDefaults
`func NewCVEDetailedCvss3WithDefaults() *CVEDetailedCvss3`
NewCVEDetailedCvss3WithDefaults instantiates a new CVEDetailedCvss3 object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetCvss3BaseScore
`func (o *CVEDetailedCvss3) GetCvss3BaseScore() string`
GetCvss3BaseScore returns the Cvss3BaseScore field if non-nil, zero value otherwise.
### GetCvss3BaseScoreOk
`func (o *CVEDetailedCvss3) GetCvss3BaseScoreOk() (*string, bool)`
GetCvss3BaseScoreOk returns a tuple with the Cvss3BaseScore field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvss3BaseScore
`func (o *CVEDetailedCvss3) SetCvss3BaseScore(v string)`
SetCvss3BaseScore sets Cvss3BaseScore field to given value.
### GetCvss3ScoringVector
`func (o *CVEDetailedCvss3) GetCvss3ScoringVector() string`
GetCvss3ScoringVector returns the Cvss3ScoringVector field if non-nil, zero value otherwise.
### GetCvss3ScoringVectorOk
`func (o *CVEDetailedCvss3) GetCvss3ScoringVectorOk() (*string, bool)`
GetCvss3ScoringVectorOk returns a tuple with the Cvss3ScoringVector field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCvss3ScoringVector
`func (o *CVEDetailedCvss3) SetCvss3ScoringVector(v string)`
SetCvss3ScoringVector sets Cvss3ScoringVector field to given value.
### GetStatus
`func (o *CVEDetailedCvss3) GetStatus() string`
GetStatus returns the Status field if non-nil, zero value otherwise.
### GetStatusOk
`func (o *CVEDetailedCvss3) GetStatusOk() (*string, bool)`
GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetStatus
`func (o *CVEDetailedCvss3) SetStatus(v string)`
SetStatus sets Status field to given value.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,114 +0,0 @@
# CVEDetailedPackageState
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ProductName** | **string** | |
**FixState** | **string** | |
**PackageName** | **string** | |
**Cpe** | **string** | |
## Methods
### NewCVEDetailedPackageState
`func NewCVEDetailedPackageState(productName string, fixState string, packageName string, cpe string, ) *CVEDetailedPackageState`
NewCVEDetailedPackageState instantiates a new CVEDetailedPackageState object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewCVEDetailedPackageStateWithDefaults
`func NewCVEDetailedPackageStateWithDefaults() *CVEDetailedPackageState`
NewCVEDetailedPackageStateWithDefaults instantiates a new CVEDetailedPackageState object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetProductName
`func (o *CVEDetailedPackageState) GetProductName() string`
GetProductName returns the ProductName field if non-nil, zero value otherwise.
### GetProductNameOk
`func (o *CVEDetailedPackageState) GetProductNameOk() (*string, bool)`
GetProductNameOk returns a tuple with the ProductName field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetProductName
`func (o *CVEDetailedPackageState) SetProductName(v string)`
SetProductName sets ProductName field to given value.
### GetFixState
`func (o *CVEDetailedPackageState) GetFixState() string`
GetFixState returns the FixState field if non-nil, zero value otherwise.
### GetFixStateOk
`func (o *CVEDetailedPackageState) GetFixStateOk() (*string, bool)`
GetFixStateOk returns a tuple with the FixState field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetFixState
`func (o *CVEDetailedPackageState) SetFixState(v string)`
SetFixState sets FixState field to given value.
### GetPackageName
`func (o *CVEDetailedPackageState) GetPackageName() string`
GetPackageName returns the PackageName field if non-nil, zero value otherwise.
### GetPackageNameOk
`func (o *CVEDetailedPackageState) GetPackageNameOk() (*string, bool)`
GetPackageNameOk returns a tuple with the PackageName field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetPackageName
`func (o *CVEDetailedPackageState) SetPackageName(v string)`
SetPackageName sets PackageName field to given value.
### GetCpe
`func (o *CVEDetailedPackageState) GetCpe() string`
GetCpe returns the Cpe field if non-nil, zero value otherwise.
### GetCpeOk
`func (o *CVEDetailedPackageState) GetCpeOk() (*string, bool)`
GetCpeOk returns a tuple with the Cpe field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCpe
`func (o *CVEDetailedPackageState) SetCpe(v string)`
SetCpe sets Cpe field to given value.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,173 +0,0 @@
# \DefaultApi
All URIs are relative to *https://access.redhat.com/hydra/rest/securitydata*
Method | HTTP request | Description
------------- | ------------- | -------------
[**GetCve**](DefaultApi.md#GetCve) | **Get** /cve/{CVE}.json | Get specific CVE
[**GetCves**](DefaultApi.md#GetCves) | **Get** /cve.json | Get CVEs
## GetCve
> CVEDetailed GetCve(ctx, cVE).Execute()
Get specific CVE
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
cVE := "cVE_example" // string |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.DefaultApi.GetCve(context.Background(), cVE).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.GetCve``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCve`: CVEDetailed
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.GetCve`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**cVE** | **string** | |
### Other Parameters
Other parameters are passed through a pointer to a apiGetCveRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
[**CVEDetailed**](CVEDetailed.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## GetCves
> []CVE GetCves(ctx).Before(before).After(after).Ids(ids).Bug(bug).Advisory(advisory).Severity(severity).Package_(package_).Product(product).Cwe(cwe).CvssScore(cvssScore).Cvss3Score(cvss3Score).Page(page).PerPage(perPage).CreatedDaysAgo(createdDaysAgo).Execute()
Get CVEs
### Example
```go
package main
import (
"context"
"fmt"
"os"
"time"
openapiclient "./openapi"
)
func main() {
before := time.Now() // string | CVEs before the query date. [ISO 8601 is the expected format] (optional)
after := time.Now() // string | CVEs after the query date. [ISO 8601 is the expected format] (optional)
ids := "ids_example" // string | CVEs for Ids separated by comma (optional)
bug := "bug_example" // string | CVEs for Bugzilla Ids (optional)
advisory := "advisory_example" // string | CVEs for advisory (optional)
severity := "severity_example" // string | CVEs for severity (optional)
package_ := "package__example" // string | CVEs which affect the package (optional)
product := "product_example" // string | CVEs which affect the product. The parameter supports Perl compatible regular expressions. (optional)
cwe := "cwe_example" // string | CVEs with CWE (optional)
cvssScore := float32(8.14) // float32 | CVEs with CVSS score greater than or equal to this value (optional)
cvss3Score := "cvss3Score_example" // string | CVEs with CVSSv3 score greater than or equal to this value (optional)
page := float32(8.14) // float32 | CVEs for page number (optional)
perPage := float32(8.14) // float32 | Number of CVEs to return per page (optional)
createdDaysAgo := float32(8.14) // float32 | Index of CVEs definitions created days ago (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.DefaultApi.GetCves(context.Background()).Before(before).After(after).Ids(ids).Bug(bug).Advisory(advisory).Severity(severity).Package_(package_).Product(product).Cwe(cwe).CvssScore(cvssScore).Cvss3Score(cvss3Score).Page(page).PerPage(perPage).CreatedDaysAgo(createdDaysAgo).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.GetCves``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCves`: []CVE
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.GetCves`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiGetCvesRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**before** | **string** | CVEs before the query date. [ISO 8601 is the expected format] |
**after** | **string** | CVEs after the query date. [ISO 8601 is the expected format] |
**ids** | **string** | CVEs for Ids separated by comma |
**bug** | **string** | CVEs for Bugzilla Ids |
**advisory** | **string** | CVEs for advisory |
**severity** | **string** | CVEs for severity |
**package_** | **string** | CVEs which affect the package |
**product** | **string** | CVEs which affect the product. The parameter supports Perl compatible regular expressions. |
**cwe** | **string** | CVEs with CWE |
**cvssScore** | **float32** | CVEs with CVSS score greater than or equal to this value |
**cvss3Score** | **string** | CVEs with CVSSv3 score greater than or equal to this value |
**page** | **float32** | CVEs for page number |
**perPage** | **float32** | Number of CVEs to return per page |
**createdDaysAgo** | **float32** | Index of CVEs definitions created days ago |
### Return type
[**[]CVE**](CVE.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)

View File

@ -1,32 +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.
//go:generate openapi-gen . -g go -i ./Red-Hat-Security-Data-API.yaml --additional-properties=packageName=rhsecurity,generateInterfaces=true
package rhsecurity

View File

@ -1,469 +0,0 @@
/*
* Red Hat Security Data API
*
* Unofficial OpenAPI definitions for Red Hat Security Data API
*
* API version: 1.0
* Contact: mustafa@ctrliq.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package rhsecurity
import (
"encoding/json"
)
// CVE CVE model used in listing
type CVE struct {
CVE string `json:"CVE"`
Severity string `json:"severity"`
PublicDate string `json:"public_date"`
Advisories []string `json:"advisories"`
Bugzilla string `json:"bugzilla"`
BugzillaDescription string `json:"bugzilla_description"`
CvssScore *float32 `json:"cvss_score,omitempty"`
CvssScoringVector *string `json:"cvss_scoring_vector,omitempty"`
CWE string `json:"CWE"`
AffectedPackages []string `json:"affected_packages"`
ResourceUrl string `json:"resource_url"`
Cvss3ScoringVector string `json:"cvss3_scoring_vector"`
Cvss3Score string `json:"cvss3_score"`
}
// NewCVE instantiates a new CVE object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewCVE(cVE string, severity string, publicDate string, advisories []string, bugzilla string, bugzillaDescription string, cWE string, affectedPackages []string, resourceUrl string, cvss3ScoringVector string, cvss3Score string) *CVE {
this := CVE{}
this.CVE = cVE
this.Severity = severity
this.PublicDate = publicDate
this.Advisories = advisories
this.Bugzilla = bugzilla
this.BugzillaDescription = bugzillaDescription
this.CWE = cWE
this.AffectedPackages = affectedPackages
this.ResourceUrl = resourceUrl
this.Cvss3ScoringVector = cvss3ScoringVector
this.Cvss3Score = cvss3Score
return &this
}
// NewCVEWithDefaults instantiates a new CVE object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewCVEWithDefaults() *CVE {
this := CVE{}
return &this
}
// GetCVE returns the CVE field value
func (o *CVE) GetCVE() string {
if o == nil {
var ret string
return ret
}
return o.CVE
}
// GetCVEOk returns a tuple with the CVE field value
// and a boolean to check if the value has been set.
func (o *CVE) GetCVEOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.CVE, true
}
// SetCVE sets field value
func (o *CVE) SetCVE(v string) {
o.CVE = v
}
// GetSeverity returns the Severity field value
func (o *CVE) GetSeverity() string {
if o == nil {
var ret string
return ret
}
return o.Severity
}
// GetSeverityOk returns a tuple with the Severity field value
// and a boolean to check if the value has been set.
func (o *CVE) GetSeverityOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Severity, true
}
// SetSeverity sets field value
func (o *CVE) SetSeverity(v string) {
o.Severity = v
}
// GetPublicDate returns the PublicDate field value
func (o *CVE) GetPublicDate() string {
if o == nil {
var ret string
return ret
}
return o.PublicDate
}
// GetPublicDateOk returns a tuple with the PublicDate field value
// and a boolean to check if the value has been set.
func (o *CVE) GetPublicDateOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.PublicDate, true
}
// SetPublicDate sets field value
func (o *CVE) SetPublicDate(v string) {
o.PublicDate = v
}
// GetAdvisories returns the Advisories field value
func (o *CVE) GetAdvisories() []string {
if o == nil {
var ret []string
return ret
}
return o.Advisories
}
// GetAdvisoriesOk returns a tuple with the Advisories field value
// and a boolean to check if the value has been set.
func (o *CVE) GetAdvisoriesOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return &o.Advisories, true
}
// SetAdvisories sets field value
func (o *CVE) SetAdvisories(v []string) {
o.Advisories = v
}
// GetBugzilla returns the Bugzilla field value
func (o *CVE) GetBugzilla() string {
if o == nil {
var ret string
return ret
}
return o.Bugzilla
}
// GetBugzillaOk returns a tuple with the Bugzilla field value
// and a boolean to check if the value has been set.
func (o *CVE) GetBugzillaOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Bugzilla, true
}
// SetBugzilla sets field value
func (o *CVE) SetBugzilla(v string) {
o.Bugzilla = v
}
// GetBugzillaDescription returns the BugzillaDescription field value
func (o *CVE) GetBugzillaDescription() string {
if o == nil {
var ret string
return ret
}
return o.BugzillaDescription
}
// GetBugzillaDescriptionOk returns a tuple with the BugzillaDescription field value
// and a boolean to check if the value has been set.
func (o *CVE) GetBugzillaDescriptionOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.BugzillaDescription, true
}
// SetBugzillaDescription sets field value
func (o *CVE) SetBugzillaDescription(v string) {
o.BugzillaDescription = v
}
// GetCvssScore returns the CvssScore field value if set, zero value otherwise.
func (o *CVE) GetCvssScore() float32 {
if o == nil || o.CvssScore == nil {
var ret float32
return ret
}
return *o.CvssScore
}
// GetCvssScoreOk returns a tuple with the CvssScore field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CVE) GetCvssScoreOk() (*float32, bool) {
if o == nil || o.CvssScore == nil {
return nil, false
}
return o.CvssScore, true
}
// HasCvssScore returns a boolean if a field has been set.
func (o *CVE) HasCvssScore() bool {
if o != nil && o.CvssScore != nil {
return true
}
return false
}
// SetCvssScore gets a reference to the given float32 and assigns it to the CvssScore field.
func (o *CVE) SetCvssScore(v float32) {
o.CvssScore = &v
}
// GetCvssScoringVector returns the CvssScoringVector field value if set, zero value otherwise.
func (o *CVE) GetCvssScoringVector() string {
if o == nil || o.CvssScoringVector == nil {
var ret string
return ret
}
return *o.CvssScoringVector
}
// GetCvssScoringVectorOk returns a tuple with the CvssScoringVector field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CVE) GetCvssScoringVectorOk() (*string, bool) {
if o == nil || o.CvssScoringVector == nil {
return nil, false
}
return o.CvssScoringVector, true
}
// HasCvssScoringVector returns a boolean if a field has been set.
func (o *CVE) HasCvssScoringVector() bool {
if o != nil && o.CvssScoringVector != nil {
return true
}
return false
}
// SetCvssScoringVector gets a reference to the given string and assigns it to the CvssScoringVector field.
func (o *CVE) SetCvssScoringVector(v string) {
o.CvssScoringVector = &v
}
// GetCWE returns the CWE field value
func (o *CVE) GetCWE() string {
if o == nil {
var ret string
return ret
}
return o.CWE
}
// GetCWEOk returns a tuple with the CWE field value
// and a boolean to check if the value has been set.
func (o *CVE) GetCWEOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.CWE, true
}
// SetCWE sets field value
func (o *CVE) SetCWE(v string) {
o.CWE = v
}
// GetAffectedPackages returns the AffectedPackages field value
func (o *CVE) GetAffectedPackages() []string {
if o == nil {
var ret []string
return ret
}
return o.AffectedPackages
}
// GetAffectedPackagesOk returns a tuple with the AffectedPackages field value
// and a boolean to check if the value has been set.
func (o *CVE) GetAffectedPackagesOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return &o.AffectedPackages, true
}
// SetAffectedPackages sets field value
func (o *CVE) SetAffectedPackages(v []string) {
o.AffectedPackages = v
}
// GetResourceUrl returns the ResourceUrl field value
func (o *CVE) GetResourceUrl() string {
if o == nil {
var ret string
return ret
}
return o.ResourceUrl
}
// GetResourceUrlOk returns a tuple with the ResourceUrl field value
// and a boolean to check if the value has been set.
func (o *CVE) GetResourceUrlOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ResourceUrl, true
}
// SetResourceUrl sets field value
func (o *CVE) SetResourceUrl(v string) {
o.ResourceUrl = v
}
// GetCvss3ScoringVector returns the Cvss3ScoringVector field value
func (o *CVE) GetCvss3ScoringVector() string {
if o == nil {
var ret string
return ret
}
return o.Cvss3ScoringVector
}
// GetCvss3ScoringVectorOk returns a tuple with the Cvss3ScoringVector field value
// and a boolean to check if the value has been set.
func (o *CVE) GetCvss3ScoringVectorOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Cvss3ScoringVector, true
}
// SetCvss3ScoringVector sets field value
func (o *CVE) SetCvss3ScoringVector(v string) {
o.Cvss3ScoringVector = v
}
// GetCvss3Score returns the Cvss3Score field value
func (o *CVE) GetCvss3Score() string {
if o == nil {
var ret string
return ret
}
return o.Cvss3Score
}
// GetCvss3ScoreOk returns a tuple with the Cvss3Score field value
// and a boolean to check if the value has been set.
func (o *CVE) GetCvss3ScoreOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Cvss3Score, true
}
// SetCvss3Score sets field value
func (o *CVE) SetCvss3Score(v string) {
o.Cvss3Score = v
}
func (o CVE) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["CVE"] = o.CVE
}
if true {
toSerialize["severity"] = o.Severity
}
if true {
toSerialize["public_date"] = o.PublicDate
}
if true {
toSerialize["advisories"] = o.Advisories
}
if true {
toSerialize["bugzilla"] = o.Bugzilla
}
if true {
toSerialize["bugzilla_description"] = o.BugzillaDescription
}
if o.CvssScore != nil {
toSerialize["cvss_score"] = o.CvssScore
}
if o.CvssScoringVector != nil {
toSerialize["cvss_scoring_vector"] = o.CvssScoringVector
}
if true {
toSerialize["CWE"] = o.CWE
}
if true {
toSerialize["affected_packages"] = o.AffectedPackages
}
if true {
toSerialize["resource_url"] = o.ResourceUrl
}
if true {
toSerialize["cvss3_scoring_vector"] = o.Cvss3ScoringVector
}
if true {
toSerialize["cvss3_score"] = o.Cvss3Score
}
return json.Marshal(toSerialize)
}
type NullableCVE struct {
value *CVE
isSet bool
}
func (v NullableCVE) Get() *CVE {
return v.value
}
func (v *NullableCVE) Set(val *CVE) {
v.value = val
v.isSet = true
}
func (v NullableCVE) IsSet() bool {
return v.isSet
}
func (v *NullableCVE) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCVE(val *CVE) *NullableCVE {
return &NullableCVE{value: val, isSet: true}
}
func (v NullableCVE) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCVE) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -1,411 +0,0 @@
/*
* Red Hat Security Data API
*
* Unofficial OpenAPI definitions for Red Hat Security Data API
*
* API version: 1.0
* Contact: mustafa@ctrliq.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package rhsecurity
import (
"encoding/json"
)
// CVEDetailed CVE model used when retrieving a specific CVE
type CVEDetailed struct {
ThreatSeverity string `json:"threat_severity"`
PublicDate string `json:"public_date"`
Bugzilla CVEDetailedBugzilla `json:"bugzilla"`
Cvss3 CVEDetailedCvss3 `json:"cvss3"`
Cwe string `json:"cwe"`
Details []string `json:"details"`
Acknowledgement string `json:"acknowledgement"`
AffectedRelease *[]CVEDetailedAffectedRelease `json:"affected_release,omitempty"`
Name string `json:"name"`
Csaw bool `json:"csaw"`
PackageState *[]CVEDetailedPackageState `json:"package_state,omitempty"`
}
// NewCVEDetailed instantiates a new CVEDetailed object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewCVEDetailed(threatSeverity string, publicDate string, bugzilla CVEDetailedBugzilla, cvss3 CVEDetailedCvss3, cwe string, details []string, acknowledgement string, name string, csaw bool) *CVEDetailed {
this := CVEDetailed{}
this.ThreatSeverity = threatSeverity
this.PublicDate = publicDate
this.Bugzilla = bugzilla
this.Cvss3 = cvss3
this.Cwe = cwe
this.Details = details
this.Acknowledgement = acknowledgement
this.Name = name
this.Csaw = csaw
return &this
}
// NewCVEDetailedWithDefaults instantiates a new CVEDetailed object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewCVEDetailedWithDefaults() *CVEDetailed {
this := CVEDetailed{}
return &this
}
// GetThreatSeverity returns the ThreatSeverity field value
func (o *CVEDetailed) GetThreatSeverity() string {
if o == nil {
var ret string
return ret
}
return o.ThreatSeverity
}
// GetThreatSeverityOk returns a tuple with the ThreatSeverity field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetThreatSeverityOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ThreatSeverity, true
}
// SetThreatSeverity sets field value
func (o *CVEDetailed) SetThreatSeverity(v string) {
o.ThreatSeverity = v
}
// GetPublicDate returns the PublicDate field value
func (o *CVEDetailed) GetPublicDate() string {
if o == nil {
var ret string
return ret
}
return o.PublicDate
}
// GetPublicDateOk returns a tuple with the PublicDate field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetPublicDateOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.PublicDate, true
}
// SetPublicDate sets field value
func (o *CVEDetailed) SetPublicDate(v string) {
o.PublicDate = v
}
// GetBugzilla returns the Bugzilla field value
func (o *CVEDetailed) GetBugzilla() CVEDetailedBugzilla {
if o == nil {
var ret CVEDetailedBugzilla
return ret
}
return o.Bugzilla
}
// GetBugzillaOk returns a tuple with the Bugzilla field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetBugzillaOk() (*CVEDetailedBugzilla, bool) {
if o == nil {
return nil, false
}
return &o.Bugzilla, true
}
// SetBugzilla sets field value
func (o *CVEDetailed) SetBugzilla(v CVEDetailedBugzilla) {
o.Bugzilla = v
}
// GetCvss3 returns the Cvss3 field value
func (o *CVEDetailed) GetCvss3() CVEDetailedCvss3 {
if o == nil {
var ret CVEDetailedCvss3
return ret
}
return o.Cvss3
}
// GetCvss3Ok returns a tuple with the Cvss3 field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetCvss3Ok() (*CVEDetailedCvss3, bool) {
if o == nil {
return nil, false
}
return &o.Cvss3, true
}
// SetCvss3 sets field value
func (o *CVEDetailed) SetCvss3(v CVEDetailedCvss3) {
o.Cvss3 = v
}
// GetCwe returns the Cwe field value
func (o *CVEDetailed) GetCwe() string {
if o == nil {
var ret string
return ret
}
return o.Cwe
}
// GetCweOk returns a tuple with the Cwe field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetCweOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Cwe, true
}
// SetCwe sets field value
func (o *CVEDetailed) SetCwe(v string) {
o.Cwe = v
}
// GetDetails returns the Details field value
func (o *CVEDetailed) GetDetails() []string {
if o == nil {
var ret []string
return ret
}
return o.Details
}
// GetDetailsOk returns a tuple with the Details field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetDetailsOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return &o.Details, true
}
// SetDetails sets field value
func (o *CVEDetailed) SetDetails(v []string) {
o.Details = v
}
// GetAcknowledgement returns the Acknowledgement field value
func (o *CVEDetailed) GetAcknowledgement() string {
if o == nil {
var ret string
return ret
}
return o.Acknowledgement
}
// GetAcknowledgementOk returns a tuple with the Acknowledgement field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetAcknowledgementOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Acknowledgement, true
}
// SetAcknowledgement sets field value
func (o *CVEDetailed) SetAcknowledgement(v string) {
o.Acknowledgement = v
}
// GetAffectedRelease returns the AffectedRelease field value if set, zero value otherwise.
func (o *CVEDetailed) GetAffectedRelease() []CVEDetailedAffectedRelease {
if o == nil || o.AffectedRelease == nil {
var ret []CVEDetailedAffectedRelease
return ret
}
return *o.AffectedRelease
}
// GetAffectedReleaseOk returns a tuple with the AffectedRelease field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetAffectedReleaseOk() (*[]CVEDetailedAffectedRelease, bool) {
if o == nil || o.AffectedRelease == nil {
return nil, false
}
return o.AffectedRelease, true
}
// HasAffectedRelease returns a boolean if a field has been set.
func (o *CVEDetailed) HasAffectedRelease() bool {
if o != nil && o.AffectedRelease != nil {
return true
}
return false
}
// SetAffectedRelease gets a reference to the given []CVEDetailedAffectedRelease and assigns it to the AffectedRelease field.
func (o *CVEDetailed) SetAffectedRelease(v []CVEDetailedAffectedRelease) {
o.AffectedRelease = &v
}
// GetName returns the Name field value
func (o *CVEDetailed) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *CVEDetailed) SetName(v string) {
o.Name = v
}
// GetCsaw returns the Csaw field value
func (o *CVEDetailed) GetCsaw() bool {
if o == nil {
var ret bool
return ret
}
return o.Csaw
}
// GetCsawOk returns a tuple with the Csaw field value
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetCsawOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.Csaw, true
}
// SetCsaw sets field value
func (o *CVEDetailed) SetCsaw(v bool) {
o.Csaw = v
}
// GetPackageState returns the PackageState field value if set, zero value otherwise.
func (o *CVEDetailed) GetPackageState() []CVEDetailedPackageState {
if o == nil || o.PackageState == nil {
var ret []CVEDetailedPackageState
return ret
}
return *o.PackageState
}
// GetPackageStateOk returns a tuple with the PackageState field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CVEDetailed) GetPackageStateOk() (*[]CVEDetailedPackageState, bool) {
if o == nil || o.PackageState == nil {
return nil, false
}
return o.PackageState, true
}
// HasPackageState returns a boolean if a field has been set.
func (o *CVEDetailed) HasPackageState() bool {
if o != nil && o.PackageState != nil {
return true
}
return false
}
// SetPackageState gets a reference to the given []CVEDetailedPackageState and assigns it to the PackageState field.
func (o *CVEDetailed) SetPackageState(v []CVEDetailedPackageState) {
o.PackageState = &v
}
func (o CVEDetailed) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["threat_severity"] = o.ThreatSeverity
}
if true {
toSerialize["public_date"] = o.PublicDate
}
if true {
toSerialize["bugzilla"] = o.Bugzilla
}
if true {
toSerialize["cvss3"] = o.Cvss3
}
if true {
toSerialize["cwe"] = o.Cwe
}
if true {
toSerialize["details"] = o.Details
}
if true {
toSerialize["acknowledgement"] = o.Acknowledgement
}
if o.AffectedRelease != nil {
toSerialize["affected_release"] = o.AffectedRelease
}
if true {
toSerialize["name"] = o.Name
}
if true {
toSerialize["csaw"] = o.Csaw
}
if o.PackageState != nil {
toSerialize["package_state"] = o.PackageState
}
return json.Marshal(toSerialize)
}
type NullableCVEDetailed struct {
value *CVEDetailed
isSet bool
}
func (v NullableCVEDetailed) Get() *CVEDetailed {
return v.value
}
func (v *NullableCVEDetailed) Set(val *CVEDetailed) {
v.value = val
v.isSet = true
}
func (v NullableCVEDetailed) IsSet() bool {
return v.isSet
}
func (v *NullableCVEDetailed) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCVEDetailed(val *CVEDetailed) *NullableCVEDetailed {
return &NullableCVEDetailed{value: val, isSet: true}
}
func (v NullableCVEDetailed) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCVEDetailed) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -1,230 +0,0 @@
/*
* Red Hat Security Data API
*
* Unofficial OpenAPI definitions for Red Hat Security Data API
*
* API version: 1.0
* Contact: mustafa@ctrliq.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package rhsecurity
import (
"encoding/json"
)
// CVEDetailedAffectedRelease struct for CVEDetailedAffectedRelease
type CVEDetailedAffectedRelease struct {
ProductName string `json:"product_name"`
ReleaseDate string `json:"release_date"`
Advisory string `json:"advisory"`
Cpe string `json:"cpe"`
Package *string `json:"package,omitempty"`
}
// NewCVEDetailedAffectedRelease instantiates a new CVEDetailedAffectedRelease object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewCVEDetailedAffectedRelease(productName string, releaseDate string, advisory string, cpe string) *CVEDetailedAffectedRelease {
this := CVEDetailedAffectedRelease{}
this.ProductName = productName
this.ReleaseDate = releaseDate
this.Advisory = advisory
this.Cpe = cpe
return &this
}
// NewCVEDetailedAffectedReleaseWithDefaults instantiates a new CVEDetailedAffectedRelease object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewCVEDetailedAffectedReleaseWithDefaults() *CVEDetailedAffectedRelease {
this := CVEDetailedAffectedRelease{}
return &this
}
// GetProductName returns the ProductName field value
func (o *CVEDetailedAffectedRelease) GetProductName() string {
if o == nil {
var ret string
return ret
}
return o.ProductName
}
// GetProductNameOk returns a tuple with the ProductName field value
// and a boolean to check if the value has been set.
func (o *CVEDetailedAffectedRelease) GetProductNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ProductName, true
}
// SetProductName sets field value
func (o *CVEDetailedAffectedRelease) SetProductName(v string) {
o.ProductName = v
}
// GetReleaseDate returns the ReleaseDate field value
func (o *CVEDetailedAffectedRelease) GetReleaseDate() string {
if o == nil {
var ret string
return ret
}
return o.ReleaseDate
}
// GetReleaseDateOk returns a tuple with the ReleaseDate field value
// and a boolean to check if the value has been set.
func (o *CVEDetailedAffectedRelease) GetReleaseDateOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ReleaseDate, true
}
// SetReleaseDate sets field value
func (o *CVEDetailedAffectedRelease) SetReleaseDate(v string) {
o.ReleaseDate = v
}
// GetAdvisory returns the Advisory field value
func (o *CVEDetailedAffectedRelease) GetAdvisory() string {
if o == nil {
var ret string
return ret
}
return o.Advisory
}
// GetAdvisoryOk returns a tuple with the Advisory field value
// and a boolean to check if the value has been set.
func (o *CVEDetailedAffectedRelease) GetAdvisoryOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Advisory, true
}
// SetAdvisory sets field value
func (o *CVEDetailedAffectedRelease) SetAdvisory(v string) {
o.Advisory = v
}
// GetCpe returns the Cpe field value
func (o *CVEDetailedAffectedRelease) GetCpe() string {
if o == nil {
var ret string
return ret
}
return o.Cpe
}
// GetCpeOk returns a tuple with the Cpe field value
// and a boolean to check if the value has been set.
func (o *CVEDetailedAffectedRelease) GetCpeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Cpe, true
}
// SetCpe sets field value
func (o *CVEDetailedAffectedRelease) SetCpe(v string) {
o.Cpe = v
}
// GetPackage returns the Package field value if set, zero value otherwise.
func (o *CVEDetailedAffectedRelease) GetPackage() string {
if o == nil || o.Package == nil {
var ret string
return ret
}
return *o.Package
}
// GetPackageOk returns a tuple with the Package field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CVEDetailedAffectedRelease) GetPackageOk() (*string, bool) {
if o == nil || o.Package == nil {
return nil, false
}
return o.Package, true
}
// HasPackage returns a boolean if a field has been set.
func (o *CVEDetailedAffectedRelease) HasPackage() bool {
if o != nil && o.Package != nil {
return true
}
return false
}
// SetPackage gets a reference to the given string and assigns it to the Package field.
func (o *CVEDetailedAffectedRelease) SetPackage(v string) {
o.Package = &v
}
func (o CVEDetailedAffectedRelease) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["product_name"] = o.ProductName
}
if true {
toSerialize["release_date"] = o.ReleaseDate
}
if true {
toSerialize["advisory"] = o.Advisory
}
if true {
toSerialize["cpe"] = o.Cpe
}
if o.Package != nil {
toSerialize["package"] = o.Package
}
return json.Marshal(toSerialize)
}
type NullableCVEDetailedAffectedRelease struct {
value *CVEDetailedAffectedRelease
isSet bool
}
func (v NullableCVEDetailedAffectedRelease) Get() *CVEDetailedAffectedRelease {
return v.value
}
func (v *NullableCVEDetailedAffectedRelease) Set(val *CVEDetailedAffectedRelease) {
v.value = val
v.isSet = true
}
func (v NullableCVEDetailedAffectedRelease) IsSet() bool {
return v.isSet
}
func (v *NullableCVEDetailedAffectedRelease) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCVEDetailedAffectedRelease(val *CVEDetailedAffectedRelease) *NullableCVEDetailedAffectedRelease {
return &NullableCVEDetailedAffectedRelease{value: val, isSet: true}
}
func (v NullableCVEDetailedAffectedRelease) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCVEDetailedAffectedRelease) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

Some files were not shown because too many files have changed in this diff Show More