fix: add missing approval gate to check-tflite-files job to prevent untrusted code execution#3500
Open
mohammadmseet-hue wants to merge 1 commit intotensorflow:mainfrom
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
ca0e8f0 to
ba739bc
Compare
ba739bc to
28a9bb4
Compare
…ntrusted code execution BUG=b/none
28a9bb4 to
d812bdc
Compare
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.
Summary
The
call-check-tflite-filesjob inpr_test.ymlis missing theneeds: [gatekeeper, approval-gate]dependency that every other CI job in this workflow has. This causes it to run unconditionally onpull_request_targetsynchronize events — including PRs from external forks — bypassing the two-phase approval system.Security Impact
The called workflow (
check_tflite_files.yml) does two things with attacker-controlled input:ref: ${{ inputs.trigger-sha }}tensorflow/lite/micro/tools/ci_build/check_tflite_files.shAn external attacker who modifies
check_tflite_files.shin their fork achieves arbitrary code execution in the CI runner.Why permission scoping does NOT mitigate this
In some
pull_request_targetworkflows, permission isolation can limit impact — for example, if the job running untrusted code only hascontents: readand a separate job (running only base repo code) holds write tokens. That defense does not apply here, because:check_tflite_files.ymlreusable workflow directly receivesTFLM_BOT_TOKENvia thesecretsinput (line 15-16 ofcheck_tflite_files.yml)github.tokenwhen the bot token is unavailable:TFLM_BOT_TOKEN: ${{ secrets.tflm-bot-token || github.token }}permissions:block restricts the defaultGITHUB_TOKENscopeThis means the attacker's code runs with write access to the repository.
The Fix
This PR adds the same
needs:andif:guards that already protectcall-core,call-windows,call-cortex-m,call-xtensa,call-hexagon, andcall-riscv:Comparison: All jobs in pr_test.yml
needs: [gatekeeper, approval-gate]call-corecall-windowscall-cortex-mcall-xtensacall-hexagoncall-riscvcall-check-tflite-files