Skip to main content

Greenbone Logo

greenbone-scap-api

GitHub releases PyPI release

A REST API on top of greenbone-scap based on FastAPI to mirror the NIST NVD CVE API.

It provides a very similar CVE API compared to NVD NIST at https://services.nvd.nist.gov/rest/json/cves/2.0.

Table of Contents

Requirements

Python 3.11 and later is supported.

Install using pipx

You can install the latest stable release of greenbone-scap-api from the Python Package Index (pypi) using pipx

python3 -m pipx install greenbone-scap-api

Install using pip

[!NOTE] The pip install command does no longer work out-of-the-box in newer distributions like Ubuntu 23.04 because of PEP 668. Please use the installation via pipx instead.

You can install the latest stable release of greenbone-scap-api from the Python Package Index (pypi) using pip

python3 -m pip install --user greenbone-scap-api

Usage

A simple web server to serve the API can be started by running greenbone-scap-api. The settings of the web server can be controlled via environment variables.

Internally the greenbone-scap-api script uses uvicorn

It's also possible to serve the API with uvicorn directly

uvicorn greenbone.scap.api.app:app --reload

Using uvicorn directly allows for more flexibility regarding the settings for serving the API.

After starting the web server the CVE API is available at http://127.0.0.1:8000/cves (by default). Interactive API docs are served at http://127.0.0.1:8000/docs.

Settings

greenbone-scap-api can be configured via the following environment variables

Name Description Default
DATABASE_USER Username for the connection to the PostgreSQL database. scap
DATABASE_PASSWORD Username for the connection to the PostgreSQL database.
DATABASE_NAME Name of the PostgreSQL database. scap
DATABASE_HOST Host where the PostgreSQL database is running. IP or DNS name. 127.0.0.1
DATABASE_PORT Port on which the PostgreSQL database is listening. 5432
ECHO_SQL Log SQL statements. true or 1 to enable. disabled
API_HOST IP address or DNS name to listen on 127.0.0.1
API_PORT Port to listen on 8000
LOG_LEVEL Log level for server output. Options are critical, error, warning, info, debug and trace. info

Docker Compose

The API is easiest to use via the provided docker compose file. The compose file extends the compose file of greenbone-scap. Please take a look at the README of greenbone-scap for the initial setup of the containers.

For a quick setup the following commands can be used:

cd docker
echo "DATABASE_PASSWORD=my-super-safe-password" > .env
docker compose up

After starting the containers the CVE API is available at http://127.0.0.1:8000/cves (by default). Interactive API docs are served at http://127.0.0.1:8000/docs.

[!NOTE] On the initial startup all CVE will be downloaded from the NIST NVD CVE API Downloading the data may take several hours and due to unreliable servers at NIST may even fail. After a successful full download of the data at NIST, only the changed and new CVEs will be downloaded. To trigger a download docker compose up cve can be used.

Development

greenbone-scap-api uses poetry for its own dependency management and build process.

First install poetry via pipx

python3 -m pipx install poetry

Afterwards run

poetry install

in the checkout directory of greenbone-scap-api (the directory containing the pyproject.toml file) to install all dependencies including the packages only required for development.

Afterwards activate the git hooks for auto-formatting and linting via autohooks.

poetry run autohooks activate

Validate the activated git hooks by running

poetry run autohooks check

Maintainer

This project is maintained by Greenbone AG

License

Copyright (C) 2024 Greenbone AG

Licensed under the GNU Affero General Public License v3.0 or later.

Release files for greenbone-scap-api 25.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greenbone-scap-api 25.3.1
File Size Uploaded
greenbone_scap_api-25.3.1.tar.gz 23.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for greenbone-scap-api 25.3.1
File Interpreter ABI Platform
greenbone_scap_api-25.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 48.5 kB

Release files / greenbone_scap_api-25.3.1.tar.gz

Download URL greenbone_scap_api-25.3.1.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9e756552ab88203ffc67b0719efc4b31172d8c445e0d41be8f62d5c7ad40792e
BLAKE2b-256 checksum
How to use checksums
79bf3811b2394913ca300379aafc96f395bdb5163e6b57825be20add6ab33407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.

Transparency log

Release files / greenbone_scap_api-25.3.1-py3-none-any.whl

Download URL greenbone_scap_api-25.3.1-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de183f94d93a4c00221ef17b25ec6ce17e95780d11ca6f3967dd111766da5bff
BLAKE2b-256 checksum
How to use checksums
6da78428d83fb944f1cd736708663842326f0ca0dde07d1e79220b6aa291442e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

25.3.1 This release

2 release files

25.3.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page