From 4a0b5661fdd1f1120018efb5f08bfbc1ed16cc13 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 24 Feb 2025 19:11:00 +0100 Subject: [PATCH] CMake: Sanitize nested SBOM attribution target names To avoid issues with characters like "/" which might come from attribution ids. Pick-to: 6.8 6.9 Task-number: QTBUG-122899 Change-Id: I65bec3b301f7fe1008cfd06aba3e1fbbb93f38c3 Reviewed-by: Alexey Edelev Reviewed-by: Joerg Bornemann --- cmake/QtPublicSbomAttributionHelpers.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/QtPublicSbomAttributionHelpers.cmake b/cmake/QtPublicSbomAttributionHelpers.cmake index ab210869f1a..ce9224e279e 100644 --- a/cmake/QtPublicSbomAttributionHelpers.cmake +++ b/cmake/QtPublicSbomAttributionHelpers.cmake @@ -164,6 +164,11 @@ function(_qt_internal_sbom_handle_qt_attribution_files out_prefix_outer) string(APPEND attribution_target "${${out_prefix}_attribution_id}") endif() + # Sanitize the target name, to avoid issues with slashes and other unsupported chars + # in target names. + string(REGEX REPLACE "[^a-zA-Z0-9_-]" "_" + attribution_target "${attribution_target}") + set(sbom_args "") # Always propagate the package supplier, because we assume the supplier for 3rd