mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-23 00:32:55 +01:00
* Add an OpenPGP test keypair. * Move script parts of documentation into script, so they can be used on a fresh Ubuntu 20.04 system for within a github action to setup a csaf_provider and upload documents to it for an integration test. * Use dineshsonachalam/markdown-autodocs in github action to automatically insert lines from the scripts into the docs. Co-authored-by: Bernhard Reiter <bernhard@intevation.de>
32 lines
1.1 KiB
Bash
Executable file
32 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Desc: Tries getting csaf 2.0 examples from api.github. Do not run too often!
|
|
#
|
|
# This file is Free Software under the MIT License
|
|
# without warranty, see README.md and LICENSES/MIT.txt for details.
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# SPDX-FileCopyrightText: 2022 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
|
|
# Software-Engineering: 2022 Intevation GmbH <https://intevation.de>
|
|
|
|
set -e
|
|
|
|
# using an extended regular expression to whitelist only CSAF 2.0 filenames
|
|
# with a sane path
|
|
|
|
CSAFPATHregexp='^ *"path": "(csaf_2.0/examples/csaf/[a-z0-9+-_]+.json)",'
|
|
|
|
curl --silent --show-error -H 'Accept: application/vnd.github.v3.raw' \
|
|
https://api.github.com/repos/oasis-tcs/csaf/contents/csaf_2.0/examples/csaf \
|
|
| grep -E "$CSAFPATHregexp" \
|
|
| sed -E -e "s;${CSAFPATHregexp};\1;" \
|
|
> csaf_examples_pathnames.txt
|
|
|
|
mkdir csaf_examples
|
|
cd csaf_examples
|
|
|
|
cat ../csaf_examples_pathnames.txt | \
|
|
xargs -I {} \
|
|
curl --silent --show-error -H 'Accept: application/vnd.github.v3.raw' \
|
|
https://api.github.com/repos/oasis-tcs/csaf/contents/{} -O
|