Skip to content

Commit a8c4ee9

Browse files
committed
Update VulnerableCode documentation for advisories
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 70f2ecd commit a8c4ee9

7 files changed

Lines changed: 178 additions & 194 deletions

File tree

SOURCES.rst

Lines changed: 113 additions & 53 deletions
Large diffs are not rendered by default.

docs/source/api-admin.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This can be done in the admin and from the command line::
2323
API client configuration
2424
----------------------------
2525

26-
API clients must send a User-Agent header that matches the value of the
26+
API clients must send a `User-Agent` header that matches the value of the
2727
`VCIO_USER_AGENT` setting.
2828

2929
Add the following to your .env file::

docs/source/api.rst

Lines changed: 53 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -21,170 +21,95 @@ your API key, click on the ``Authorize`` button on the top right of the page and
2121
your API key in the ``value`` field with ``Token`` prefix, so if your token is "1234567890abcdef"
2222
then you have to enter this: ``Token 1234567890abcdef``.
2323

24-
.. _Package Vulnerabilities Query:
24+
.. _Vulnerable Packages Query:
2525

26-
Query for Package Vulnerabilities
26+
Query for Vulnerable Packages
2727
------------------------------------
2828

29-
The package endpoint allows you to query vulnerabilities by package using a
29+
The package endpoint allows you to query vulnerable packages using a
3030
purl or purl fields.
3131

3232
Sample python script::
3333

3434
import requests
3535

3636
# Query by purl
37-
resp = requests.get(
38-
"https://public.vulnerablecode.io/api/packages?purl=pkg:maven/log4j/log4j@1.2.27",
39-
headers={"Authorization": "Token 123456789"},
40-
).json()
41-
42-
# Query by purl type, get all the vulnerable maven packages
43-
resp = requests.get(
44-
"https://public.vulnerablecode.io/api/packages?type=maven",
45-
headers={"Authorization": "Token 123456789"},
37+
resp = requests.post(
38+
"https://public.vulnerablecode.io/api/v3/packages/",
39+
headers={"Authorization": "Token 123456789", "User-Agent": "VCIO_API_AGENT"},
40+
json={
41+
"purls": ["pkg:npm/atob@2.0.3?foo=bar"],
42+
"ignore_qualifiers_subpath": True,
43+
"details": True
44+
}
4645
).json()
4746

4847
Sample using curl::
4948

50-
curl -X GET -H 'Authorization: Token <YOUR TOKEN>' https://public.vulnerablecode.io/api/packages?purl=pkg:maven/log4j/log4j@1.2.27
51-
52-
53-
The response will be a list of packages, these are packages
54-
that are affected by and/or that fix a vulnerability.
55-
56-
57-
.. _Package Bulk Search:
58-
59-
Package Bulk Search
60-
---------------------
61-
62-
63-
The package bulk search endpoint allows you to search for purls in bulk. You can
64-
pass a list of purls in the request body and the endpoint will return a list of
65-
purls with vulnerabilities.
66-
67-
68-
You can pass a list of ``purls`` in the request body. Each package should be a
69-
valid purl string.
70-
71-
You can also pass options like ``purl_only`` and ``plain_purl`` in the request.
72-
``purl_only`` will return only a list of vulnerable purls from the purls received in request.
73-
``plain_purl`` allows you to query the API using plain purls by removing qualifiers
74-
and subpath from the purl.
75-
76-
The request body should be a JSON object with the following structure::
77-
78-
{
49+
curl -X POST "https://public.vulnerablecode.io/api/v3/packages/" \
50+
-H "Authorization: Token <YOUR_TOKEN>" \
51+
-H "Content-Type: application/json" \
52+
-H "User-Agent: VCIO_API_AGENT" \
53+
-d '{
7954
"purls": [
80-
"pkg:pypi/flask@1.2.0",
81-
"pkg:npm/express@1.0"
55+
"pkg:pypi/flask@2.3.2"
8256
],
83-
"purl_only": false,
84-
"plain_purl": false,
85-
}
86-
87-
Sample python script::
88-
89-
import requests
90-
91-
request_body = {
92-
"purls": [
93-
"pkg:npm/grunt-radical@0.0.14"
94-
],
95-
}
96-
97-
resp = requests.post('https://public.vulnerablecode.io/api/packages/bulk_search', json= request_body, headers={'Authorization': "Token 123456789"}).json()
98-
57+
"ignore_qualifiers_subpath": true,
58+
"details": true,
59+
"reachability": true
60+
}'
9961

10062
The response will be a list of packages, these are packages
101-
that are affected by and/or that fix a vulnerability.
63+
that are affected by and/or that fix a vulnerability advisory.
10264

