Repository navigation
ci(release): assinar instaladores desktop assim que os secrets de assinatura existirem (E-4) - #18
Merged
Merged
Conversation
…xist DECISÃO ASSUMIDA: a partial credential set (e.g. APPLE_API_KEY_ID without APPLE_API_ISSUER, or an incomplete Azure set) fails that leg with the list of missing secret names instead of silently degrading — electron-builder would throw mid-build anyway. No secrets at all keeps today's unsigned, green build. DECISÃO ASSUMIDA: the signing helper is sparse-checked-out from the workflow's own commit, not from the tag being built, so re-attaching signed installers to v3.8.51 (a tag that predates the helper) works instead of failing on a missing file; such a tag signs with electron-builder's defaults. DECISÃO ASSUMIDA: no network.client/server entitlements — they only apply under App Sandbox, which a Developer ID app does not use. v3.8.51 ships unsigned installers (SmartScreen on Windows, Gatekeeper on macOS) and electron-release.yml had no signing wiring. The certificates must be bought/enrolled by the owner; this makes the pipeline sign the moment the repository secrets exist. - electron-release.yml: the build step receives MAC_CSC_LINK / MAC_CSC_KEY_PASSWORD / APPLE_API_KEY_P8 / APPLE_API_KEY_ID / APPLE_API_ISSUER / APPLE_ID / APPLE_APP_SPECIFIC_PASSWORD / APPLE_TEAM_ID (darwin legs only) and WIN_CSC_LINK / WIN_CSC_KEY_PASSWORD / AZURE_* (win32 leg only) through env:, never interpolated into run:. - scripts/build/electron-signing.mjs: verified against app-builder-lib 26.15.3. An empty CSC_LINK counts as SET there (chooseNotNull, == null), so empty values are deleted, not forwarded. CSC_IDENTITY_AUTO_DISCOVERY=false only on unsigned mac legs (with a cert it would make findIdentity return null). The .p8 goes to a 0600 temp file (notarytool --key takes a path). win.azureSignOptions is added to the CI checkout only when the Azure set is complete, because its mere presence switches winPackager to Azure. Logs "signing: enabled/disabled (missing secret X)" with names only. - electron/package.json: mac.hardenedRuntime + entitlements (JIT, unsigned executable memory) and entitlementsInherit (+ disable-library-validation for the Helper that runs the server and dlopens native addons), applied only when signed. - tests/unit/electron-release-signing-e4.test.ts pins secrets-via-env-only, per-OS gating, the unsigned fallback, no secret literals, SHA pins and the entitlement set. - docs/guides/ELECTRON_GUIDE.md: the exact secrets, .p12/.pfx base64 export, Apple and Windows options, prerequisites, and the re-attach command. audit/RELEASE_READINESS.md E-4: pipeline ready, certificates pending. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…d ref The workflow_dispatch comment in electron-release.yml claimed a dispatch builds the ref it is dispatched on. It does not: web-build, the matrix build and release all check out `ref: needs.validate.outputs.version`, the version tag. Run 34710550989 was dispatched from release/v3.8.51 at 18ec68e and its Windows leg still built tag v3.8.51 (1054f19), which lacks the fix merged at 18ec68e, and failed again. The checkout behaviour is unchanged (pinning to the tag keeps a release reproducible); only the description is corrected. - Rewrite the comment: a dispatch re-attaches assets built from the code at the tag; shipping new code means a new version tag (e.g. v3.8.52). - ELECTRON_GUIDE.md: the re-attach command only re-signs what is at tag v3.8.51, so it can attach signed macOS installers but not a Windows one; signed installers of new code need a new tag. - Guard test: web-build, build and release must each check out needs.validate.outputs.version, and the header comment must say so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LMPrado-DZ23
changed the base branch from
release/v3.8.51
to
release/v3.8.52
September 12, 2026 19:52
Merged
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.
Resumo
Liga a assinatura de código do app desktop (E-4 em
audit/RELEASE_READINESS.md) noelectron-release.yml. A assinatura passa a funcionar sozinha no momento em que o dono do repositório criar os repository secrets.Secrets que o dono precisa criar
MAC_CSC_LINK(.p12 do Developer ID Application em base64),MAC_CSC_KEY_PASSWORDAPPLE_API_KEY_P8,APPLE_API_KEY_ID,APPLE_API_ISSUERAPPLE_ID,APPLE_APP_SPECIFIC_PASSWORD,APPLE_TEAM_IDWIN_CSC_LINK(.pfx em base64),WIN_CSC_KEY_PASSWORDAZURE_TENANT_ID,AZURE_CLIENT_ID,AZURE_CLIENT_SECRET,AZURE_TRUSTED_SIGNING_ENDPOINT,AZURE_TRUSTED_SIGNING_ACCOUNT,AZURE_TRUSTED_SIGNING_PROFILEO passo a passo completo está em
docs/guides/ELECTRON_GUIDE.md§Code Signing: exportar em base64, pré-requisitos e custo, e verificar a assinatura. Depois de criar os secrets, dá para re-disparar o workflow para o tag existente:Atenção ao que esse re-disparo faz. Todos os jobs de build fazem checkout do tag da versão (
needs.validate.outputs.version), não do branch disparado. O re-disparo portanto só re-anexa artefatos construídos a partir do código no tagv3.8.51.release/v3.8.51, falhou exatamente nessa perna.v3.8.52).Correção de comentário (commit separado, a pedido do coordenador)
O comentário do
workflow_dispatchnoelectron-release.ymldizia que o dispatch constrói o ref disparado, o que é falso.web-build,buildereleasefazem checkout deref: ${{ needs.validate.outputs.version }}. Conferido: o run 34710550989 foi disparado derelease/v3.8.51em 18ec68e, e a perna Windows falhou construindo o tagv3.8.51= 1054f19, que não contém 18ec68e (git merge-base --is-ancestor→ NOT in tag).O que mudou
.github/workflows/electron-release.ymlenv:, cada um condicionado aomatrix.os: a perna Windows nunca vê credencial Apple, e vice-versa. Nada é interpolado norun:.persist-credentials: false, vem do commit do próprio workflow. Sem isso, re-disparar o build para o tagv3.8.51, que é anterior ao helper, falharia por arquivo ausente.scripts/build/electron-signing.mjs: decide por perna e rodanpm run build:<target>com o ambiente saneado. Decisões baseadas no código doapp-builder-lib26.15.3, a versão do lockfile:platformPackager.getCscLink()usachooseNotNull(== null), entãoCSC_LINK="", que é como um secret ausente chega ao job, conta como definido. Além disso,macPackager.codeSigningInfosó pula a criação do keychain quando o link é== null. Por isso o helper apaga as variáveis vazias em vez de repassá-las.util/flags.isAutoDiscoveryCodeSignIdentity()é!== "false". Com certificado presente,CSC_IDENTITY_AUTO_DISCOVERY=falsefaz ofindIdentityretornarnulle o build sair sem assinatura. Por isso o valorfalsesó é usado nas pernas mac sem certificado.mac/MacTargetHelper.getNotarizeOptions()lê as variáveis por truthiness e lança erro com conjunto parcial. O helper antecipa isso e falha a perna listando só os nomes dos secrets que faltam. Com certificado mas sem nenhuma credencial de notarização, o build sai assinado sem notarização e com um warning.@electron/notarize2.5.0 passaappleApiKeyparanotarytool --key, ou seja, espera um caminho. O.p8vai para um arquivo 0600 noRUNNER_TEMP, removido nofinally.win.azureSignOptionstroca owinPackagerpara o gerenciador Azure (winPackager.js), por isso esse bloco não pode ficar fixo nopackage.json. O helper o injeta só na cópia do CI quando o conjunto Azure está completo e restaura o arquivo depois. Obuildé removido dopackage.jsonempacotado (fileTransformer.ignoredPackageMetadataProperties).signing: enabled (...)ousigning: disabled (missing secret MAC_CSC_LINK), sempre sem valores.electron/package.json(build.mac) e entitlements, aplicados só em build assinado (MacTargetHelper.buildSignOptionssó roda quando há identidade):hardenedRuntime: true.entitlements→electron/assets/entitlements.mac.plist:allow-jiteallow-unsigned-executable-memory, necessários ao V8.entitlementsInherit→electron/assets/entitlements.mac.inherit.plist: os mesmos dois maisdisable-library-validation. O servidor roda no Helper comELECTRON_RUN_AS_NODEe fazdlopendos addons nativos. É o mesmo conjunto do template padrão do electron-builder, que esses binários receberiam sem este arquivo.tests/unit/electron-release-signing-e4.test.ts: faz o parse do YAML e trava:env:(ou nosecrets:de workflow reutilizável), nunca emrun:;refe todas as actions pinadas por SHA;"";notarize,identityeforceCodeSigningnão definidos.docs/guides/ELECTRON_GUIDE.md§Code Signing reescrita, e a linha E-4 deaudit/RELEASE_READINESS.mdagora diz "pipeline pronto; pendentes só os certificados/segredos".Decisões assumidas / divergências
releasecontinua fail-partial, então as outras plataformas publicam.com.apple.security.network.client/server, pedidos na especificação. Esses entitlements só têm efeito sob App Sandbox, e o hardened runtime não restringe sockets.v3.8.51, assina com os padrões do electron-builder: hardened runtime ligado e o template de entitlements.Verificação (saída real, local, Windows)
Testes (
node --test): os 12 novos do primeiro commit mais os testes existentes (o commit de correção adicionou um 13º, "every build job checks out the version TAG, and the dispatch comment says so": re-execução 27/27 pass, eslint exit=0, check:docs-all exit=0) que inspecionam o workflow e oelectron/package.json.(os 38 incluem
electron-release-desktop-channel-8949,electron-release-efficiency,build/electron-release-latest-yml.repro,distribution-identity,electron-packagingewreq-native-manifest)Gates:
Caminhos de erro do helper, que saem antes de qualquer build:
O que NÃO dá para verificar sem certificados reais
codesign,notarytool, staple e a avaliação do Gatekeeper.Install-Module TrustedSigning, que o electron-builder faz no runner.actions/checkoutpinado por SHA e passa os secrets só porenv:, mas o ratchetzizmorFindingspode se mover se a versão do zizmor no runner tiver auditorias novas sobre uso de secrets.🤖 Generated with Claude Code