chg: [website] Restored legacy dbInfo endpoint.
Some checks are pending
API Test / Python 3.12 sample (push) Waiting to run
Models Tests / Python 3.11 sample (push) Waiting to run
Models Tests / Python 3.12 sample (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Deploy Jekyll with GitHub Pages dependencies preinstalled / build (push) Waiting to run
Deploy Jekyll with GitHub Pages dependencies preinstalled / deploy (push) Blocked by required conditions
MyPy / Python 3.11 sample (push) Waiting to run
API Test / Python 3.10 sample (push) Waiting to run
API Test / Python 3.11 sample (push) Waiting to run
MyPy / Python 3.10 sample (push) Waiting to run
MyPy / Python 3.12 sample (push) Waiting to run
Models Tests / Python 3.10 sample (push) Waiting to run

This commit is contained in:
Cédric Bonhomme 2024-11-27 13:43:21 +01:00
parent a8d97babc5
commit 77621ee1b9
Signed by untrusted user who does not match committer: cedric
GPG key ID: A1CB94DE57B7A70D
3 changed files with 9 additions and 35 deletions

View file

@ -66,6 +66,7 @@ def setup_api(application: Any) -> Api:
from website.web.api.v1 import stats
api.add_namespace(system.system_ns, path="/system")
api.add_namespace(system.system_ns_legacy, path="/")
api.add_namespace(vulnerability.vulnerability_ns, path="/vulnerability")
api.add_namespace(vulnerability.legacy_ns, path="/")
api.add_namespace(browse.browse_ns, path="/browse")

View file

@ -19,6 +19,7 @@ system_ns = Namespace(
"system",
description="Endpoints for retrieving various information about the system's status.",
)
system_ns_legacy = Namespace("system_legacy", doc=False)
@system_ns.route("/redis_up")
@ -36,23 +37,10 @@ class RedisUp(Resource): # type: ignore[misc]
@system_ns.route("/dbInfo")
@system_ns.route(
"/dbInfo",
doc={
"description": "Alias for /api/sytem/dbInfo",
"deprecated": True,
},
)
@system_ns.route(
"/info",
doc={
"description": "Alias for /api/sytem/dbInfo",
"deprecated": True,
},
)
@system_ns.doc(
description="Get more information about the current databases in use and when it was updated"
)
@system_ns_legacy.route("/dbInfo", doc=False)
class Info(Resource): # type: ignore[misc]
def get(self) -> dict[str, Any]:
return vulnerabilitylookup.get_info()

View file

@ -57,19 +57,9 @@ vulnerability_query_parser.add_argument(
@vulnerability_ns.route("/<string:vulnerability_id>")
@legacy_ns.route(
"cve/<string:vulnerability_id>",
doc={
"description": "Alias for /api/vulnerability/<string:vulnerability_id",
"deprecated": True,
},
)
@legacy_ns.route(
"vulnerability/<string:vulnerability_id>",
doc={
"description": "Alias for /api/vulnerability/<string:vulnerability_id",
"deprecated": True,
},
)
"cve/<string:vulnerability_id>", doc=False
) # "Alias for /api/vulnerability/<string:vulnerability_id
@legacy_ns.route("vulnerability/<string:vulnerability_id>", doc=False)
class Vulnerability(Resource): # type: ignore[misc]
@vulnerability_ns.doc(description="Get a vulnerability.") # type: ignore[misc]
@vulnerability_ns.expect(parser) # type: ignore[misc]
@ -239,17 +229,12 @@ class Last(Resource): # type: ignore[misc]
@vulnerability_ns.route("/search/<string:vendor>/<string:product>")
@legacy_ns.route(
"search/<string:vendor>/<string:product>",
doc={
"description": "Alias for /api/vulnerability/search/<string:vendor>/<string:product>",
"deprecated": True,
"doc": False,
},
)
@vulnerability_ns.doc(
description="Returns a list of vulnerabilities related to the product."
)
@legacy_ns.route(
"search/<string:vendor>/<string:product>", doc=False
) # Alias for /api/vulnerability/search/<string:vendor>/<string:product>
class VendorProductVulnerabilities(Resource): # type: ignore[misc]
def get(
self, vendor: str, product: str