Skip to content

Commit 13ab47f

Browse files
author
nasreenkhannam
committed
Add SBOM endpoint to ProjectViewSet
1 parent dce8dbd commit 13ab47f

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

scanpipe/api/views.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ class ProjectViewSet(
136136
mixins.ListModelMixin,
137137
viewsets.GenericViewSet,
138138
):
139+
@action(detail=True, methods=["get"])
140+
def sbom(self, request, *args, **kwargs):
141+
"""
142+
Return SBOM for a given PURL.
143+
"""
144+
project = self.get_object()
145+
purl = request.query_params.get("purl")
146+
147+
if not purl:
148+
return ErrorResponse("purl is required")
149+
150+
# TODO: integrate actual SBOM generation logic
151+
return Response({
152+
"project": project.name,
153+
"purl": purl,
154+
"sbom": "CycloneDX SBOM will be generated here"
155+
},status=200)
139156
"""
140157
A viewset that provides the ability to list, get, create, and destroy projects.
141158
Multiple actions are available to manage project instances.

0 commit comments

Comments
 (0)