0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

docs: update graphql examples to match current implementation (#2038)

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
Andrei Aaron 2023-11-13 19:58:15 +02:00 committed by GitHub
parent 3492f0aad3
commit 38f10af8cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@
The examples below only include the GraphQL query without any additional details on how to send them to a server. They were made with the GraphQL playground from the debug binary. You can also use curl to make these queries, here's an example: The examples below only include the GraphQL query without any additional details on how to send them to a server. They were made with the GraphQL playground from the debug binary. You can also use curl to make these queries, here's an example:
```bash ```bash
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageListForCVE (id:\"CVE-2002-1119\") { Results { Name Tags } } }" }' http://localhost:8080/v2/_zot/ext/search curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageListForCVE (id:\"CVE-2002-1119\") { Results { RepoName Tag } } }" }' http://localhost:8080/v2/_zot/ext/search
``` ```
## List CVEs of given image ## List CVEs of given image
@ -29,7 +29,10 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```graphql ```graphql
{ {
CVEListForImage(image: "centos:8", requestedPage: {limit: 1, offset:1, sortBy: SEVERITY}) { CVEListForImage(
image: "alpine:3.17"
requestedPage: {limit: 1, offset:1, sortBy: SEVERITY}
) {
Tag Tag
Page { Page {
TotalCount TotalCount
@ -56,22 +59,27 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
{ {
"data": { "data": {
"CVEListForImage": { "CVEListForImage": {
"Tag": "8", "Tag": "3.17",
"Page": { "Page": {
"TotalCount": 292, "TotalCount": 9,
"ItemCount": 1 "ItemCount": 1
}, },
"CVEList": [ "CVEList": [
{ {
"Id": "CVE-2022-24407", "Id": "CVE-2023-5363",
"Title": "cyrus-sasl: failure to properly escape SQL input allows an attacker to execute arbitrary SQL commands", "Title": "openssl: Incorrect cipher key and IV length processing",
"Description": "In Cyrus SASL 2.1.17 through 2.1.27 before 2.1.28, plugins/sql.c does not escape the password for a SQL INSERT or UPDATE statement.", "Description": "Issue summary: A bug has been identified in the processing of key and\ninitialisation vector (IV) lengths. This can lead to potential truncation\nor overruns during the initialisation of some symmetric ciphers.\n\nImpact summary: A truncation in the IV can result in non-uniqueness,\nwhich could result in loss of confidentiality for some cipher modes.\n\nWhen calling EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() or\nEVP_CipherInit_ex2() the provided OSSL_PARAM array is processed after\nthe key and IV have been established. Any alterations to the key length,\nvia the \"keylen\" parameter or the IV length, via the \"ivlen\" parameter,\nwithin the OSSL_PARAM array will not take effect as intended, potentially\ncausing truncation or overreading of these values. The following ciphers\nand cipher modes are impacted: RC2, RC4, RC5, CCM, GCM and OCB.\n\nFor the CCM, GCM and OCB cipher modes, truncation of the IV can result in\nloss of confidentiality. For example, when following NIST's SP 800-38D\nsection 8.2.1 guidance for constructing a deterministic IV for AES in\nGCM mode, truncation of the counter portion could lead to IV reuse.\n\nBoth truncations and overruns of the key and overruns of the IV will\nproduce incorrect results and could, in some cases, trigger a memory\nexception. However, these issues are not currently assessed as security\ncritical.\n\nChanging the key and/or IV lengths is not considered to be a common operation\nand the vulnerable API was recently introduced. Furthermore it is likely that\napplication developers will have spotted this problem during testing since\ndecryption would fail unless both peers in the communication were similarly\nvulnerable. For these reasons we expect the probability of an application being\nvulnerable to this to be quite low. However if an application is vulnerable then\nthis issue is considered very serious. For these reasons we have assessed this\nissue as Moderate severity overall.\n\nThe OpenSSL SSL/TLS implementation is not affected by this issue.\n\nThe OpenSSL 3.0 and 3.1 FIPS providers are not affected by this because\nthe issue lies outside of the FIPS provider boundary.\n\nOpenSSL 3.1 and 3.0 are vulnerable to this issue.",
"Severity": "HIGH", "Severity": "HIGH",
"PackageList": [ "PackageList": [
{ {
"Name": "cyrus-sasl-lib", "Name": "libcrypto3",
"InstalledVersion": "2.1.27-5.el8", "InstalledVersion": "3.0.8-r0",
"FixedVersion": "2.1.27-6.el8_5" "FixedVersion": "3.0.12-r0"
},
{
"Name": "libssl3",
"InstalledVersion": "3.0.8-r0",
"FixedVersion": "3.0.12-r0"
} }
] ]
} }
@ -87,23 +95,26 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```graphql ```graphql
{ {
ImageListForCVE(id: "CVE-2018-20651") { ImageListForCVE(id: "CVE-2023-0464") {
Results{ Results{
RepoName RepoName
Tag Tag
Digest Digest
ConfigDigest
LastUpdated LastUpdated
IsSigned IsSigned
Size Size
Platform {
Os
Arch
}
Vendor Vendor
DownloadCount DownloadCount
Licenses Licenses
Title Title
Manifests {
Digest
ConfigDigest
Platform {
Os
Arch
}
}
} }
} }
} }
@ -114,28 +125,32 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```json ```json
{ {
"data": { "data": {
"ImageListForCVE": [ "ImageListForCVE": {
"Results": [
{ {
"Results": { "RepoName": "alpine",
"RepoName": "centos", "Tag": "3.17",
"Tag": "centos8", "Digest": "sha256:75bfe77c8d5a76b4421cfcebbd62a28ae70d10147578d0cda45820e99b0ef1d8",
"Digest": "sha256:ac0dc62b48b7f683b49365fecef3b1f4d99fbd249b762e99f13f74938d85a6c8", "LastUpdated": "2023-02-11T04:46:42.558343068Z",
"ConfigDigest": "sha256:98a5843635a2ccc7d72b269923a65721480de929f882143c6c0a0eb43f9a2869",
"LastUpdated": "2022-10-17T16:36:09.1751694+03:00",
"IsSigned": true, "IsSigned": true,
"Size": "83545800", "Size": "3375436",
"Vendor": "",
"DownloadCount": 0,
"Licenses": "",
"Title": "",
"Manifests": [
{
"Digest": "sha256:75bfe77c8d5a76b4421cfcebbd62a28ae70d10147578d0cda45820e99b0ef1d8",
"ConfigDigest": "sha256:6a2bcc1c7b4c9207f791a4512d7f2fa8fc2daeae58dbc51cb2797b05415f082a",
"Platform": { "Platform": {
"Os": "linux", "Os": "linux",
"Arch": "amd64" "Arch": "amd64"
}, }
"Vendor": "[The CentOS Project](https://github.com/CentOS/sig-cloud-instance-images)\n",
"Score": null,
"DownloadCount": 0,
"Licenses": "View [license information](https://www.centos.org/legal/) for the software contained in this image.",
"Title": "centos"
},
} }
] ]
},
]
}
} }
} }
``` ```
@ -146,13 +161,16 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```graphql ```graphql
{ {
ImageListWithCVEFixed(id: "CVE-2018-20651", image: "ubuntu") { ImageListWithCVEFixed(id: "CVE-2023-0464", image: "ubuntu") {
Results { Results {
RepoName RepoName
Tag Tag
Digest Digest
ConfigDigest
LastUpdated LastUpdated
Manifests {
Digest
ConfigDigest
}
} }
} }
} }
@ -163,17 +181,34 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```json ```json
{ {
"data": { "data": {
"ImageListWithCVEFixed": [ "ImageListWithCVEFixed": {
"Results": [
{ {
"Results": {
"RepoName": "ubuntu", "RepoName": "ubuntu",
"Tag": "latest", "Tag": "kinetic",
"Digest": "sha256:650d596072ad45c6b74f4923e2cfea8158da2fb3a7b8dbb0b9ae4da3088d0591", "Digest": "sha256:1ac35e499e330f6520e80e91b29a55ff298077211f5ed66aff5cb357cca4a28f",
"ConfigDigest": "sha256:88eef892e29d5b11be933f13424ef885644a6a6978924fedfb51ba555278fe74", "LastUpdated": "2022-10-14T15:28:55.0263968Z",
"LastUpdated": "2022-10-25T01:53:41.769246372Z" "Manifests": [
} {
"Digest": "sha256:1ac35e499e330f6520e80e91b29a55ff298077211f5ed66aff5cb357cca4a28f",
"ConfigDigest": "sha256:824c0269745923afceb9765ae24f5b331bb6fcf2a82f7eba98b3cfd543afb41e"
} }
] ]
},
{
"RepoName": "ubuntu",
"Tag": "kinetic-20220922",
"Digest": "sha256:79eae04a0e32878fef3f8c5f901c32f6704c4a80b7f3fd9d89629e15867acfff",
"LastUpdated": "2022-10-14T15:27:41.2144454Z",
"Manifests": [
{
"Digest": "sha256:79eae04a0e32878fef3f8c5f901c32f6704c4a80b7f3fd9d89629e15867acfff",
"ConfigDigest": "sha256:15c8dcf63970bb14ea36e41aa001b87d8d31e25a082bf6f659d12489d3e53d90"
}
]
}
]
}
} }
} }
``` ```
@ -185,7 +220,7 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```graphql ```graphql
{ {
ImageListForDigest( ImageListForDigest(
id: "5f34d0bb0261d32d0b0bc91024b7d4e98d94b08a49615e08c8a5a65bc3a7e09f" id: "79eae04a0e32878fef3f8c5f901c32f6704c4a80b7f3fd9d89629e15867acfff"
) { ) {
Results{ Results{
RepoName RepoName
@ -201,17 +236,17 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```json ```json
{ {
"data": { "data": {
"ImageListForDigest": [ "ImageListForDigest": {
"Results": [
{ {
"Results": { "RepoName": "ubuntu",
"RepoName": "centos", "Tag": "kinetic-20220922",
"Tag": "8", "Title": "ubuntu"
"Title": "CentOS Base Image"
}
} }
] ]
} }
} }
}
``` ```
## List the latest image across every repository ## List the latest image across every repository
@ -311,25 +346,48 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
```json ```json
{ {
"data": { "data": {
"ImageList": [ "ImageList": {
"Results": [
{ {
"Results": "Tag": "jammy",
{ "Digest": "sha256:f96fcb040c7ee00c037c758cf0ab40638e6ee89b03a9d639178fcbd0e7f96d27",
"Tag": "latest", "LastUpdated": "2022-10-14T15:29:18.0325322Z",
"Digest": "sha256:650d596072ad45c6b74f4923e2cfea8158da2fb3a7b8dbb0b9ae4da3088d0591", "Size": "30472739"
"LastUpdated": "2022-10-25T01:53:41.769246372Z",
"Size": "30426374"
}, },
{ {
"Tag": "xenial", "Tag": "jammy-20221003",
"Digest": "sha256:34de800b5da88feb7723a87ecbbf238afb63dbfe0c828838e26ac7458bef0ac5", "Digest": "sha256:86681debca1719dff33f426a0f5c41792ebc52496c5d78a93b655b8b48fb71b2",
"LastUpdated": "2021-08-31T01:21:30.672229355Z", "LastUpdated": "2022-10-14T15:29:07.0004587Z",
"Size": "46499103" "Size": "30472748"
} },
{
"Tag": "kinetic",
"Digest": "sha256:1ac35e499e330f6520e80e91b29a55ff298077211f5ed66aff5cb357cca4a28f",
"LastUpdated": "2022-10-14T15:28:55.0263968Z",
"Size": "27498890"
},
{
"Tag": "kinetic-20220922",
"Digest": "sha256:79eae04a0e32878fef3f8c5f901c32f6704c4a80b7f3fd9d89629e15867acfff",
"LastUpdated": "2022-10-14T15:27:41.2144454Z",
"Size": "27498899"
},
{
"Tag": "latest",
"Digest": "sha256:9bc6d811431613bf2fd8bf3565b319af9998fc5c46304022b647c63e1165657c",
"LastUpdated": "2022-10-14T15:26:59.6707939Z",
"Size": "30472740"
},
{
"Tag": "rolling",
"Digest": "sha256:72e75626c5068b9d9a462c4fc80a29787d0cf61c8abc81bfd5ea69f6248d56fc",
"LastUpdated": "2022-10-14T15:27:21.2441356Z",
"Size": "30472741"
} }
] ]
} }
} }
}
``` ```
## List all images with expanded information for a given repository ## List all images with expanded information for a given repository
@ -364,21 +422,37 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
"ExpandedRepoInfo": { "ExpandedRepoInfo": {
"Images": [ "Images": [
{ {
"Tag": "xenial", "Tag": "jammy",
"Digest": "sha256:34de800b5da88feb7723a87ecbbf238afb63dbfe0c828838e26ac7458bef0ac5" "Digest": "sha256:f96fcb040c7ee00c037c758cf0ab40638e6ee89b03a9d639178fcbd0e7f96d27"
},
{
"Tag": "jammy-20221003",
"Digest": "sha256:86681debca1719dff33f426a0f5c41792ebc52496c5d78a93b655b8b48fb71b2"
},
{
"Tag": "kinetic",
"Digest": "sha256:1ac35e499e330f6520e80e91b29a55ff298077211f5ed66aff5cb357cca4a28f"
},
{
"Tag": "kinetic-20220922",
"Digest": "sha256:79eae04a0e32878fef3f8c5f901c32f6704c4a80b7f3fd9d89629e15867acfff"
},
{
"Tag": "rolling",
"Digest": "sha256:72e75626c5068b9d9a462c4fc80a29787d0cf61c8abc81bfd5ea69f6248d56fc"
}, },
{ {
"Tag": "latest", "Tag": "latest",
"Digest": "sha256:650d596072ad45c6b74f4923e2cfea8158da2fb3a7b8dbb0b9ae4da3088d0591" "Digest": "sha256:9bc6d811431613bf2fd8bf3565b319af9998fc5c46304022b647c63e1165657c"
} }
], ],
"Summary": { "Summary": {
"LastUpdated": "2022-10-25T01:53:41.769246372Z", "LastUpdated": "2022-10-14T15:29:18.0325322Z",
"Size": "76929691", "Size": "58146896",
"NewestImage": { "NewestImage": {
"Tag": "latest", "Tag": "jammy",
"LastUpdated": "2022-10-25T01:53:41.769246372Z", "LastUpdated": "2022-10-14T15:29:18.0325322Z",
"Digest": "sha256:650d596072ad45c6b74f4923e2cfea8158da2fb3a7b8dbb0b9ae4da3088d0591" "Digest": "sha256:f96fcb040c7ee00c037c758cf0ab40638e6ee89b03a9d639178fcbd0e7f96d27"
} }
} }
} }
@ -401,6 +475,8 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
RepoName RepoName
Tag Tag
LastUpdated LastUpdated
Manifests {
Digest
Layers { Layers {
Size Size
Digest Digest
@ -408,6 +484,7 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
} }
} }
} }
}
``` ```
**Sample response** **Sample response**
@ -424,7 +501,10 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
{ {
"RepoName": "ubuntu", "RepoName": "ubuntu",
"Tag": "latest", "Tag": "latest",
"LastUpdated": "2022-10-14T18:26:59.6707939+03:00", "LastUpdated": "2022-10-14T15:26:59.6707939Z",
"Manifests": [
{
"Digest": "sha256:9bc6d811431613bf2fd8bf3565b319af9998fc5c46304022b647c63e1165657c",
"Layers": [ "Layers": [
{ {
"Size": "30428928", "Size": "30428928",
@ -434,6 +514,8 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ImageList
} }
] ]
} }
]
}
} }
} }
``` ```