Skip to content

Commit

Permalink
Merge branch 'main' into sha-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
koplas committed Nov 27, 2024
2 parents ffb4eff + 678f232 commit a5f4b10
Show file tree
Hide file tree
Showing 67 changed files with 236 additions and 215 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/itest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.0
go-version: 1.22.0

- name: Set up Node.js
uses: actions/setup-node@v3
Expand All @@ -25,7 +25,7 @@ jobs:
sudo apt install -y make nginx fcgiwrap gnutls-bin
cp -r $GITHUB_WORKSPACE ~
cd ~
cd csaf_distribution/docs/scripts/
cd csaf/docs/scripts/
# keep in sync with docs/scripts/Readme.md
export FOLDERNAME=devca1 ORGANAME="CSAF Tools Development (internal)"
source ./TLSConfigsForITest.sh
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
releases-matrix:
name: Release Go binaries
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -24,5 +26,5 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
dist/csaf_distribution-*.zip
dist/csaf_distribution-*.tar.gz
dist/csaf-*.zip
dist/csaf-*.tar.gz
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SPDX-FileCopyrightText: 2021 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
# Software-Engineering: 2021 Intevation GmbH <https://intevation.de>
#
# Makefile to build csaf_distribution components
# Makefile to build csaf components

SHELL = /bin/bash
BUILD = go build
Expand Down Expand Up @@ -41,7 +41,7 @@ tag_checked_out:
# into a semver version. For this we increase the PATCH number, so that
# any commit after a tag is considered newer than the semver from the tag
# without an optional 'v'
# Note we need `--tags` because github release only creates lightweight tags
# Note we need `--tags` because github releases only create lightweight tags
# (see feature request https://github.com/github/feedback/discussions/4924).
# We use `--always` in case of being run as github action with shallow clone.
# In this case we might in some situations see an error like
Expand All @@ -50,16 +50,16 @@ tag_checked_out:
GITDESC := $(shell git describe --tags --always)
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/')
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
# Hint: The regexp in the next line only matches if there is a hyphen (`-`)
# followed by a number, by which we assume that git describe
# has added a string after the tag
SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/v?([0-9]+\.[0-9]+\.)([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH)\3/' )
# Hint: The second regexp in the next line only matches
# if there is a hyphen (`-`) followed by a number,
# by which we assume that git describe has added a string after the tag
SEMVER := $(shell echo '$(GITDESC)' | sed -E -e 's/^v//' -e 's/([0-9]+\.[0-9]+\.)([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH)\3/' )
testsemver:
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\'


# Set -ldflags parameter to pass the semversion.
LDFLAGS = -ldflags "-X github.com/csaf-poc/csaf_distribution/v3/util.SemVersion=$(SEMVER)"
LDFLAGS = -ldflags "-X github.com/gocsaf/csaf/v3/util.SemVersion=$(SEMVER)"

# Build binaries and place them under bin-$(GOOS)-$(GOARCH)
# Using 'Target-specific Variable Values' to specify the build target system
Expand All @@ -78,7 +78,7 @@ build_linux build_win build_mac_amd64 build_mac_arm64:
env GOARCH=$(GOARCH) GOOS=$(GOOS) $(BUILD) -o $(BINDIR) $(LDFLAGS) -v ./cmd/...


DISTDIR := csaf_distribution-$(SEMVER)
DISTDIR := csaf-$(SEMVER)
dist: build_linux build_win build_mac_amd64 build_mac_arm64
mkdir -p dist
mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64
Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
Software-Engineering: 2024 Intevation GmbH <https://intevation.de>
-->

# csaf_distribution

> [!IMPORTANT]
> To avoid future breakage, if you still use `csaf-poc`:
> 1. Adjust your HTML links.
> 2. Adjust your go module paths, see [#579](https://github.com/gocsaf/csaf/issues/579#issuecomment-2497244379).
>
> (This repository was moved here on 2024-10-28. The old one is deprecated
> and redirection will be switched off a few months later.)

# csaf

Implements a [CSAF](https://csaf.io/)
([specification v2.0](https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html)
Expand Down Expand Up @@ -42,10 +52,10 @@ is a CSAF Aggregator, to list or mirror providers.
## Other stuff

### [examples](./examples/README.md)
are small examples of how to use `github.com/csaf-poc/csaf_distribution`
are small examples of how to use `github.com/gocsaf/csaf`
as an API. Currently this is a work in progress, as usage of this repository
as a library to access is _not officially supported_, e.g.
see https://github.com/csaf-poc/csaf_distribution/issues/367 .
see https://github.com/gocsaf/csaf/issues/367 .

## Setup
Binaries for the server side are only available and tested
Expand All @@ -69,9 +79,9 @@ Download the binaries from the most recent release assets on Github.

### Build from sources

- A recent version of **Go** (1.21+) should be installed. [Go installation](https://go.dev/doc/install)
- A recent version of **Go** (1.22+) should be installed. [Go installation](https://go.dev/doc/install)

- Clone the repository `git clone https://github.com/csaf-poc/csaf_distribution.git `
- Clone the repository `git clone https://github.com/gocsaf/csaf.git `

- Build Go components Makefile supplies the following targets:
- Build for GNU/Linux system: `make build_linux`
Expand Down Expand Up @@ -100,7 +110,7 @@ For further details of the development process consult our [development page](./

## License

- `csaf_distribution` is licensed as Free Software under the terms of the [Apache License, Version 2.0](./LICENSES/Apache-2.0.txt).
- `csaf` is licensed as Free Software under the terms of the [Apache License, Version 2.0](./LICENSES/Apache-2.0.txt).

- See the specific source files
for details, the license itself can be found in the directory `LICENSES/`.
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_aggregator/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"io"
"net/http"

"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/util"
)

var errNotFound = errors.New("not found")
Expand Down
17 changes: 11 additions & 6 deletions cmd/csaf_aggregator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
"time"

"github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/internal/certs"
"github.com/csaf-poc/csaf_distribution/v3/internal/filter"
"github.com/csaf-poc/csaf_distribution/v3/internal/models"
"github.com/csaf-poc/csaf_distribution/v3/internal/options"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/internal/certs"
"github.com/gocsaf/csaf/v3/internal/filter"
"github.com/gocsaf/csaf/v3/internal/models"
"github.com/gocsaf/csaf/v3/internal/options"
"github.com/gocsaf/csaf/v3/util"
"golang.org/x/time/rate"
)

Expand Down Expand Up @@ -301,6 +301,11 @@ func (c *config) httpClient(p *provider) util.Client {
Client: client,
Header: c.ExtraHeader,
}
default:
client = &util.HeaderClient{
Client: client,
Header: http.Header{},
}
}

if c.Verbose {
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_aggregator/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"sync"
"time"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

type fullJob struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_aggregator/indices.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"strings"
"time"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_aggregator/interim.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"sync"
"time"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

type interimJob struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_aggregator/lazytransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"os"
"path/filepath"

"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/util"
)

type lazyTransaction struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_aggregator/lister.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ package main
import (
"fmt"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

// mirrorAllowed checks if mirroring is allowed.
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_aggregator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"os"
"path/filepath"

"github.com/csaf-poc/csaf_distribution/v3/internal/options"
"github.com/gocsaf/csaf/v3/internal/options"

"github.com/gofrs/flock"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_aggregator/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
"github.com/ProtonMail/gopenpgp/v2/constants"
"github.com/ProtonMail/gopenpgp/v2/crypto"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

// mirrorAllowed checks if mirroring is allowed.
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_aggregator/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"os"
"path/filepath"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"

"github.com/ProtonMail/gopenpgp/v2/crypto"
)
Expand Down
8 changes: 4 additions & 4 deletions cmd/csaf_checker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"fmt"
"net/http"

"github.com/csaf-poc/csaf_distribution/v3/internal/certs"
"github.com/csaf-poc/csaf_distribution/v3/internal/filter"
"github.com/csaf-poc/csaf_distribution/v3/internal/models"
"github.com/csaf-poc/csaf_distribution/v3/internal/options"
"github.com/gocsaf/csaf/v3/internal/certs"
"github.com/gocsaf/csaf/v3/internal/filter"
"github.com/gocsaf/csaf/v3/internal/models"
"github.com/gocsaf/csaf/v3/internal/options"
)

type outputFormat string
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_checker/links.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/PuerkitoBio/goquery"

"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/util"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_checker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package main
import (
"log"

"github.com/csaf-poc/csaf_distribution/v3/internal/options"
"github.com/gocsaf/csaf/v3/internal/options"
)

// run uses a processor to check all the given domains or direct urls
Expand Down
20 changes: 9 additions & 11 deletions cmd/csaf_checker/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"github.com/ProtonMail/gopenpgp/v2/crypto"
"golang.org/x/time/rate"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

// topicMessages stores the collected topicMessages for a specific topic.
Expand Down Expand Up @@ -429,11 +429,9 @@ func (p *processor) fullClient() util.Client {
client := util.Client(&hClient)

// Add extra headers.
if len(p.cfg.ExtraHeader) > 0 {
client = &util.HeaderClient{
Client: client,
Header: p.cfg.ExtraHeader,
}
client = &util.HeaderClient{
Client: client,
Header: p.cfg.ExtraHeader,
}

// Add optional URL logging.
Expand Down Expand Up @@ -1443,9 +1441,9 @@ func (p *processor) checkWellknownSecurityDNS(domain string) error {
}

// checkPGPKeys checks if the OpenPGP keys are available and valid, fetches
// the the remotely keys and compares the fingerprints.
// As a result of these a respective error messages are passed to badPGP method
// in case of errors. It returns nil if all checks are passed.
// the remote pubkeys and compares the fingerprints.
// As a result of these checks respective error messages are passed
// to badPGP methods. It returns nil if all checks are passed.
func (p *processor) checkPGPKeys(_ string) error {
p.badPGPs.use()

Expand Down Expand Up @@ -1511,7 +1509,7 @@ func (p *processor) checkPGPKeys(_ string) error {
}

if !strings.EqualFold(ckey.GetFingerprint(), string(key.Fingerprint)) {
p.badPGPs.error("Fingerprint of public OpenPGP key %s does not match remotely loaded.", u)
p.badPGPs.error("Given Fingerprint (%q) of public OpenPGP key %q does not match remotely loaded (%q).", string(key.Fingerprint), u, ckey.GetFingerprint())
continue
}
if p.keys == nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_checker/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"os"
"time"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/internal/models"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/internal/models"
)

// MessageType is the kind of the message.
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_checker/reporters.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sort"
"strings"

"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/util"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions cmd/csaf_checker/roliecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"sort"
"strings"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/csaf-poc/csaf_distribution/v3/util"
"github.com/gocsaf/csaf/v3/csaf"
"github.com/gocsaf/csaf/v3/util"
)

// identifier consist of document/tracking/id and document/publisher/namespace,
Expand Down
2 changes: 1 addition & 1 deletion cmd/csaf_checker/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"fmt"
"sort"

"github.com/csaf-poc/csaf_distribution/v3/csaf"
"github.com/gocsaf/csaf/v3/csaf"
)

type ruleCondition int
Expand Down
8 changes: 4 additions & 4 deletions cmd/csaf_downloader/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"path/filepath"
"time"

"github.com/csaf-poc/csaf_distribution/v3/internal/certs"
"github.com/csaf-poc/csaf_distribution/v3/internal/filter"
"github.com/csaf-poc/csaf_distribution/v3/internal/models"
"github.com/csaf-poc/csaf_distribution/v3/internal/options"
"github.com/gocsaf/csaf/v3/internal/certs"
"github.com/gocsaf/csaf/v3/internal/filter"
"github.com/gocsaf/csaf/v3/internal/models"
"github.com/gocsaf/csaf/v3/internal/options"
)

const (
Expand Down
Loading

0 comments on commit a5f4b10

Please sign in to comment.