Skip to content

Commit

Permalink
[v2-10-test] Add .dockerignore to target workflow override (#43885) (#…
Browse files Browse the repository at this point in the history
…44103)

There is an extra layer of protection that code provided by PR
should not be executed in the context of pull_request_target by
running the code only inside docker container. However the
container is build from local sources, so it could contain other
code. We do not allow that by .dockerignore, but the .dockerignore
should not be overrideable from the incoming PR.
(cherry picked from commit 5d6b836)
  • Loading branch information
potiuk authored and utkarsharma2 committed Dec 4, 2024
1 parent 1eaf5a7 commit 04a9e2d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/actions/checkout_target_commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ runs:
rm -rfv "dev"
rm -rfv ".github/actions"
rm -rfv ".github/workflows"
rm -v ".dockerignore" || true
mv -v "target-airflow/scripts/ci" "scripts"
mv -v "target-airflow/dev" "."
mv -v "target-airflow/.github/actions" "target-airflow/.github/workflows" ".github"
mv -v "target-airflow/.dockerignore" ".dockerignore" || true
if: inputs.pull-request-target == 'true' && inputs.is-committer-build != 'true'
####################################################################################################
# AFTER IT'S SAFE. THE `dev`, `scripts/ci` AND `.github/actions` ARE NOW COMING FROM THE
# BASE_REF - WHICH IS THE TARGET BRANCH OF THE PR. WE CAN TRUST THAT THOSE SCRIPTS ARE SAFE TO RUN.
# AFTER IT'S SAFE. THE `dev`, `scripts/ci` AND `.github/actions` and `.dockerignore` ARE NOW COMING
# FROM THE BASE_REF - WHICH IS THE TARGET BRANCH OF THE PR. WE CAN TRUST THAT THOSE SCRIPTS ARE
# SAFE TO RUN AND CODE AVAILABLE IN THE DOCKER BUILD PHASE IS CONTROLLED BY THE `.dockerignore`.
# ALL THE REST OF THE CODE COMES FROM THE PR, AND FOR EXAMPLE THE CODE IN THE `Dockerfile.ci` CAN
# BE RUN SAFELY AS PART OF DOCKER BUILD. BECAUSE IT RUNS INSIDE THE DOCKER CONTAINER AND IT IS
# ISOLATED FROM THE RUNNER.
Expand Down

0 comments on commit 04a9e2d

Please sign in to comment.