Skip to content

Commit 952b405

Browse files
committed
Generate SBOM info
WE2-1144 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 0de1619 commit 952b405

79 files changed

Lines changed: 336 additions & 1027 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cmake-linux-fedora.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ jobs:
2929
run: cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc -B build -S .
3030

3131
- name: Build
32-
run: cmake --build build --config $BUILD_TYPE --target package
32+
run: |
33+
cmake --build build --config $BUILD_TYPE --target package
34+
cmake --install build/sbom
3335
3436
- uses: actions/upload-artifact@v7
3537
with:
3638
name: web-eid-app-fedora-build-fedora${{matrix.container}}-${{github.run_number}}
37-
path: build/*rpm
39+
path: |
40+
build/*rpm
41+
build/*.spdx

.github/workflows/cmake-linux-ubuntu.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
container: ubuntu:${{matrix.container}}
1818
strategy:
1919
matrix:
20-
container: ['22.04', '24.04', '25.04', '25.10']
20+
container: ['22.04', '24.04', '25.10', '26.04']
2121
arch: ['amd64', 'arm64']
2222

2323
steps:
@@ -35,6 +35,7 @@ jobs:
3535
- name: Build
3636
run: |
3737
cmake --build build --config $BUILD_TYPE --target installer
38+
cmake --install build/sbom
3839
# Debian creates artifacts outside of project dir, copy them back to make them available in the build artifacts
3940
mv ../web-eid*.* build/
4041
@@ -44,4 +45,6 @@ jobs:
4445
- uses: actions/upload-artifact@v7
4546
with:
4647
name: web-eid-app-ubuntu-build-ubuntu${{matrix.container}}-${{ matrix.arch }}-${{github.run_number}}
47-
path: build/*.*deb
48+
path: |
49+
build/*.*deb
50+
build/*.spdx

.github/workflows/cmake-macos.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
cmake --build ${BUILD_DIR} --config ${BUILD_TYPE}
7878
cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} --target installer
7979
cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} --target installer-safari
80+
cmake --install build/sbom
8081
8182
#- name: Test
8283
# run: ctest -V -C ${BUILD_TYPE} --test-dir ${BUILD_DIR}
@@ -88,3 +89,9 @@ jobs:
8889
path: |
8990
build/src/app/*.pkg
9091
build/src/app/*.dmg
92+
93+
- name: Upload SBOM artifacts
94+
uses: actions/upload-artifact@v7
95+
with:
96+
name: web-eid-app-macos-sbom-${{github.run_number}}
97+
path: build/*.spdx

.github/workflows/cmake-windows.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
cmake --build build --config ${env:BUILD_TYPE}
6868
cmake --build build --config ${env:BUILD_TYPE} --target installer
6969
cmake --build build --config ${env:BUILD_TYPE} --target bundle
70+
cmake --install build/sbom
7071
7172
- name: Test
7273
if: ${{ matrix.arch == 'x64' }}
@@ -80,6 +81,12 @@ jobs:
8081
build/src/app/*.msi
8182
build/src/app/*.exe
8283
84+
- name: Upload SBOM artifacts
85+
uses: actions/upload-artifact@v7
86+
with:
87+
name: web-eid-app-windows-sbom-${{matrix.arch}}-${{github.run_number}}
88+
path: build/*.spdx
89+
8390
- name: Upload debug artifacts
8491
uses: actions/upload-artifact@v7
8592
with:

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
[submodule "src/mac/js"]
55
path = src/mac/js
66
url = ../web-eid-webextension
7+
[submodule "cmake/cmake-sbom"]
8+
path = cmake/cmake-sbom
9+
url = https://github.com/DEMCON/cmake-sbom.git
10+
branch = v1.4.0

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: Estonian Information System Authority
2+
# SPDX-License-Identifier: MIT
3+
14
cmake_minimum_required(VERSION 3.22)
25

36
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/lib/libelectronic-id/README.md")
@@ -50,3 +53,4 @@ endif()
5053
enable_testing()
5154
add_subdirectory(tests/mock-ui)
5255
add_subdirectory(tests/tests)
56+
include(cmake/sbom.cmake)

build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
# SPDX-FileCopyrightText: Estonian Information System Authority
3+
# SPDX-License-Identifier: MIT
24

35
set -e
46
set -u

cmake/cmake-sbom

Submodule cmake-sbom added at 9cf1ba4

cmake/sbom.cmake

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# SPDX-FileCopyrightText: Estonian Information System Authority
2+
# SPDX-License-Identifier: MIT
3+
4+
# SBOM generation using DEMCON/cmake-sbom (SPDX 2.3, install-time)
5+
# Run: cmake --install <build-dir>/sbom
6+
7+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/cmake-sbom/cmake")
8+
include(sbom)
9+
10+
execute_process(
11+
COMMAND git describe --tags --abbrev=0
12+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/libelectronic-id"
13+
OUTPUT_VARIABLE ELECTRONIC_ID_VERSION
14+
OUTPUT_STRIP_TRAILING_WHITESPACE
15+
ERROR_QUIET
16+
)
17+
string(REGEX REPLACE "^v" "" ELECTRONIC_ID_VERSION "${ELECTRONIC_ID_VERSION}")
18+
19+
sbom_generate(
20+
OUTPUT "${CMAKE_BINARY_DIR}/web-eid-${PROJECT_VERSION}.spdx"
21+
LICENSE "MIT"
22+
SUPPLIER "Estonian Information System Authority"
23+
SUPPLIER_URL https://www.ria.ee
24+
DOWNLOAD_URL https://github.com/web-eid/web-eid-app
25+
VERSION "${PROJECT_VERSION}"
26+
)
27+
28+
set(_sbom_reset "${CMAKE_BINARY_DIR}/sbom/sbom-reset.cmake")
29+
file(WRITE "${_sbom_reset}"
30+
"file(WRITE \"${CMAKE_BINARY_DIR}/sbom/sbom.spdx.in\" \"\")\n"
31+
"file(READ \"${CMAKE_BINARY_DIR}/SPDXRef-DOCUMENT.spdx.in\" _doc)\n"
32+
"file(APPEND \"${CMAKE_BINARY_DIR}/sbom/sbom.spdx.in\" \"\${_doc}\")\n"
33+
"set(SBOM_VERIFICATION_CODES \"\")\n"
34+
)
35+
file(APPEND "${CMAKE_BINARY_DIR}/sbom/CMakeLists.txt"
36+
"install(SCRIPT \"${_sbom_reset}\")\n"
37+
)
38+
39+
set(_app_spdxid "SPDXRef-Package-${PROJECT_NAME} DEPENDS_ON @SBOM_LAST_SPDXID@")
40+
if(APPLE)
41+
sbom_add(PACKAGE web-eid-safari
42+
VERSION "${PROJECT_VERSION}"
43+
SUPPLIER "Organization: Estonian Information System Authority"
44+
DOWNLOAD_LOCATION https://github.com/web-eid/web-eid-app
45+
LICENSE "MIT"
46+
EXTREF "cpe:2.3:a:web-eid:web-eid:${PROJECT_VERSION}:*:*:*:*:*:*:*"
47+
RELATIONSHIP "@SBOM_LAST_SPDXID@ VARIANT_OF SPDXRef-Package-${PROJECT_NAME}"
48+
)
49+
set(_app_spdxid "${_app_spdxid}\nRelationship: ${SBOM_LAST_SPDXID} DEPENDS_ON @SBOM_LAST_SPDXID@")
50+
file(READ "${CMAKE_SOURCE_DIR}/src/mac/js/package.json" _webext_json)
51+
string(JSON WEBEXT_VERSION GET "${_webext_json}" "version")
52+
sbom_add(PACKAGE web-eid-webextension
53+
VERSION "${WEBEXT_VERSION}"
54+
SUPPLIER "Organization: Estonian Information System Authority"
55+
DOWNLOAD_LOCATION https://github.com/web-eid/web-eid-webextension
56+
LICENSE "MIT"
57+
RELATIONSHIP "${SBOM_LAST_SPDXID} DEPENDS_ON @SBOM_LAST_SPDXID@"
58+
)
59+
if(NPM_EXECUTABLE)
60+
execute_process(
61+
COMMAND "${NPM_EXECUTABLE}" --version
62+
OUTPUT_VARIABLE NPM_VERSION
63+
OUTPUT_STRIP_TRAILING_WHITESPACE
64+
ERROR_QUIET
65+
)
66+
string(REGEX REPLACE "^v" "" NPM_VERSION "${NPM_VERSION}")
67+
endif()
68+
if(NPM_VERSION)
69+
sbom_add(PACKAGE npm
70+
VERSION "${NPM_VERSION}"
71+
SUPPLIER "Organization: OpenJS Foundation"
72+
DOWNLOAD_LOCATION https://www.npmjs.com
73+
LICENSE "Artistic-2.0"
74+
EXTREF "cpe:2.3:a:npmjs:npm:${NPM_VERSION}:*:*:*:*:*:*:*"
75+
RELATIONSHIP "@SBOM_LAST_SPDXID@ BUILD_TOOL_OF ${SBOM_LAST_SPDXID}"
76+
)
77+
endif()
78+
endif()
79+
80+
if(WIN32)
81+
find_program(WIX_EXECUTABLE NAMES wix)
82+
if(WIX_EXECUTABLE)
83+
execute_process(
84+
COMMAND "${WIX_EXECUTABLE}" --version
85+
OUTPUT_VARIABLE WIX_VERSION
86+
OUTPUT_STRIP_TRAILING_WHITESPACE
87+
ERROR_QUIET
88+
)
89+
string(REGEX REPLACE "\\+.*$" "" WIX_VERSION "${WIX_VERSION}")
90+
endif()
91+
if(WIX_VERSION)
92+
sbom_add(PACKAGE WiX
93+
VERSION "${WIX_VERSION}"
94+
SUPPLIER "Organization: WiX Toolset Contributors"
95+
DOWNLOAD_LOCATION https://wixtoolset.org
96+
LICENSE "MS-RL"
97+
EXTREF "cpe:2.3:a:wixtoolset:wix_toolset:${WIX_VERSION}:*:*:*:*:*:*:*"
98+
)
99+
endif()
100+
endif()
101+
102+
sbom_add(PACKAGE libelectronic-id
103+
VERSION "${ELECTRONIC_ID_VERSION}"
104+
SUPPLIER "Organization: Estonian Information System Authority"
105+
DOWNLOAD_LOCATION https://github.com/web-eid/libelectronic-id
106+
LICENSE "MIT"
107+
EXTREF "cpe:2.3:a:web-eid:libelectronic-id:${ELECTRONIC_ID_VERSION}:*:*:*:*:*:*:*"
108+
RELATIONSHIP "${_app_spdxid}"
109+
)
110+
111+
find_package(GTest QUIET)
112+
if(GTest_FOUND)
113+
sbom_add(PACKAGE GTest
114+
VERSION "${GTest_VERSION}"
115+
SUPPLIER "Organization: Google LLC"
116+
DOWNLOAD_LOCATION https://github.com/google/googletest
117+
LICENSE "BSD-3-Clause"
118+
EXTREF "cpe:2.3:a:google:googletest:${GTest_VERSION}:*:*:*:*:*:*:*"
119+
RELATIONSHIP "${SBOM_LAST_SPDXID} TEST_TOOL_OF @SBOM_LAST_SPDXID@"
120+
)
121+
endif()
122+
123+
if(PCSC_FOUND)
124+
sbom_add(PACKAGE libpcsclite
125+
VERSION "${PCSC_VERSION}"
126+
SUPPLIER "Organization: Muscle project"
127+
DOWNLOAD_LOCATION https://pcsclite.apdu.fr
128+
LICENSE "BSD-3-Clause"
129+
EXTREF "cpe:2.3:a:pcsc-lite_project:pcsc-lite:${PCSC_VERSION}:*:*:*:*:*:*:*"
130+
)
131+
endif()
132+
133+
sbom_add(PACKAGE Qt6
134+
VERSION "${Qt6_VERSION}"
135+
SUPPLIER "Organization: The Qt Company"
136+
DOWNLOAD_LOCATION https://download.qt.io/
137+
LICENSE "LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-Qt-commercial"
138+
EXTREF "cpe:2.3:a:qt:qt:${Qt6_VERSION}:*:*:*:*:*:*:*"
139+
RELATIONSHIP "${_app_spdxid}"
140+
)
141+
142+
sbom_add(PACKAGE OpenSSL
143+
VERSION "${OPENSSL_VERSION}"
144+
SUPPLIER "Organization: OpenSSL Software Foundation"
145+
DOWNLOAD_LOCATION https://openssl.org
146+
LICENSE "Apache-2.0"
147+
EXTREF "cpe:2.3:a:openssl:openssl:${OPENSSL_VERSION}:*:*:*:*:*:*:*"
148+
RELATIONSHIP "${_app_spdxid}"
149+
)
150+
151+
sbom_finalize(NO_VERIFY)

install/distribution.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<!-- SPDX-FileCopyrightText: Estonian Information System Authority -->
3+
<!-- SPDX-License-Identifier: MIT -->
24
<!--
35
https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/DistributionDefinitionRef/
46
https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/InstallerJavaScriptRef/

0 commit comments

Comments
 (0)