ci: gate call-check-tflite-files behind approval-gate#3530
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.
|
Hi @veblush — gentle ping. Updated the PR description to add the |
|
Hi @veblush — pinging again in case this got lost in the queue. This is a one-line security fix: The fix brings it in line with the existing gating pattern — no functional change to what the job does, just when it runs. Happy to do the stronger refactor (API-only file list, no fork checkout) if that's preferred, but this minimal fix closes the immediate exposure. Thanks! |
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