-
Notifications
You must be signed in to change notification settings - Fork 116
feat: Implement SBOM backend logic #5508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the backend foundation for a "Security" tab in snap channel map dropdowns by adding SBOM (Software Bill of Materials) support. It introduces a proxy endpoint for fetching SBOMs to bypass CORS restrictions, adds logic to detect SBOM availability, and passes this information to templates for conditional UI rendering.
Key Changes:
- Adds
/sbom/<snap_id>/<revision>proxy endpoint to fetch SPDX SBOM files from the device gateway - Implements
snap_has_sboms()check to determine if a snap has SBOM data available - Adds CSP policy for
*.snapcraftcontent.comdomain where SBOM API is hosted - Extends channel maps to include revision information needed for SBOM lookups
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| webapp/store/snap_details_views.py | Adds SBOM proxy endpoint, availability check function, and integration with snap details context. Changes snap-id key to snap_id for Python naming consistency. |
| webapp/store/logic.py | Adds get_revisions() helper to extract sorted revision list from channel maps. Updates convert_channel_maps() to include revision field in output. |
| webapp/handlers.py | Adds *.snapcraftcontent.com to CSP connect-src policy to allow SBOM API calls. |
| tests/store/tests_public_logic.py | Updates test fixtures to include revision field in channel map data for consistency with logic changes. |
| tests/store/tests_github_badge.py | Updates test fixtures to include revision field in channel map data. |
| tests/store/tests_embedded_card.py | Updates test fixtures to include revision field in channel map data. |
| tests/store/tests_distro_page.py | Updates test fixtures to include revision field in channel map data. |
| tests/store/tests_details.py | Updates test fixtures and mocks SBOM HEAD requests in all snap details test cases to support the new availability check. |
|
@steverydz I've opened a new pull request, #5509, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@steverydz I've opened a new pull request, #5510, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@steverydz I've opened a new pull request, #5511, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
I found a few print statements in |
@codeEmpress1 Fixed. Thanks! |
Done
*.snapcraftcontent.comto the CSP as the SBOM AIP calls this, and our current CSP blocks ithas_sbomsflag to the template so it can be used to conditionally show the "Security" tab when it is implementedHow to QA
DEVICEGW_URL=https://api.staging.snapcraft.io/to.env.local)Testing
Issue / Card
Fixes: