add CycloneDX attestation export endpoint#759
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a CycloneDX attestation-compatible JSON export option to existing OpenCRE REST endpoints by extending the format query parameter and emitting CycloneDX BOM-shaped payloads for various document queries.
Changes:
- Extend supported response formats to include
cyclonedxin OpenAPI and server-side format handling. - Add CycloneDX BOM builder helpers and wire them into multiple REST endpoints (
id,name, node lookup, tags, text search, root CREs). - Add/extend unit tests to validate CycloneDX responses for selected endpoints.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| docs/api/openapi.yaml | Adds cyclonedx to the allowed format query enum for several endpoints. |
| application/web/web_main.py | Implements CycloneDX BOM generation and returns it when format=cyclonedx is requested across multiple routes. |
| application/tests/web_main_test.py | Adds assertions for CycloneDX responses for /rest/v1/id/{creid} and /rest/v1/standard/{name}. |
Comments suppressed due to low confidence (1)
application/web/web_main.py:21
from application.utils import oscal_utils, redisis imported twice in this file, which is easy to miss now that new imports were added. Please remove the duplicate import to avoid confusion and keep the import section clean.
from application.utils import oscal_utils, redis
from rq import job, exceptions
from application.utils import spreadsheet_parsers
from application.utils import oscal_utils, redis
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| elif opt_format == SupportedFormats.OSCAL.value: | ||
| return jsonify(json.loads(oscal_utils.list_to_oscal(documents))) | ||
| elif opt_format == SupportedFormats.CycloneDX.value: | ||
| return jsonify(_documents_to_cyclonedx(documents)) |
There was a problem hiding this comment.
CycloneDX support was added to multiple endpoints (/rest/v1/tags, /rest/v1/text_search, /rest/v1/root_cres), but the new tests only exercise the id and standard routes. Since these new format=cyclonedx branches are separate code paths, please add assertions in the existing tests for these endpoints (or new tests) to cover the CycloneDX response shape and edge cases.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Akshat Pal <118915075+akshat4703@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Akshat Pal <118915075+akshat4703@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Akshat Pal <118915075+akshat4703@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Akshat Pal <118915075+akshat4703@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Akshat Pal <118915075+akshat4703@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Implements an API endpoint to export OpenCRE mapping results as CycloneDX attestation-compatible JSON.
Why
Issue #499 requests machine-readable export for downstream compliance, audit, and SBOM/attestation workflows.
Changes
Impact
Validation