10365
API endpoints reference
10466
--------------------------
10567

106-
There are two primary endpoints:
107-
108-
- packages/: this is the main endpoint where you can lookup vulnerabilities by package.
109-
110-
- vulnerabilities/: to lookup by vulnerabilities
111-
112-
And two secondary endpoints, used to query vulnerability aliases (such as CVEs)
113-
and vulnerability by CPEs: cpes/ and aliases/
114-
115-
11668
.. list-table:: Table for the main API endpoints
11769
:widths: 30 40 30
11870
:header-rows: 1
11971

12072
* - Endpoint
12173
- Query Parameters
12274
- Expected Output
123-
* - ``/api/packages``
124-
-
125-
- ``purl`` (string) = package-url of the package
126-
- ``type`` (string) = type of the package
127-
- ``namespace`` (string) = namespace of the package
128-
- ``name`` (string) = name of the package
129-
- ``version`` (string) = version of the package
130-
- ``qualifiers`` (string) = qualifiers of the package
131-
- ``subpath`` (string) = subpath of the package
132-
- ``page`` (integer) = page number of the response
133-
- ``page_size`` (integer) = number of packages in each page
134-
- Return a list of packages using a package-url (purl) or a combination of
135-
type, namespace, name, version, qualifiers, subpath purl fields. See the
136-
`purl specification <https://github.com/package-url/purl-spec>`_ for more details. See example at :ref:`Package Vulnerabilities Query` section for more details.
137-
* - ``/api/packages/bulk_search``
138-
- Refer to package bulk search section :ref:`Package Bulk Search`
139-
- Return a list of packages
140-
* - ``/api/vulnerabilities/``
75+
* - POST ``/api/v3/packages/``
14176
-
142-
- ``vulnerability_id`` (string) = VCID (VulnerableCode Identifier) of the vulnerability
143-
- ``page`` (integer) = page number of the response
144-
- ``page_size`` (integer) = number of vulnerabilities in each page
145-
- Return a list of vulnerabilities
146-
* - ``/api/cpes``
77+
- ``purls`` (array of strings) = List of package URLs ( a package-url (purl) or a combination of
78+
type, namespace, name, version, qualifiers, subpath purl fields. See the
79+
`purl specification <https://github.com/package-url/purl-spec>`_ for more details. )
80+
- ``details`` (boolean) = Display all details about the packages provided
81+
- ``ignore_qualifiers_subpath`` (boolean) = Ignore qualifiers/subpaths
82+
- ``max_advisories`` (integer) = Maximum advisories to return
83+
- ``reachability`` (boolean) = Display details about reachability
84+
(introduced_in_patches and fixed_in_patches)
85+
- Return a list of vulnerable packages
86+
* - POST ``/api/v3/advisories/``
14787
-
148-
- ``cpe`` (string) = value of the cpe
149-
- ``page`` (integer) = page number of the response
150-
- ``page_size`` (integer) = number of cpes in each page
151-
- Return a list of vulnerabilities
152-
* - ``/api/cpes/bulk_search``
153-
- Refer to CPE bulk search section :ref:`CPE Bulk Search`
154-
- Return a list of cpes
155-
* - ``/api/aliases``
88+
- ``purls`` (array of strings) = list of package urls
89+
- Returns a list of advisories related to the provided packages
90+
* - GET ``/api/v3/affected-by-advisories/``
15691
-
157-
- ``alias`` (string) = value of the alias
158-
- ``page`` (integer) = page number of the response
159-
- ``page_size`` (integer) = number of aliases in each page
160-
- Return a list of vulnerabilities
161-
162-
.. list-table:: Table for other API endpoints
163-
:widths: 30 40 30
164-
:header-rows: 1
165-
166-
* - Endpoint
167-
- Query Parameters
168-
- Expected Output
169-
* - ``/api/packages/{id}``
92+
- ``page`` (string) = A page number within the paginated result set.
93+
- ``page_size`` (integer) = Number of results to return per page.
94+
- ``search`` (string) = A search term.
95+
- Returns a paginated list of advisories vulnerabilities that affect given packages.
96+
* - GET ``/api/v3/affected-by-advisories/{id}/``
17097
-
171-
- ``id`` (integer) = internal primary id of the package
172-
- Return a package with the given id
173-
* - ``/api/packages/all``
174-
- No parameter required
175-
- Return a list of all vulnerable packages
176-
* - ``/api/vulnerabilities/{id}``
98+
- ``id`` (string) = A unique integer value identifying this advisory v2.
99+
- Returns a specific advisory that affect a given package.
100+
* - GET ``/api/v3/fixing-advisories/``
177101
-
178-
- ``id`` (integer) = internal primary id of the vulnerability
179-
- Return a vulnerability with the given id
180-
* - ``/api/aliases/{id}``
102+
- ``page`` (integer) = A page number within the paginated result set.
103+
- ``page_size`` (integer) = Number of results to return per page.
104+
- ``search`` (string) = A search term.
105+
- Return a paginated list of advisories that fix a given package.
106+
* - GET ``/api/v3/fixing-advisories/{id}/``
181107
-
182-
- ``id`` (integer) = internal primary id of the alias
183-
- Return an alias with the given id
184-
* - ``/api/cpes/{id}``
108+
- ``id`` (string) = A unique integer value identifying this advisory v2.
109+
- Returns a specific advisory that fix a given package.
110+
* - GET ``/api/v3/package-types/``
185111
-
186-
- ``id`` = internal primary id of the cpe
187-
- Return a cpe with the given id
112+
- Return a list of to all the packages types in the database.
188113

