Skip to content

Conversation

@pjcollins
Copy link
Member

@pjcollins pjcollins commented Jul 7, 2023

Context: https://github.com/xamarin/yaml-templates/pull/263

Updates the main SBOM file we produce to include build component info
from both the macOS and Linux builds. These two builds will now produce
build component SBOMs which are downloaded and referenced in our main
SBOM afer all building and signing is complete.

Context: xamarin/yaml-templates#263

Improves the content of our SBOM by unzipping our artifacts into a
components directory that will be passed to the SBOM task.  This will
ensure that metadata for all of the files in our packages will also be
included in the SBOM.
@pjcollins pjcollins requested a review from jonpryor as a code owner July 7, 2023 19:05
@pjcollins
Copy link
Member Author

Testing this with https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=8036618&view=results.

In a future PR, we can try to add build dependencies to the SBOM as well via the referencing-other-sboms-inside-the-current-sbom docs.

@pjcollins
Copy link
Member Author

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this fix the SBOM check on VS insertions? Like this one:

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1848417/

@jonpryor
Copy link
Contributor

@pjcollins: the "big picture" question: what should we be doing, vs. what we are doing?

My (wrong?) understanding is that a Software Bill of Materials should include e.g.:

  • Source: SBOM created directly from the development environment, source files, and included dependencies used to build an product artifact.
  • Build: SBOM generated as part of the process of building the software to create a releasable artifact (e.g., executable or package) from data such as source files, dependencies, built components, build process ephemeral data, and other SBOMs.

I thus infer that the SBOM should list every NuGet package that we build against and/or redistribute. This would include Newtonsoft.Json.dll and Irony.dll, among (many!) others.

Compare to what we actually produce, even from your latest build, and I don't see any such NuGet inputs. (I'm checking in the wrong place?) For example, the sbom/_manifest/manifest.json file mentions multiple .msi (ae1796c1a80f210c3d79965ad4a89a40-x86.msi) and .nupkg files (Microsoft.Android.Runtime.34.android-arm.34.0.0-ci.dev-pjc-sbom-content.369.nupkg), but neither "Newtonsoft" nor "Irony" is present in the file.

Is my meta-understanding wrong? Should Newtonsoft & Irony be mentioned in the SBOM? Should they not be mentioned (insert reason why)?

@pjcollins pjcollins marked this pull request as draft July 10, 2023 21:07
@pjcollins pjcollins requested review from mjbond-msft and mrward July 10, 2023 21:08
@pjcollins
Copy link
Member Author

Will this fix the SBOM check on VS insertions? Like this one:

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1848417/

Unfortunately no. As far I as know there is arcade work planned to support this for all .NET workloads, though it has been pending for quite a while... We should check with the .NET SDK and/or .NET Eng teams on the status of this.


@pjcollins: the "big picture" question: what should we be doing, vs. what we are doing?

My (wrong?) understanding is that a Software Bill of Materials should include e.g.:

  • Source: SBOM created directly from the development environment, source files, and included dependencies used to build an product artifact.
  • Build: SBOM generated as part of the process of building the software to create a releasable artifact (e.g., executable or package) from data such as source files, dependencies, built components, build process ephemeral data, and other SBOMs.

I thus infer that the SBOM should list every NuGet package that we build against and/or redistribute. This would include Newtonsoft.Json.dll and Irony.dll, among (many!) others.

Compare to what we actually produce, even from your latest build, and I don't see any such NuGet inputs. (I'm checking in the wrong place?) For example, the sbom/_manifest/manifest.json file mentions multiple .msi (ae1796c1a80f210c3d79965ad4a89a40-x86.msi) and .nupkg files (Microsoft.Android.Runtime.34.android-arm.34.0.0-ci.dev-pjc-sbom-content.369.nupkg), but neither "Newtonsoft" nor "Irony" is present in the file.

Is my meta-understanding wrong? Should Newtonsoft & Irony be mentioned in the SBOM? Should they not be mentioned (insert reason why)?

I forgot to convert this to draft earlier, as the SBOM task is still not behaving as I would expect. By my understanding our SBOM needs to contain metadata about the following:

Build Outputs

  • Packages that are distributed (e.g. NUPKG, MSI)
  • Contents of the packages that are distributed (e.g. Xamarin.Android.Build.Tasks.dll)

Build Inputs

  • List of dependencies required to produce the outputs above (sources, NuGets, etc)

This PR aims to address inclusion of all Build Outputs information. We currently include packages in our SBOM, but not the contents of those packages. That's where this PR comes in.

I plan on addressing the Build Inputs portion of the requirements in a future PR, hopefully by producing a different SBOM during the build job that can be referenced by the "Outputs" SBOM produced by this PR.

@mjbond-msft @mrward do the requirements I've mentioned above match your expectations? Feel free to continue this conversation offline if that will be easier.

@pjcollins pjcollins changed the title [ci] Include NUPKG contents in SBOM [ci] Include build components in SBOM Jul 13, 2023
@pjcollins
Copy link
Member Author

I haven't received a clear response on whether or not we need to include both shipping packages and the contents of the shipping packages in the SBOM, so I'll remove those changes for now.

The PR will now produce "build components" SBOMs during the mac and linux builds, and download and reference them when creating the main sbom file.

@pjcollins
Copy link
Member Author

@pjcollins pjcollins marked this pull request as ready for review July 13, 2023 23:27
@pjcollins pjcollins merged commit 58d1306 into main Jul 17, 2023
@pjcollins pjcollins deleted the dev/pjc/sbom-content branch July 17, 2023 23:53
grendello added a commit to grendello/xamarin-android that referenced this pull request Jul 18, 2023
* main:
  [ci] Include build components in SBOM (dotnet#8174)
grendello added a commit to grendello/xamarin-android that referenced this pull request Jul 18, 2023
* main:
  [ci] Include build components in SBOM (dotnet#8174)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants