Skip to content

Commit 685f924

Browse files
committed
fix(sbom): fix false positives in monthly license audit
Three issues caused the monthly audit to report already-resolved submodules: 1. The audit workflow grepped for "NOASSERTION" anywhere in the output, matching the Detected column even when the Final column had a valid override (e.g. libtomcrypt detected as NOASSERTION but overridden to Unlicense). Changed to grep for "<-- UNRESOLVED" marker instead. 2. Submodules with an explicit NOASSERTION override in license-overrides.yaml (like libfc-sensor-api, which is proprietary) were still counted as failures. Now treated as "acknowledged" since someone intentionally added the override entry. 3. Added missing BSD-3-Clause override for sitl_gazebo-classic (PX4 org project with no LICENSE file in repo). Fixes #26932 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
1 parent 0ffa4e7 commit 685f924

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/sbom_monthly_audit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ jobs:
3939
- name: Check for issues
4040
id: check
4141
run: |
42-
if grep -q "NOASSERTION" /tmp/sbom-verify.txt; then
42+
if grep -q "<-- UNRESOLVED" /tmp/sbom-verify.txt; then
4343
echo "has_issues=true" >> "$GITHUB_OUTPUT"
44-
# Extract NOASSERTION lines
45-
grep "NOASSERTION" /tmp/sbom-verify.txt | grep -v "skipped" > /tmp/sbom-issues.txt || true
44+
# Extract only genuinely unresolved license lines
45+
grep "<-- UNRESOLVED" /tmp/sbom-verify.txt > /tmp/sbom-issues.txt || true
4646
# Extract copyleft lines
4747
sed -n '/Copyleft licenses detected/,/^$/p' /tmp/sbom-verify.txt > /tmp/sbom-copyleft.txt || true
4848
else

Tools/ci/generate_sbom.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ def verify_licenses(source_dir):
478478
sub_dir = source_dir / sub_path
479479

480480
checked_out = sub_dir.is_dir() and any(sub_dir.iterdir())
481+
has_explicit_override = sub_path in license_overrides
481482
if not checked_out:
482483
detected = "(not checked out)"
483484
override = license_overrides.get(sub_path, "")
@@ -487,9 +488,12 @@ def verify_licenses(source_dir):
487488
override = license_overrides.get(sub_path, "")
488489
final = override if override else detected
489490

490-
if final == "NOASSERTION" and checked_out:
491+
if final == "NOASSERTION" and has_explicit_override:
492+
# Explicitly acknowledged in overrides file — not a failure
493+
marker = " (acknowledged)"
494+
elif final == "NOASSERTION" and checked_out:
491495
has_noassertion = True
492-
marker = " <-- NOASSERTION"
496+
marker = " <-- UNRESOLVED"
493497
elif final == "NOASSERTION" and not checked_out:
494498
marker = " (skipped)"
495499
else:
@@ -521,7 +525,7 @@ def verify_licenses(source_dir):
521525
print()
522526

523527
if has_noassertion:
524-
print("FAIL: Some submodules resolved to NOASSERTION. "
528+
print("FAIL: Some submodules have unresolved licenses. "
525529
"Add an entry to Tools/ci/license-overrides.yaml or check the LICENSE file.")
526530
return 1
527531

Tools/ci/license-overrides.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ overrides:
99
license: "LGPL-3.0-only AND MIT"
1010
comment: "Generator is LGPL-3.0; PX4 ships only MIT-licensed generated headers."
1111

12+
Tools/simulation/gazebo-classic/sitl_gazebo-classic:
13+
license: "BSD-3-Clause"
14+
comment: >-
15+
PX4 org project. No LICENSE file in repo; source files carry
16+
BSD-3-Clause headers consistent with the PX4 project license.
17+
1218
src/lib/cdrstream/cyclonedds:
1319
license: "EPL-2.0 OR BSD-3-Clause"
1420
comment: >-

0 commit comments

Comments
 (0)