aboutcode-org / vulnerablecode

A free and open vulnerabilities database and the packages they impact. And the tools to aggregate and correlate these vulnerabilities. Sponsored by NLnet https://nlnet.nl/project/vulnerabilitydatabase/ for https://www.aboutcode.org/ Chat at https://gitter.im/aboutcode-org/vulnerablecode Docs at https://vulnerablecode.readthedocs.org/
https://public.vulnerablecode.io
Apache License 2.0
543 stars 201 forks source link

Add GraphQL API to provide user required data. #422

Open AmitGupta7580 opened 3 years ago

AmitGupta7580 commented 3 years ago

RestAPI

image

GraphQL API

image

I have executed same query on both types of API and recorded their response time . [Observation] GraphQL API is slightly faster than RestAPI.

FrameWork used : Graphene

AmitGupta7580 commented 3 years ago

Rest API Request :

image

Rest API Response is something like :

image

GraphQL API query :

{ packagesUrl(purls: ["pkg:pacman/archlinux/spice@0.14.3-3", "pkg:pacman/archlinux/vivaldi@3.7.2218.49-1", "pkg:pacman/archlinux/lib32-libcurl-compat@7.75.0-1", "pkg:pacman/archlinux/libcurl-compat@7.75.0-1", "pkg:pacman/archlinux/lib32-curl@7.75.0-1", "pkg:pacman/archlinux/curl@7.75.0-1", "pkg:pacman/archlinux/opera@74.0.3911.218-1", "pkg:pacman/archlinux/logstash@7.10.1-1", "pkg:pacman/archlinux/kibana@7.10.1-1", "pkg:pacman/archlinux/keycloak@12.0.4-1", "pkg:pacman/archlinux/python-flask-security-too@3.3.3-3", "pkg:pacman/archlinux/inetutils@1.9.4-8", "pkg:pacman/archlinux/openssl-1.0@1.0.2.u-1", "pkg:pacman/archlinux/linux-hardened@5.11.10.hardened1-1", "pkg:pacman/archlinux/lib32-libcurl-gnutls@7.75.0-1", "pkg:pacman/archlinux/libcurl-gnutls@7.75.0-1", "pkg:pacman/archlinux/binutils@2.36.1-2", "pkg:pacman/archlinux/ceph@15.2.8-2", "pkg:pacman/archlinux/elasticsearch@7.10.1-1", "pkg:pacman/archlinux/dnsmasq@2.84-1"]) { id name version type namespace subpath qualifiers vulnerabilities { vulnerabilityId oldVulnerabilityId summary vulnerabilityreferenceSet { url source referenceId vulnerabilityseveritySet { value scoringSystem } } } } }

GraphQL resonse is similar to :

image

sbs2001 commented 3 years ago

graphql doesn't have unresolved_vuln and resolved_vuln

sbs2001 commented 3 years ago

you need to do the tests where there are vulnerabilities linked to the package .

AmitGupta7580 commented 3 years ago

I have linked the vulnerabilities to packages and now their response sizes are almost equal. Framework : Graphene (CODE, requests and responses) https://gist.github.com/AmitGupta7580/6bb1a91ccf405461fb6c84e991cd3b17

image

image

GraphQL wins but the fight is very close :)