Skip to content

Commit 2d4eef9

Browse files
authored
Merge branch 'main' into p25
2 parents 37e1da3 + 6df7b5d commit 2d4eef9

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed

.github/workflows/binaries.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,25 +104,46 @@ jobs:
104104
echo "STELLAR_CLI_INSTALLER_BASENAME=${installer_basename}" >> $GITHUB_ENV
105105
echo "STELLAR_CLI_INSTALLER=${installer_basename}.exe" >> $GITHUB_ENV
106106
echo "ARTIFACT_NAME=stellar-cli-${version}-x86_64-pc-windows-msvc.tar.gz" >> $GITHUB_ENV
107+
echo "SM_CLIENT_CERT_FILE=D:\\sm_client_cert.p12" >> "$GITHUB_ENV"
107108
108109
- name: Download Artifact
109110
uses: actions/download-artifact@v5
110111
with:
111112
name: ${{ env.ARTIFACT_NAME }}
113+
112114
- name: Uncompress Artifact
113115
run: tar xvf ${{ env.ARTIFACT_NAME }}
116+
114117
- shell: powershell
115118
run: winget install --id JRSoftware.InnoSetup --scope machine --silent --accept-package-agreements --accept-source-agreements --force
119+
116120
- shell: powershell
117121
run: |
118122
$innoPath = "C:\Program Files (x86)\Inno Setup 6"
119123
echo $innoPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
124+
120125
- name: Build Installer
121126
shell: powershell
122127
run: |
123128
$Env:STELLAR_CLI_VERSION = "${{ env.VERSION }}"
124129
ISCC.exe installer.iss
125130
mv Output/stellar-installer.exe ${{ env.STELLAR_CLI_INSTALLER }}
131+
132+
- name: Setup SM_CLIENT_CERT_FILE
133+
run: |
134+
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/sm_client_cert.p12
135+
shell: bash
136+
137+
- name: Setup Software Trust Manager
138+
if:
139+
github.event_name == 'release' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.head_ref, 'release/')
140+
id: stm-setup
141+
uses: digicert/[email protected]
142+
with:
143+
simple-signing-mode: true
144+
keypair-alias: key_1412258126
145+
input: ${{ env.STELLAR_CLI_INSTALLER }}
146+
126147
- name: Upload Artifact
127148
uses: ./.github/actions/artifact-upload
128149
with:

cmd/soroban-cli/src/commands/contract/info/build.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,25 @@ impl Cmd {
8484
print.infoln(format!("Collecting GitHub attestation from {url}"));
8585
let resp = http::client().get(url).send().await?;
8686
let resp: gh_attest_resp::Root = resp.json().await?;
87-
let Some(attestation) = resp.attestations.first() else {
88-
return Err(Error::AttestationNotFound);
89-
};
90-
let Ok(payload) = base64::engine::general_purpose::STANDARD
91-
.decode(&attestation.bundle.dsse_envelope.payload)
92-
else {
93-
return Err(Error::AttestationInvalid);
94-
};
95-
let payload: gh_payload::Root = serde_json::from_slice(&payload)?;
87+
88+
// Find the SLSA provenance attestation (not the Release attestation)
89+
// GitHub may attach multiple attestations, and we need the one with predicate_type
90+
// matching "https://slsa.dev/provenance/v1"
91+
let payload = resp
92+
.attestations
93+
.iter()
94+
.find_map(|attestation| {
95+
let payload = base64::engine::general_purpose::STANDARD
96+
.decode(&attestation.bundle.dsse_envelope.payload)
97+
.ok()?;
98+
let payload: gh_payload::Root = serde_json::from_slice(&payload).ok()?;
99+
100+
(payload.predicate_type == "https://slsa.dev/provenance/v1").then_some(payload)
101+
})
102+
.ok_or(Error::AttestationNotFound)?;
103+
96104
print.checkln("Attestation found linked to GitHub Actions Workflow Run:");
105+
97106
let workflow_repo = payload
98107
.predicate
99108
.build_definition
@@ -117,7 +126,7 @@ impl Cmd {
117126
.build_definition
118127
.resolved_dependencies
119128
.first()
120-
.unwrap()
129+
.ok_or(Error::AttestationInvalid)?
121130
.digest
122131
.git_commit;
123132
let runner_environment = payload

0 commit comments

Comments
 (0)