diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9e4016e1..1794155d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,7 +25,6 @@ jobs: name: Analyze runs-on: ubuntu-latest permissions: - actions: read contents: read security-events: write diff --git a/.github/workflows/info-needed-closer.yml b/.github/workflows/info-needed-closer.yml index e74976c2..8b9e0979 100644 --- a/.github/workflows/info-needed-closer.yml +++ b/.github/workflows/info-needed-closer.yml @@ -6,8 +6,7 @@ on: types: [trigger-needs-more-info] workflow_dispatch: -permissions: - issues: write +permissions: {} jobs: main: @@ -19,6 +18,7 @@ jobs: - name: Checkout Actions uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false repository: 'microsoft/vscode-github-triage-actions' path: ./actions ref: stable diff --git a/.github/workflows/issue-labels.yml b/.github/workflows/issue-labels.yml index 04496546..ef2ec94e 100644 --- a/.github/workflows/issue-labels.yml +++ b/.github/workflows/issue-labels.yml @@ -7,8 +7,7 @@ on: env: TRIAGERS: '["karthiknadig","eleanorjboyd","anthonykim1"]' -permissions: - issues: write +permissions: {} jobs: # From https://github.com/marketplace/actions/github-script#apply-a-label-to-an-issue. @@ -22,6 +21,7 @@ jobs: - name: Checkout Actions uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false repository: 'microsoft/vscode-github-triage-actions' ref: stable path: ./actions diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index a79571de..190f2d8d 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -13,8 +13,7 @@ jobs: name: 'Ensure Required Labels' runs-on: ubuntu-latest permissions: - issues: write - pull-requests: write + pull-requests: read steps: - name: 'PR impact specified' uses: mheap/github-action-required-labels@23e10fde7e062233401931a0eece796cd9bf3177 # v5.6.0 diff --git a/build/templates/publish.yml b/build/templates/publish.yml index a8460ac4..69f3d652 100644 --- a/build/templates/publish.yml +++ b/build/templates/publish.yml @@ -19,7 +19,7 @@ # # Notes: # - Azure DevOps Marketplace resource GUID (499b84ac-1321-427f-aa17-267ca6975798) is hardcoded in publish script. -# - This uses Managed Identity via AzureCLI@2 to acquire an AAD token and passes it as a PAT. +# - Each publish step uses the managed identity's AAD token through VSCE_PAT. # - Requires extension artifacts already signed (signature file present). # - Node & vsce expected to be prepared by parent pipeline; omit local installation here. # - Artifacts are expected at: $(Build.ArtifactStagingDirectory)/publishFolder/{platform}/ @@ -71,11 +71,12 @@ steps: - ${{ each platform in parameters.buildPlatforms }}: - task: PowerShell@2 displayName: "Publish extension (${{ coalesce(platform.vsceTarget, 'universal') }})" + env: + VSCE_PAT: $(MarketplaceAADToken) inputs: targetType: inline script: | - $aadToken = "$(MarketplaceAADToken)" - if (-not $aadToken) { Write-Error 'MarketplaceAADToken is empty (token acquisition failed).'; exit 1 } + if (-not $env:VSCE_PAT) { Write-Error 'MarketplaceAADToken is empty (token acquisition failed).'; exit 1 } $platformFolder = "${{ coalesce(platform.vsceTarget, 'universal') }}" $root = "$(Build.ArtifactStagingDirectory)/${{ parameters.publishFolder }}/$platformFolder" @@ -105,14 +106,10 @@ steps: if ('${{ parameters.preRelease }}' -eq 'True') { Write-Host 'Publishing as pre-release' - $displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --no-verify --pre-release" - Write-Host $displayCmd - npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --no-verify --pre-release + npx @vscode/vsce@latest publish --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --no-verify --pre-release } else { Write-Host 'Publishing as stable release' - $displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --no-verify" - Write-Host $displayCmd - npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --no-verify + npx @vscode/vsce@latest publish --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath --no-verify } if ($LASTEXITCODE -ne 0) {