Fail crossbuild loudly when Windows signing silently skips#2229
Draft
pose wants to merge 1 commit into
Draft
Conversation
2 tasks
The signing block in `scripts/crossbuild.mk` wraps `az login` / `jsign`
in a `set -e; if [[ ... ]]; then ...; fi` recipe line. POSIX `set -e`
is documented to be suppressed inside `if` condition lists, so when
`[[` fails (e.g. the recipe falls back to /bin/sh on a host where
/bin/sh is dash), the condition silently returns false, the then-block
is skipped, and the recipe exits 0 with an unsigned binary while CI
stays green.
Add `scripts/verify_signed.py`, a small presence check that parses the
PE Optional Header's Certificate Table directory entry and exits non-
zero if it is empty. Wire it into the `bin/%/$(PROVIDER).exe` recipe
as its own recipe line, guarded so it only runs when signing was
expected:
@[ "${GOOS}" != "windows" ] || [ "${SKIP_SIGNING}" = "true" ] || \
python3 scripts/verify_signed.py "$@"
Because the verify is its own recipe line (no `if`-condition wrapping),
make checks its exit code directly and fails the recipe on a missing
signature. The set-e-inside-if antipattern can no longer hide a
silently-skipped signing step.
Part of pulumi/home#4655, pulumi/home#4656, pulumi/home#4657.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8d8d790 to
9cd594a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Windows signing block in
scripts/crossbuild.mkwraps the bash conditional in@set -e; if [[ ... ]]; then ...; fi. POSIXset -eis suppressed insideifcondition lists, so if[[ever fails (e.g. the recipe falls back to/bin/shon a host where/bin/shis dash) the condition silently returns false, the then-block is skipped, and the recipe exits 0 with an unsigned binary. CI stays green.Add
scripts/verify_signed.py, a small presence check that parses the PE Optional Header's Certificate Table directory entry and exits non-zero if it is empty.Wire it into the
bin/%/$(PROVIDER).exerecipe as its own recipe line (noifwrapping), guarded so it only runs when signing was expected:@[ "${GOOS}" != "windows" ] || [ "${SKIP_SIGNING}" = "true" ] || \ python3 scripts/verify_signed.py "$@"Because the verify is its own recipe line, make checks its exit code directly and fails the recipe on a missing signature. The
set -e-inside-ifantipattern can no longer hide a silently-skipped signing step.Test plan
cd provider-ci && make allpasses locally (Go unit tests, actionlint on regenerated test-providers).verify_signed.pyvalidated against a known-signed.exe(exit 0) and a known-unsigned.exe(exit 1 with the documented error).scripts/verify_signed.pyand the new recipe line.Notes
Opened as draft for initial review. PR-field checklist (assignee, reviewers, milestone, project) will be filled once the diff is acked.
Part of pulumi/home#4655, pulumi/home#4656, pulumi/home#4657.
🤖 Generated with Claude Code