Skip to content
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

Generate SBOM and Provenance for released images #1886

Merged
merged 4 commits into from
Nov 1, 2024

Conversation

Polber
Copy link
Contributor

@Polber Polber commented Sep 21, 2024

PR adds SBOM and Provenance generation for released images, as well as Build time scanning for these images.

Notable changes are:

  • Building images with Provenance (more info here.)
    • Images built with JIB (Java-only flex templates) are now packed as tar file instead of being pushed to GCR directly. These tar files are then sent to Cloud Build to be loaded (docker load) and pushed to GCR/AR - This takes advantage of the built-in Provenance support that Cloud Build provides for all images pushed to GCR/AR
    • Images built solely with Cloud Build (Python, Xlang and YAML templates) will still be built using the Kaniko executor, but will likewise be packaged as tar before being sent to next step where they are loaded (docker load) and pushed to GCR/AR.
  • Generating SBOM
    • SBOM generation is invoked on the image(s) after being pushed to GCR/AR using the command
      gcloud artifacts sbom export --uri=gcr.io/....
      More info about SBOM generation can be found here.
  • Build-time scanning
    • ALL images will now be sent to Cloud Build as described in the Provenance section above. This not only allows us to leverage the Provenance generation, but also Build-time scanning. All the released images will be stored in a repository with continuous scanning, but this build-time scan allows critical vulnerabilities to be found before release, to hopefully avoid vulnerabilities earlier in the lifecycle of a released image.
    • This will use a separate Cloud Build job that runs after the image is staged. This job takes the released image as an argument and runs the scan against it.

All the above changes will be behind a maven argument -DgenerateSBOM which is disabled by default when Staging and Running a template (i.e. for ITs), but is enabled by default for Release.

@Polber Polber self-assigned this Sep 21, 2024
Copy link

codecov bot commented Sep 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 45.10%. Comparing base (515e05f) to head (923791e).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...gle/cloud/teleport/plugin/TemplatePluginUtils.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1886      +/-   ##
============================================
+ Coverage     45.09%   45.10%   +0.01%     
+ Complexity     3614     3612       -2     
============================================
  Files           835      835              
  Lines         49720    49739      +19     
  Branches       5237     5240       +3     
============================================
+ Hits          22421    22435      +14     
- Misses        25633    25635       +2     
- Partials       1666     1669       +3     
Components Coverage Δ
spanner-templates 66.24% <ø> (-0.02%) ⬇️
spanner-import-export 64.16% <ø> (-0.07%) ⬇️
spanner-live-forward-migration 76.11% <ø> (ø)
spanner-live-reverse-replication 76.48% <ø> (ø)
spanner-bulk-migration 85.50% <ø> (ø)
Files with missing lines Coverage Δ
...gle/cloud/teleport/plugin/TemplatePluginUtils.java 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

@pull-request-size pull-request-size bot added size/L and removed size/S labels Sep 23, 2024
@Polber Polber force-pushed the jkinard/sbom branch 7 times, most recently from 77f758b to a57fc6f Compare September 24, 2024 04:08
@Polber Polber changed the title Generate SBOM for AR images Generate SBOM and Provenance for release images Sep 24, 2024
@Polber Polber changed the title Generate SBOM and Provenance for release images Generate SBOM and Provenance for released images Sep 24, 2024
liferoad
liferoad previously approved these changes Oct 4, 2024
@Polber Polber force-pushed the jkinard/sbom branch 2 times, most recently from 5033422 to b149486 Compare October 10, 2024 22:24
@Polber Polber requested a review from damccorm October 14, 2024 16:41
@Polber
Copy link
Contributor Author

Polber commented Oct 14, 2024

Test failure looks unrelated

@Polber Polber force-pushed the jkinard/sbom branch 3 times, most recently from d2459c3 to 8eb81d1 Compare October 17, 2024 23:04
@Polber Polber force-pushed the jkinard/sbom branch 3 times, most recently from 776e775 to 013665a Compare October 24, 2024 17:09
@Polber Polber force-pushed the jkinard/sbom branch 3 times, most recently from 8966554 to 21848b0 Compare October 30, 2024 21:40
@Polber Polber force-pushed the jkinard/sbom branch 4 times, most recently from 35605dd to 3662631 Compare October 31, 2024 22:15
@Polber Polber force-pushed the jkinard/sbom branch 2 times, most recently from 5e85f42 to 39bcc05 Compare November 1, 2024 15:31
Signed-off-by: Jeffrey Kinard <[email protected]>
Signed-off-by: Jeffrey Kinard <[email protected]>
Signed-off-by: Jeffrey Kinard <[email protected]>
@Polber Polber force-pushed the jkinard/sbom branch 2 times, most recently from deb8f2f to 95e6250 Compare November 1, 2024 17:41
Signed-off-by: Jeffrey Kinard <[email protected]>
@Polber Polber merged commit e71280a into GoogleCloudPlatform:main Nov 1, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants