From d922819d9c64a603b83441b2f7327d9e71de80c9 Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Thu, 15 Oct 2026 16:12:20 +0000 Subject: [PATCH 1/3] resolve code injection vulnerability --- .github/workflows/test-plugin.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index 8c1969fc4..0ba923161 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -4,6 +4,7 @@ on: workflow_call: inputs: triton-ref: + description: Optional Triton branch, tag, or commit. required: false type: string triton-shared-ref: @@ -15,6 +16,7 @@ on: workflow_dispatch: inputs: triton-ref: + description: Optional Triton branch, tag, or commit. required: false type: string triton-shared-ref: @@ -45,14 +47,28 @@ jobs: git clone https://github.com/triton-lang/triton.git triton cd triton HASH="$(cat ../triton_shared/triton-hash.txt)" + if [[ ! "${HASH}" =~ ^[0-9a-fA-F]{40}$ ]]; then + echo "::error::triton-hash.txt must contain a full 40-character hexadecimal commit hash" + exit 1 + fi echo "Checking out Triton commit: ${HASH}" - git checkout "${HASH}" + git checkout --detach "${HASH}" -- - name: Checkout triton at ${{ inputs.triton-ref }} if: ${{ inputs.triton-ref }} working-directory: triton + env: + TRITON_REF_UNTRUSTED: ${{ inputs.triton-ref }} run: | - git checkout ${{ inputs.triton-ref }} + if ! HASH="$(git rev-parse --verify --quiet --end-of-options "${TRITON_REF_UNTRUSTED}^{commit}")"; then + # Non-default branches may only exist as remote-tracking refs. + HASH="$(git rev-parse --verify --end-of-options "refs/remotes/origin/${TRITON_REF_UNTRUSTED}^{commit}")" + fi + if [[ ! "${HASH}" =~ ^[0-9a-fA-F]{40}$ ]]; then + echo "::error::Expected a full Triton commit hash" + exit 1 + fi + git checkout --detach "${HASH}" -- git log -1 - name: Clear Triton Cache @@ -129,8 +145,12 @@ jobs: git clone https://github.com/triton-lang/triton.git triton cd triton HASH="$(cat ../triton_shared/triton-hash.txt)" + if [[ ! "${HASH}" =~ ^[0-9a-fA-F]{40}$ ]]; then + echo "::error::triton-hash.txt must contain a full 40-character hexadecimal commit hash" + exit 1 + fi echo "Checking out Triton commit: ${HASH}" - git checkout "${HASH}" + git checkout --detach "${HASH}" -- - name: Clear Triton Cache run: | From 71be9f8b6413f1a8e0eac1125e9b6017836aff2d Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Thu, 15 Oct 2026 17:03:56 +0000 Subject: [PATCH 2/3] persist credentials off --- .github/workflows/test-plugin.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index 0ba923161..3206a73fd 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -39,6 +39,7 @@ jobs: - name: Checkout Triton-Shared uses: actions/checkout@v4 with: + persist-credentials: false ref: ${{ inputs.triton-shared-ref }} path: triton_shared @@ -137,6 +138,7 @@ jobs: - name: Checkout Triton-Shared uses: actions/checkout@v4 with: + persist-credentials: false ref: ${{ inputs.triton-shared-ref }} path: triton_shared From 0e18d16e77b434e531b92319789a29682ce10ac8 Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Thu, 15 Oct 2026 17:12:05 +0000 Subject: [PATCH 3/3] pin lit to last known good --- .github/workflows/test-plugin.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index 3206a73fd..4f347116f 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -99,7 +99,7 @@ jobs: - name: Run shared middle-layer lit tests working-directory: triton run: | - python3 -m pip install lit + python3 -m pip install "lit<23" LIT_TEST_DIR="build/$(ls build | grep -i cmake)/third_party/triton_shared/test" if [ ! -d "${LIT_TEST_DIR}" ]; then echo "Could not find '${LIT_TEST_DIR}'" ; exit -1 @@ -185,7 +185,7 @@ jobs: - name: Run shared middle-layer lit tests working-directory: triton run: | - python3 -m pip install lit + python3 -m pip install "lit<23" LIT_TEST_DIR="build/$(ls build | grep -i cmake)/third_party/triton_shared/test" if [ ! -d "${LIT_TEST_DIR}" ]; then echo "Coult not find '${LIT_TEST_DIR}'" ; exit -1