189114
Miscellaneous
190115
----------------

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ VulnerableCode Documentation
4646

4747
*VulnerableCode* provides a Web UI and API to access a database of known software package
4848
vulnerabilities with comprehensive information from upstream and downstream public
49-
sources including packages affected by a vulnerability and packages that fix a
49+
sources including packages affected by a vulnerability advisories and packages that fix a
5050
vulnerability.
5151

52-
There is a `public VulnerableCode database <https://public.vulnerablecode.io/>`_
52+
There is a `public vulnerableCode database <https://public.vulnerablecode.io/>`_
5353
and the project also provides the tools to build your own instance of the database.
5454

5555
Documentation overview

docs/source/introduction.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ What can I do with VulnerableCode?
1818

1919
**For security researchers and software developers, VulnerableCode offers a web
2020
UI and a JSON API to efficiently find if the FOSS packages and dependencies that
21-
you use are affected by known vulnerabilities and to determine whether a later package version
22-
fixes those vulnerabilities.**
21+
you use are affected by known vulnerabilities advisories and to determine whether a later package version
22+
fixes those vulnerabilities advisories.**
2323

2424

25-
- With the web UI, you can search by package using Package URLs or navigate directly to advisory/AVID page
25+
- With the web UI, you can search by package using Package URLs and navigate directly to advisory/AVID page
2626

2727
- With the JSON API, you can perform package queries using Package URLs (`purl
2828
<https://github.com/package-url/purl-spec>`__) or query
29-
by advisory/AVID
29+
by advisory/AVID.
30+
For comprehensive details, see the :ref:`api` section.
3031

3132
You can install VulnerableCode locally or use the provided publicly hosted instance,
3233
or host your own installation. You can contact the VulnerableCode team

docs/source/reference_model_overview.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ This is a set of Graphviz-based graph diagrams of the application and admin mode
88
.. figure:: images/vcio-model.svg
99
:alt: application and Admin model diagrams
1010
:width: 100%
11-
:class: with-shadow
12-
13-
.. rst-class:: clear-both
11+
:class: with-shadow clear-both

docs/source/user-interface.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The search by packages is available at the following URL:
2020
How to search by packages:
2121

2222
1. Go to the URL: `https://public.vulnerablecode.io/ <https://public.vulnerablecode.io/>`_
23-
2. Enter the package URL or purl prefix fragment such as ``pkg:pypi/flask``
23+
2. Enter the package URL or purl prefix fragment such as ``pkg:pypi/aubio``
2424
or by package name in the search box.
2525
3. Click on the search button.
2626

@@ -42,5 +42,5 @@ You can directly navigate to an advisory page by specifying the importer name (f
4242
and the advisory identifier (for example, CVE-2026-23918). `https://public.vulnerablecode.io/advisories/advisory_name/AVID`
4343

4444
For example:
45-
- `https://public.vulnerablecode.io/advisories/github_osv/GHSA-xrcv-f9gm-v42c <https://public.vulnerablecode.io/advisories/github_osv/GHSA-xrcv-f9gm-v42c>`_
46-
- `https://public.vulnerablecode.io/advisories/nvd/CVE-2026-23918 <https://public.vulnerablecode.io/advisories/nvd/CVE-2026-23918>`_
45+
- `https://public.vulnerablecode.io/advisories/github_osv/GHSA-6xcx-gx7r-rccj <https://public.vulnerablecode.io/advisories/github_osv/GHSA-6xcx-gx7r-rccj>`_
46+
- `https://public.vulnerablecode.io/advisories/nvd/CVE-2026-23918 <https://public.vulnerablecode.io/advisories/nvd/CVE-2023-40024>`_

0 commit comments

Comments
 (0)