Commit 3facf99
feat(slsa): implement SLSA L3 auto-enablement with precedence hierarchy
SUMMARY
When provenance.slsa: true is configured in WORKSPACE.yaml, automatically
enable all SLSA L3 runtime features to ensure build integrity and supply
chain security.
FEATURES
Automatically enables when provenance.slsa: true:
- Cache verification (LEEWAY_SLSA_CACHE_VERIFICATION=true)
- In-flight checksums (LEEWAY_ENABLE_IN_FLIGHT_CHECKSUMS=true)
- Docker export mode (LEEWAY_DOCKER_EXPORT_TO_CACHE=true)
- Source URI (LEEWAY_SLSA_SOURCE_URI from Git origin)
PRECEDENCE HIERARCHY
Implements 5-layer precedence for Docker export mode:
1. CLI flag (--docker-export-to-cache) - highest priority
2. User environment variable (set before workspace loading)
3. Package config (exportToCache in BUILD.yaml)
4. Workspace default (auto-set by provenance.slsa: true)
5. Global default (false - legacy behavior)
BREAKING CHANGES
- ExportToCache field changed from bool to *bool in DockerPkgConfig
- Enables pointer-based detection: nil (not set) vs false (explicit)
- Allows package-level overrides of workspace SLSA defaults
ARTIFACT DISTINGUISHABILITY
Artifacts built with SLSA enabled include "provenance: version=3 slsa"
in their manifest, changing the version hash. This ensures SLSA L3
artifacts are automatically distinguishable from legacy artifacts in
the cache, preventing collision and enabling proper verification.
BACKWARD COMPATIBILITY
Fully backward compatible:
- Existing workspaces without provenance.slsa continue working unchanged
- Explicit environment variables take precedence over auto-set values
- Package-level exportToCache config still respected
- All existing tests updated and passing
DOCUMENTATION
- Fixed SLSA version reference (v0.1 → v0.2)
- Added "Automatic SLSA L3 Feature Activation" section
- Added configuration precedence documentation
- Added 4 usage scenarios with examples
- Added troubleshooting guidance
TESTING
- 16 new test scenarios covering all precedence layers
- TestDockerExport_PrecedenceHierarchy: 11 scenarios
- TestWorkspace_ApplySLSADefaults: 5 scenarios
- All existing tests updated for pointer-based config
- Smoke test verified in real workspace
Co-authored-by: Ona <[email protected]>1 parent a9124b3 commit 3facf99
File tree
7 files changed
+631
-42
lines changed- cmd
- pkg/leeway
7 files changed
+631
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
| 520 | + | |
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
531 | 625 | | |
532 | 626 | | |
533 | 627 | | |
| |||
560 | 654 | | |
561 | 655 | | |
562 | 656 | | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
563 | 700 | | |
564 | 701 | | |
565 | 702 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
| |||
348 | 360 | | |
349 | 361 | | |
350 | 362 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
| 363 | + | |
355 | 364 | | |
356 | 365 | | |
357 | 366 | | |
358 | 367 | | |
359 | | - | |
| 368 | + | |
360 | 369 | | |
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
364 | 373 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | 374 | | |
370 | 375 | | |
371 | 376 | | |
| |||
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
397 | 403 | | |
398 | 404 | | |
399 | 405 | | |
| |||
526 | 532 | | |
527 | 533 | | |
528 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
529 | 544 | | |
530 | 545 | | |
531 | 546 | | |
| |||
1701 | 1716 | | |
1702 | 1717 | | |
1703 | 1718 | | |
1704 | | - | |
1705 | | - | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
1706 | 1767 | | |
1707 | | - | |
1708 | | - | |
1709 | | - | |
1710 | | - | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
1714 | 1774 | | |
1715 | | - | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
1716 | 1785 | | |
1717 | 1786 | | |
1718 | 1787 | | |
| |||
1874 | 1943 | | |
1875 | 1944 | | |
1876 | 1945 | | |
1877 | | - | |
| 1946 | + | |
1878 | 1947 | | |
1879 | 1948 | | |
1880 | 1949 | | |
| |||
1931 | 2000 | | |
1932 | 2001 | | |
1933 | 2002 | | |
1934 | | - | |
| 2003 | + | |
1935 | 2004 | | |
1936 | 2005 | | |
1937 | 2006 | | |
| |||
0 commit comments