From 49c82bd613ef66c4d5789ffd54250a71a48cb1f7 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Tue, 17 Nov 2026 11:37:36 +0100 Subject: [PATCH] ci: publish to extension registries with trusted publishing Publishing to the VS Code Marketplace and Open VSX relies on access tokens stored as repository secrets. They are long-lived bearer credentials, scoped to the whole publisher rather than to a single extension, and readable by every job in the repo: a compromised job or a leaked secret grants write access to every extension under `redhat` until the token is revoked. They also have to be rotated by hand on a schedule, and because the same token is shared across many repos, every rotation means updating all of them -- while a missed rotation breaks releases until someone notices. Trusted Publishing replaces them with an OIDC token minted for a single workflow run and validated by each registry against this repository and workflow file. Nothing long-lived is stored, a leaked log or a compromised job yields no reusable credential, and there is no rotation left to do. Publishing happens on a nightly schedule (pre-release) and on manual dispatch (stable). That workflow therefore remains the single publishing path and is the one registered as trusted publisher on both registries. - VS Code Marketplace: `vsce publish --oidc` - Open VSX: `ovsx publish --trusted-publishing` - grant `id-token: write` to the publishing job - bump Node.js to 22, required by current @vscode/vsce and ovsx Signed-off-by: Fred Bricon --- .github/workflows/release.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 790b0c37b..64f8a75cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,7 +94,7 @@ jobs: - name: Set Up NodeJS uses: actions/setup-node@v5 with: - node-version: '20' + node-version: '22' - name: Install NodeJS dependencies run: npm install -g typescript "@vscode/vsce" "ovsx" - name: Download JDT-LS Release @@ -167,12 +167,15 @@ jobs: release-job: environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' || 'pre-release' }} runs-on: ubuntu-latest + permissions: + contents: read + id-token: write needs: packaging-job steps: - name: Set Up NodeJS uses: actions/setup-node@v5 with: - node-version: '20' + node-version: '22' - name: Install dependencies run: | npm install -g typescript "@vscode/vsce" "ovsx" @@ -182,16 +185,16 @@ jobs: if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }} run: | for platformVsix in java-*-*-${GITHUB_RUN_NUMBER}.vsix; do - vsce publish --skip-duplicate -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath ${platformVsix} + vsce publish --skip-duplicate --oidc --packagePath ${platformVsix} done - vsce publish --skip-duplicate -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-java-*-${GITHUB_RUN_NUMBER}.vsix + vsce publish --skip-duplicate --oidc --packagePath vscode-java-*-${GITHUB_RUN_NUMBER}.vsix - name: Publish to OpenVSX Registry if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }} run: | for platformVsix in java-*-*-${GITHUB_RUN_NUMBER}.vsix; do - ovsx publish --skip-duplicate -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath ${platformVsix} + ovsx publish --skip-duplicate --trusted-publishing --packagePath ${platformVsix} done - ovsx publish --skip-duplicate -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-java-*-${GITHUB_RUN_NUMBER}.vsix + ovsx publish --skip-duplicate --trusted-publishing --packagePath vscode-java-*-${GITHUB_RUN_NUMBER}.vsix - name: Delete saved artifact if: always() uses: geekyeggo/delete-artifact@e46cfb9575865f907c2beb2e4170b5f4c7d77c52