Repository navigation
Commit 508db95
fix: strip OCI image tag when pushing attestation to registry (#464)
* fix: strip :tag from discovered OCI subject names
An OCI subject discovered from $GITHUB_ARTIFACTS_LIST can carry a :tag
in its name (e.g. ghcr.io/owner/app:12345) when the producer captures a
tagged reference. The registry-push path passes the subject name to
@sigstore/oci's parseImageName, which only accepts a bare
"registry/repository" reference and throws "Invalid image name" on any
tag.
Normalize OCI names by stripping a trailing :tag before dedup and
registry push. The entry's digest already pins the exact image, so the
tag is redundant. A registry port (e.g. localhost:5000/repo) is
preserved by only stripping a colon that appears after the final path
separator.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1f0a618f-2ff5-464e-9c70-e29acccf2c3d
* refactor: strip OCI tag only at the registry-push boundary
Preserve any `:tag` on discovered OCI subjects in the attestation subject and
strip it only when attaching/pushing the attestation to the registry, where a
bare `registry/repository` reference is required. The subject digest already
pins the exact image.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1f0a618f-2ff5-464e-9c70-e29acccf2c3d
* docs: drop README changes for OCI tag handling
This is an internal push-boundary detail that doesn't need end-user docs.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1f0a618f-2ff5-464e-9c70-e29acccf2c3d
* fix: don't strip digest separator in stripOCITag
Guard stripOCITag against digest references (e.g. "…/app@sha256:…"): the ':'
inside a digest is not a tag separator, so bail out when an '@' is present to
avoid returning a corrupt reference. Add unit coverage for digest and
tag+digest forms.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1f0a618f-2ff5-464e-9c70-e29acccf2c3d
* refactor: reduce OCI ref to bare name for all tag/digest forms
Rename stripOCITag -> bareImageName and strip both tag and digest suffixes so
the registry-push boundary always receives a valid bare "registry/repository"
reference, covering all four reference forms:
foo/bar, foo/bar:tag, foo/bar@sha256:…, foo/bar:tag@sha256:…
The previous "@"-guard merely returned digest references unchanged, which
@sigstore/oci still rejects. A registry port (colon before the final path
separator) is still preserved. Add unit coverage for the digest and
port+digest forms.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1f0a618f-2ff5-464e-9c70-e29acccf2c3d
---------
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1f0a618f-2ff5-464e-9c70-e29acccf2c3d1 parent dda48f2 commit 508db95
6 files changed
Lines changed: 392 additions & 177 deletions
File tree
- __tests__
- fixtures
- integration
- unit
- dist
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
206 | 213 | | |
207 | 214 | | |
208 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
142 | 161 | | |
143 | 162 | | |
144 | 163 | | |
| |||
166 | 185 | | |
167 | 186 | | |
168 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
169 | 202 | | |
170 | 203 | | |
171 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
707 | 708 | | |
708 | 709 | | |
709 | 710 | | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
710 | 814 | | |
711 | 815 | | |
712 | 816 | | |
| |||
0 commit comments