From f1924d6643df98387955f8c7ea493451cafc5c8e Mon Sep 17 00:00:00 2001 From: nikhil-mittal-165 Date: Fri, 14 Aug 2026 09:49:03 +0530 Subject: [PATCH 1/2] RELEASE @W-19079373@ Prevent PR title injection in validate-pr workflow (#2079) --- .github/workflows/validate-pr.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 5c390ba1d..849ead8eb 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -3,6 +3,11 @@ on: pull_request: types: [edited, opened, reopened, synchronize] +# Principle of least privilege: this workflow only needs to read repository +# contents. Restricting the token limits the blast radius of any compromised step. +permissions: + contents: read + jobs: # We need to verify that the Pull Request's title matches the desired format. verify_pr_title: @@ -13,10 +18,18 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Verify PR Title + # Pass untrusted values (the PR title and branch refs) via the + # environment rather than direct ${{ }} interpolation, so they are + # treated as data and cannot inject shell commands. + env: + PR_TITLE: ${{ github.event.pull_request.title }} + BASE_REF: ${{ github.base_ref }} + HEAD_REF: ${{ github.head_ref }} run: | - title="${{ github.event.pull_request.title }}" + title="$PR_TITLE" title_upper=$(echo "$title" | tr '[:lower:]' '[:upper:]') - base_ref="${{ github.base_ref }}" + base_ref="$BASE_REF" + head_ref="$HEAD_REF" # Define regex patterns for different types of PR titles MAIN2DEV_REGEX="^MAIN2DEV[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.*MERGING.+[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2}.*" @@ -24,7 +37,7 @@ jobs: PR_INTO_DEV_OR_RELEASE_REGEX="^(FIX|CHANGE|NEW)([[:space:]]*\([^)]+\))?[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+" # Validate PR title based on base_ref and head_ref - if [[ "$base_ref" == "dev" && "${{ startsWith(github.head_ref, 'm2d/') }}" == "true" ]]; then + if [[ "$base_ref" == "dev" && "$head_ref" == m2d/* ]]; then if [[ ! "$title_upper" =~ $MAIN2DEV_REGEX ]]; then echo "::error::Invalid PR title: '$title'. Please follow the format: Main2Dev @W-XXXXXXXX@ Merging.*\d+\.\d+\.\d+" exit 1 @@ -34,7 +47,7 @@ jobs: echo "::error::Invalid PR title: '$title'. Please follow the format: RELEASE @W-XXXXXXXX@ Summary" exit 1 fi - elif [[ "$base_ref" == "dev" || "${{ startsWith(github.base_ref, 'release-') }}" == "true" ]]; then + elif [[ "$base_ref" == "dev" || "$base_ref" == release-* ]]; then if [[ ! "$title_upper" =~ $PR_INTO_DEV_OR_RELEASE_REGEX ]]; then echo "::error::Invalid PR title: '$title'. Please follow the format: FIX|CHANGE|NEW (__) @W-XXXXXXXX@ Summary" exit 1 From fdc42875cfd0d73fd21d62407cc1b181ed8a42e8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Aug 2026 08:41:27 +0000 Subject: [PATCH 2/2] Preparing for v5.16.0 release. --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1a88ad4c..aee2a8277 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@salesforce/plugin-code-analyzer", - "version": "5.15.0", + "version": "5.16.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@salesforce/plugin-code-analyzer", - "version": "5.15.0", + "version": "5.16.0", "license": "BSD-3-Clause", "dependencies": { "@oclif/core": "^4.13.5", diff --git a/package.json b/package.json index aef301a70..c4dfe08be 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/plugin-code-analyzer", "description": "Salesforce Code Analyzer is a unified tool to help Salesforce developers analyze their source code for security vulnerabilities, performance issues, best practices, and more.", - "version": "5.15.0", + "version": "5.16.0", "author": "Salesforce Code Analyzer Team", "bugs": "https://github.com/forcedotcom/code-analyzer/issues", "type": "module",