Skip to content

Commit 89bede3

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

59 files changed

Lines changed: 276 additions & 1026 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ endif()
5050
enable_testing()
5151
add_subdirectory(tests/mock-ui)
5252
add_subdirectory(tests/tests)
53+
include(cmake/sbom.cmake)

cmake/cmake-sbom

Submodule cmake-sbom added at 9cf1ba4

cmake/sbom.cmake

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

src/app/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(WIN32)
2222
endif()
2323
set(WEBEID_PATH web-eid.exe)
2424
set(BASE_FILE $<TARGET_NAME:web-eid>_${PROJECT_VERSION}.$ENV{PLATFORM})
25-
set(WIX_CMD wix.exe build -nologo
25+
set(WIX_CMD wix build -nologo
2626
-arch $ENV{PLATFORM}
2727
-ext WixToolset.UI.wixext
2828
-bv WixUIDialogBmp=${CMAKE_SOURCE_DIR}/install/dlgbmp.bmp

src/app/getcommandhandler.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
/*
2-
* Copyright (c) 2020-2024 Estonian Information System Authority
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a copy
5-
* of this software and associated documentation files (the "Software"), to deal
6-
* in the Software without restriction, including without limitation the rights
7-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8-
* copies of the Software, and to permit persons to whom the Software is
9-
* furnished to do so, subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in all
12-
* copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20-
* SOFTWARE.
21-
*/
1+
// SPDX-FileCopyrightText: Estonian Information System Authority
2+
// SPDX-License-Identifier: MIT
223

234
#include "commandhandler.hpp"
245

0 commit comments

Comments
 (0)