Commit 19ebc90
fix(sbom): correctness fixes in gen-sbom
Three review-driven correctness fixes in scripts/gen-sbom,
each shipping with its own regression tests:
* parse_options_h corrupted #define values that contained
a string literal with '/' characters: 're.split(r"/\\*|//",
raw, maxsplit=1)[0]' truncated PACKAGE_URL="https://..."
at the first // inside the URL, so the SBOM emitted
'PACKAGE_URL = "https:'. Replace the regex with a
string-literal-aware state machine (_strip_define_comment)
so quoted '/' characters survive. Char literals are not
handled (autoconf does not emit them, pcpp normalises
user_settings.h before this code sees the value).
Adds four regression tests to TestParseOptionsH (1zj.22).
* --lib accepted /dev/null and emitted the well-known empty-
file SHA-256 (e3b0c44...b855) as the wolfSSL component
checksum. Both SPDX and CDX validators accepted the
result, so a misconfigured build silently shipped an SBOM
whose hash matched no compiled wolfSSL artefact. Hard-fail
on size==0 --lib, with an actionable error. Soft-warn on
zero-byte --srcs entries because cross-compile setups
legitimately include touch'd placeholders. Adds
test_empty_lib_is_rejected and
test_zero_byte_srcs_warn_but_do_not_fail (1zj.23).
* detect_license regex 'or\\s+(any\\s+)?later' failed to
match the canonical FSF GPL preamble phrase 'or (at your
option) any later version' used verbatim in millions of
upstream COPYING files: the parenthetical interjected
between 'or' and 'any later'. Any LICENSING that copied
the FSF preamble was silently mis-detected as GPL-X.0-only.
Broaden to 'or\\s+(?:[^,.;\\n]*?\\s+)?(?:any\\s+)?later'
-- the negative class keeps the match within a sentence so
unrelated 'or' / 'later' tokens further down the file do
not promote a GPLv2-only declaration. Adds GPLv2 + GPLv3
canonical-preamble regression guards. The shipping wolfSSL
LICENSING still maps to GPL-3.0-only; locked down by
test_real_wolfssl_licensing_is_gpl3_only (1zj.24).
Also rebinds the test_zero_byte_srcs_warn_but_do_not_fail
tempfile paths before the try-block so the finally clause
references live filenames on the assertion-failure path
instead of leaking renamed tempfiles in /tmp (e8o.2).
Closes wolfssl-1zj.22, wolfssl-1zj.23, wolfssl-1zj.24,
wolfssl-e8o.21 parent 1644688 commit 19ebc90
2 files changed
Lines changed: 224 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
196 | 205 | | |
197 | 206 | | |
198 | 207 | | |
| |||
338 | 347 | | |
339 | 348 | | |
340 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
341 | 389 | | |
342 | 390 | | |
343 | 391 | | |
| |||
354 | 402 | | |
355 | 403 | | |
356 | 404 | | |
357 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
358 | 408 | | |
359 | 409 | | |
360 | 410 | | |
| |||
368 | 418 | | |
369 | 419 | | |
370 | 420 | | |
371 | | - | |
| 421 | + | |
372 | 422 | | |
373 | 423 | | |
374 | 424 | | |
| |||
898 | 948 | | |
899 | 949 | | |
900 | 950 | | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
901 | 967 | | |
902 | 968 | | |
903 | 969 | | |
904 | 970 | | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
905 | 985 | | |
906 | 986 | | |
907 | 987 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | 309 | | |
317 | 310 | | |
318 | 311 | | |
319 | 312 | | |
320 | 313 | | |
321 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
322 | 343 | | |
323 | 344 | | |
324 | 345 | | |
| |||
488 | 509 | | |
489 | 510 | | |
490 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
491 | 554 | | |
492 | 555 | | |
493 | 556 | | |
| |||
1282 | 1345 | | |
1283 | 1346 | | |
1284 | 1347 | | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1285 | 1355 | | |
1286 | 1356 | | |
1287 | 1357 | | |
1288 | 1358 | | |
1289 | | - | |
| 1359 | + | |
1290 | 1360 | | |
1291 | 1361 | | |
1292 | 1362 | | |
| |||
1295 | 1365 | | |
1296 | 1366 | | |
1297 | 1367 | | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
1298 | 1431 | | |
1299 | 1432 | | |
1300 | 1433 | | |
| |||
0 commit comments