ci: gate call-check-tflite-files behind approval-gate#3530
Open
adilburaksen wants to merge 1 commit intotensorflow:mainfrom
Open
ci: gate call-check-tflite-files behind approval-gate#3530adilburaksen wants to merge 1 commit intotensorflow:mainfrom
adilburaksen wants to merge 1 commit intotensorflow:mainfrom
Conversation
The call-check-tflite-files job was the only CI job in pr_test.yml that lacked a dependency on gatekeeper/approval-gate. All other call-* jobs require [gatekeeper, approval-gate], but this job ran unconditionally for every pull_request_target event. This means check_tflite_files.yml was checking out the fork's HEAD SHA and executing tensorflow/lite/micro/tools/ci_build/check_tflite_files.sh from the fork's tree in the context of the base repository's workflow, exposing GITHUB_TOKEN to untrusted code. Fix: add needs: [gatekeeper, approval-gate] to bring this job in line with all other CI jobs in this workflow.
Author
|
Hi @veblush — gentle ping. Updated the PR description to add the |
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.ymlwas the only CI job that did not require[gatekeeper, approval-gate]. All othercall-*jobs are gated, but this one ran unconditionally on everypull_request_targetevent.Root Cause
check_tflite_files.ymlchecks out the PR'shead.sha(i.e. fork code) and executestensorflow/lite/micro/tools/ci_build/check_tflite_files.shfrom that checkout — running untrusted contributor code in the base repository's workflow context withGITHUB_TOKENexposed via theTFLM_BOT_TOKENenvironment variable.Fix
Add
needs: [gatekeeper, approval-gate]tocall-check-tflite-filesto match all other CI jobs in this workflow.Alternative (stronger fix)
check_tflite_files.ymldoes not need to execute any contributor-provided code at all. The PR file list can be fetched entirely via the GitHub API using the base repository's token, without checking out fork code. Consider refactoring to:ref:override)curl -H "Authorization: Bearer $TFLM_BOT_TOKEN" .../pulls/$PR_NUMBER/fileswith the base repo's tokenThis would make the check safe to run ungated.
BUG=N/A