Skip to content

Commit 8e3df77

Browse files
ianlewisramonpetgrave64
authored andcommitted
chore: verify SLSA token at creation
Signed-off-by: Ian Lewis <[email protected]>
1 parent 24e3463 commit 8e3df77

File tree

3 files changed

+4
-31
lines changed

3 files changed

+4
-31
lines changed

actions/delegator/setup-generic/dist/index.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,6 @@ const tscommon = __importStar(__nccwpck_require__(3945));
6969
function run() {
7070
return __awaiter(this, void 0, void 0, function* () {
7171
try {
72-
/* Test locally:
73-
$ env INPUT_SLSA-WORKFLOW-RECIPIENT="laurentsimon/slsa-delegated-tool" \
74-
INPUT_SLSA-REKOR-LOG-PUBLIC=true \
75-
INPUT_SLSA-RUNNER-LABEL="ubuntu-latest" \
76-
INPUT_SLSA-BUILD-ACTION-PATH="./actions/build-artifacts-composite" \
77-
INPUT_SLSA-WORKFLOW-INPUTS="{\"name1\":\"value1\",\"name2\":\"value2\",\"name3\":\"value3\",\"name4\":\"value4\"}" \
78-
INPUT_SLSA-WORKFLOW-INPUTS-MASK="name2, name4" \
79-
INPUT_SLSA-CHECKOUT-FETCH-DEPTH="2" \
80-
INPUT_SLSA-CHECKOUT-REPOSITORY-SHA1="abcdef" \
81-
INPUT_SLSA-VERSION="v1" \
82-
nodejs ./dist/index.js
83-
*/
8472
const slsaVersion = core.getInput("slsa-version");
8573
if (!["v1.0", "v0.2"].includes(slsaVersion)) {
8674
throw new Error(`Unsupported slsa-version: ${slsaVersion}`);
@@ -172,8 +160,7 @@ function run() {
172160
const bundle = yield (0, sigstore_1.sign)(Buffer.from(unsignedB64Token));
173161
// Verify just to double check.
174162
// NOTE: this is an offline verification.
175-
// TODO(#1668): re-enable verification.
176-
// await sigstore.verify(bundle, Buffer.from(unsignedB64Token));
163+
yield (0, sigstore_1.verify)(bundle, Buffer.from(unsignedB64Token));
177164
const bundleStr = JSON.stringify(bundle);
178165
const bundleB64 = Buffer.from(bundleStr).toString("base64");
179166
core.info(`bundleStr: ${bundleStr}`);

actions/delegator/setup-generic/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/delegator/setup-generic/src/main.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,11 @@ limitations under the License.
1414
import * as github from "@actions/github";
1515
import * as core from "@actions/core";
1616
import * as process from "process";
17-
import { sign } from "sigstore";
17+
import { sign, verify } from "sigstore";
1818
import * as tscommon from "tscommon";
1919

2020
async function run(): Promise<void> {
2121
try {
22-
/* Test locally:
23-
$ env INPUT_SLSA-WORKFLOW-RECIPIENT="laurentsimon/slsa-delegated-tool" \
24-
INPUT_SLSA-REKOR-LOG-PUBLIC=true \
25-
INPUT_SLSA-RUNNER-LABEL="ubuntu-latest" \
26-
INPUT_SLSA-BUILD-ACTION-PATH="./actions/build-artifacts-composite" \
27-
INPUT_SLSA-WORKFLOW-INPUTS="{\"name1\":\"value1\",\"name2\":\"value2\",\"name3\":\"value3\",\"name4\":\"value4\"}" \
28-
INPUT_SLSA-WORKFLOW-INPUTS-MASK="name2, name4" \
29-
INPUT_SLSA-CHECKOUT-FETCH-DEPTH="2" \
30-
INPUT_SLSA-CHECKOUT-REPOSITORY-SHA1="abcdef" \
31-
INPUT_SLSA-VERSION="v1" \
32-
nodejs ./dist/index.js
33-
*/
34-
3522
const slsaVersion = core.getInput("slsa-version");
3623
if (!["v1.0", "v0.2"].includes(slsaVersion)) {
3724
throw new Error(`Unsupported slsa-version: ${slsaVersion}`);
@@ -132,8 +119,7 @@ async function run(): Promise<void> {
132119

133120
// Verify just to double check.
134121
// NOTE: this is an offline verification.
135-
// TODO(#1668): re-enable verification.
136-
// await sigstore.verify(bundle, Buffer.from(unsignedB64Token));
122+
await verify(bundle, Buffer.from(unsignedB64Token));
137123
const bundleStr = JSON.stringify(bundle);
138124

139125
const bundleB64 = Buffer.from(bundleStr).toString("base64");

0 commit comments

Comments
 (0)